Skip to content

Initial Integration of CI Pipeline into Main for Further Testing#48

Open
polygeist111 wants to merge 77 commits intomainfrom
feature/ras-cicd
Open

Initial Integration of CI Pipeline into Main for Further Testing#48
polygeist111 wants to merge 77 commits intomainfrom
feature/ras-cicd

Conversation

@polygeist111
Copy link
Copy Markdown
Collaborator

@polygeist111 polygeist111 commented Mar 30, 2026

The purpose of this PR is to integrate the CI work from the Mesh Reliability & Structure Team into main. This is not expected to be the final commit/stable version of these features, but certain aspects require placement on the main branch for further testing.

The PR brings in files in a few different areas, but hinges on the iml based GitHub Actions workflows. The report outputs of many of these also feed a viewing site via github pages (e.g. https://grey-box.github.io/Project-Mesh/build_reports/index.html), so a large volume of automatically generated files (and a few critical manual ones) exist in the new Build Reports directory.

This pipeline can run APK builds, super-linter, in-depth kotlin linting, tests, test coverage, and documentation generation. It additionally submits to GitHub's dependency graph, and can be easily adapted to include future CI/CD tasks, including Play Store deployment. The linters, where possible, automatically enforce style and formatting consistency. They will flag errors when issues arise that they cannot automatically resolve.

As stated above, this is a working commit. A followup will be made to trim any nonessential files once testing confirms them as such.

This work is also responsible for the automated checks that now run alongside PRs :) My next task is to address as many of the linter issues as possible (and existing testing errors) so as to get much clearer feedback from the system on codebase quality.

polygeist111 and others added 30 commits January 26, 2026 12:40
Original development was done in a fork, and certain processes changed many additional files. A fresh commit (manually copied new files) ensures changes can be better tracked.
This commit introduces all workflows, NPM dependencies, and the build-reports directory (for a web view of CI outputs). The last feature will not work until a GB admin enables Pages on the repo.
Constraints may not be accurate as I am not an android UI person by any means, but their absence blocks most workflows
Missing localization string fails build
Brings the super-linter reusable workflow into the project, instead of referencing my (Thalia Wood, polygeist111) personal reusable workflow repo
Top level build.gradle.kts now targets jave 17
Add placeholder passing content for orchestrator stability
goal is to improve visibility and encourage early corrections
* Dokka containing Added KDoc Comments

* Adding all Kdoc comments, previously written

---------

Co-authored-by: flow733 <apmatter@asu.edu>
commit b006a14
Merge: e7c1da2 742272e
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Sun Mar 1 13:06:02 2026 -0700

    Merge branch 'unitTesting-asu2025F' of https://github.com/grey-box/Project-Mesh into unitTesting-asu2025F

commit e7c1da2
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Sun Mar 1 13:05:48 2026 -0700

    Add NotificationHelper tests and UML

    Adds a Robolectric test for NotificationHelper and supporting UML assets. New test (app/src/test/java/com/greybox/projectmesh/util/NotificationHelperTest.kt) verifies: creation of notification channel on API 26+, no channel behavior on API <26, and that showFileReceivedNotification posts a notification with expected title/text/auto-cancel flag and intent extras. Also adds UML diagram and image (uml/class-diagrams/components/util/NotificationHelper.puml and uml/Images/Components/util/NotificationHelper.png) documenting the NotificationHelper API and its related classes. These changes improve test coverage and documentation for notification behavior.

commit 1d5f904
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Sun Mar 1 12:45:16 2026 -0700

    Add UserEntity tests and UML diagrams

    Add unit tests for UserEntity that verify default nullable fields, data class equality/hashCode/copy behavior, and kotlinx.serialization round-trip. Also add a PlantUML class diagram and corresponding PNG image to document the UserEntity structure.

commit 99c5068
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Sun Mar 1 12:35:15 2026 -0700

    Add UserDao tests and UML diagram

    Add comprehensive unit tests for UserDao using an in-memory Room database and Robolectric (SDK 29). Tests cover insert/getByUuid, getUserByIp, updateUser, hasWithID, getAllConnectedUsers, getAllUsers, and missing-query behavior, and use ExperimentalCoroutinesApi with runTest. Also add a PlantUML class diagram and corresponding PNG for the UserDao component.

commit 7ddd663
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Sun Mar 1 12:30:20 2026 -0700

    Add MessageService tests and UML diagrams

    Add unit tests for MessageService (MessageServiceTest.kt) covering sendMessage behavior: verifies message is saved before network send, repository failures prevent network sends, and network failures propagate after save. Also add UML assets (MessageService.png and MessageService.puml) documenting the MessageService class and its dependencies.

commit 742272e
Author: Jai Patel <22jaipp@gmail.com>
Date:   Sun Mar 1 03:23:53 2026 -0700

    Organised images and Puml Files according to components

commit 3cd62ba
Merge: 58bc3ab 1091cfd
Author: Jai Patel <22jaipp@gmail.com>
Date:   Sun Mar 1 03:23:43 2026 -0700

    Merge remote-tracking branch 'origin/unitTesting-asu2025F' into unitTesting-asu2025F

commit 58bc3ab
Author: Jai Patel <22jaipp@gmail.com>
Date:   Sun Mar 1 03:23:32 2026 -0700

    Organised images and Puml Files according to components

commit 7d94de2
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Wed Feb 25 19:35:09 2026 -0700

    Add MessageNetworkHandler tests and UML diagrams

    Add comprehensive unit tests for MessageNetworkHandler (app/src/test/.../MessageNetworkHandlerTest.kt) covering sendChatMessage (request construction, file query param, and exception handling) and handleIncomingMessage (mapping messages to users, conversation creation/update, and unknown-sender behavior). Tests mock OkHttp, Kodein DI, repositories and GlobalApp globals. Also add UML class diagram and PNG (uml/class-diagrams/... .puml and uml/Images/...) describing MessageNetworkHandler structure and companion.

commit d6a6347
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Wed Feb 25 19:29:51 2026 -0700

    Add messaging UML images and relocate diagrams

    Add PNG renderings for messaging UML assets (Conversation, ConversationDao, JSONSchema, Message, MessageDao) under uml/Images/Components/messaging and move corresponding .puml class diagrams into uml/class-diagrams/components/messaging to better organize messaging-related UML files.

commit 1091cfd
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Wed Feb 25 18:58:28 2026 -0700

    Created tests for messaging/data

commit 1099fd2
Author: Jai Patel <22jaipp@gmail.com>
Date:   Mon Feb 16 15:52:01 2026 -0700

    Organised images and Puml Files according to components

commit 70731a0
Author: Jai Patel <22jaipp@gmail.com>
Date:   Mon Feb 16 15:51:51 2026 -0700

    Organised images and Puml Files according to components

commit 83ff9cf
Author: Jai Patel <22jaipp@gmail.com>
Date:   Mon Feb 16 15:33:06 2026 -0700

    final files of ViewModel Component

commit ef3fde4
Author: Jai Patel <22jaipp@gmail.com>
Date:   Mon Feb 16 15:30:13 2026 -0700

    final files of ViewModel Component

commit 2fa97bc
Author: Jai Patel <22jaipp@gmail.com>
Date:   Mon Feb 16 15:10:44 2026 -0700

    final files of ViewModel Component

    # Conflicts:
    #	app/src/test/java/com/greybox/projectmesh/viewModel/SelectDestNodeScreenViewModelTest.kt
    #	app/src/test/java/com/greybox/projectmesh/viewModel/SendScreenViewModelTest.kt
    #	app/src/test/java/com/greybox/projectmesh/viewModel/SettingsScreenViewModelTest.kt

commit 4ab5222
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Sun Feb 15 18:44:02 2026 -0700

    Add tests for ContentResolver and ViewModel

    Add unit tests for ContentResolver extension and SelectDestNodeScreenViewModel. Tests cover getUriNameAndSize (file URIs, null/query/cursor behaviors, name/size extraction) and ViewModel behaviors (initial state, collecting node state, onClickReceiver success/failure paths and interactions with AppServer). Also add UML class diagram sources and PNG images for both components. Minor whitespace adjustment in SelectDestNodeScreenViewModel.kt.

commit 7026b2c
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Sun Feb 15 18:28:44 2026 -0700

    Add UML images for viewmodels and repository

    Add PNG UML diagrams for SendScreenViewModel, SettingsScreenViewModel, and UserRepository under uml/Images. These new binary assets provide visual documentation of the viewmodel and repository structure.

commit 18a89ef
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Sun Feb 15 18:25:27 2026 -0700

    Created UserRepository, SendScreenVM, SettingsScreenVM

commit b103b1d
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Sun Feb 15 18:15:24 2026 -0700

    Tested DeviceStatusManager, ConversationRepository, MessageRepository

commit 3be481d
Author: Jai Patel <22jaipp@gmail.com>
Date:   Thu Feb 12 13:59:13 2026 -0700

    Created Unit more testing files for multiple files

commit a1d3c17
Author: Jai Patel <22jaipp@gmail.com>
Date:   Thu Feb 12 13:36:28 2026 -0700

    Created Unit more testing files for multiple files

commit 57a4cdf
Author: Jai Patel <22jaipp@gmail.com>
Date:   Sun Feb 1 21:29:53 2026 -0700

    Created Unit more testing files for multiple files

commit 5fe521b
Author: Jai Patel <22jaipp@gmail.com>
Date:   Sun Feb 1 19:37:40 2026 -0700

    Created Unit more testing files for multiple files

commit b67861d
Author: Jai Patel <22jaipp@gmail.com>
Date:   Sun Feb 1 19:37:08 2026 -0700

    Created Unit more testing files for multiple files

commit da7317e
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Mon Dec 1 19:44:26 2025 -0700

    Created MessageUtils.puml

commit ec12fe0
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Mon Dec 1 19:43:39 2025 -0700

    Created MessageMigrationUtils.puml

commit d4c7f6c
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Mon Dec 1 19:41:51 2025 -0700

    Created Logger.puml

commit fcfaf28
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Mon Dec 1 19:40:26 2025 -0700

    Created FileEncoder.puml

commit 8817def
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Mon Dec 1 19:38:01 2025 -0700

    Created ConversationUtils.puml

commit 9befe75
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Mon Dec 1 19:36:04 2025 -0700

    Created ListExtension.puml

commit d3ae065
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Mon Dec 1 19:34:19 2025 -0700

    Created InputStreamCounter.puml

commit d716450
Merge: b8aad94 922c607
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Tue Nov 25 15:50:31 2025 -0700

    Merge branch 'main' into unitTesting-asu2025F

commit b8aad94
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Mon Nov 24 18:07:25 2025 -0700

    Added 4 new test files

    Added tests for FileEncoder, Logger, MessageMigrationUtils and MessageUtils

commit 31f7046
Author: Jai Patel <22jaipp@gmail.com>
Date:   Sat Nov 22 19:01:43 2025 -0700

    Created Unit more testing files for multiple files

commit 922c607
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Nov 13 19:52:17 2025 -0700

    Correct artifact expiration period

commit d3250d3
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Thu Nov 13 11:25:27 2025 -0700

    Add detailed comments to test classes

    Added descriptive block and section comments to ListExtensionTest, ConversationUtilsTest, and InputStreamCounterTest to clarify test coverage, intent, and expected behaviors for JVM-only extension and utility functions. Improves maintainability and understanding of test cases.

commit d6ad974
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Thu Nov 13 11:12:19 2025 -0700

    Add unit tests for ConversationUtils

    Introduces ConversationUtilsTest to verify conversation ID creation logic, including handling of identical UUIDs and special cases for device UUIDs.

commit 597de63
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Thu Nov 13 03:21:45 2025 -0700

    Add ListExtensionTest and rename InputStreamCounterTest methods

    Introduced ListExtensionTest to cover updateItem extension function with various scenarios. Renamed test methods in InputStreamCounterTest for improved clarity and consistency.

commit c28cc89
Author: taimuradam <taimur.adam1@gmail.com>
Date:   Wed Nov 12 22:47:09 2025 -0700

    Remove redundant read override and add tests for InputStreamCounter

    Deleted the unnecessary override of read(ByteArray) in InputStreamCounter, relying on the existing read(ByteArray, Int, Int) implementation for byte counting. Added unit tests for InputStreamCounter to verify byte counting and closed state behavior.

commit 67360c0
Author: Jai Patel <22jaipp@gmail.com>
Date:   Wed Nov 12 15:58:41 2025 -0700

    Created Unit testing file specifically to test WifiConnection.kt

commit e624eff
Author: Jai Patel <22jaipp@gmail.com>
Date:   Wed Nov 12 15:36:27 2025 -0700

    Created Unit testing file specifically to test WifiConnection.kt

commit d1f91ba
Author: Jai Patel <22jaipp@gmail.com>
Date:   Wed Nov 12 14:41:35 2025 -0700

    Created Unit testing file specifically to test WifiConnection.kt

commit 2ce6e4e
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Tue Nov 11 16:29:48 2025 -0700

    Improve Action Summaries

commit cd6ce5f
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Tue Nov 11 15:57:51 2025 -0700

    Add job concurrency and debug coverage workflow

commit ff87ded
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Tue Nov 11 15:49:26 2025 -0700

    Improve Actions Summaries

commit ac4829d
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Tue Nov 11 15:31:08 2025 -0700

    Improve Actions Summaries

commit dfc6b99
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Tue Nov 11 15:17:56 2025 -0700

    Update Action names and add build comment for APKs

commit c2ee7b2
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Tue Nov 11 14:50:27 2025 -0700

    Attempt to understand actions failure #4

    - Adjust path printing
    - Add artifact upload action steps for build

commit 541edd3
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Tue Nov 11 14:41:23 2025 -0700

    Attempt to understand actions failure #3

commit 6548407
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Tue Nov 11 14:33:45 2025 -0700

    Attempt to understand actions failure #2

commit 92de44a
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Tue Nov 11 14:02:05 2025 -0700

    (Hopefully) fix coverage reporting

    Original workflow did not account for app folder nesting

commit e4ab6fa
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Tue Nov 11 13:52:37 2025 -0700

    Attempt to understand action failure

    KoverReport failed because path to report.xml was invalid. Hopefully this commit will allow me to see the correct path so I can change the action

commit 3249be4
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Tue Nov 11 13:34:19 2025 -0700

    PLEASE REVIEW: Minor changes to address lint build failures

    - Localize "log" to "Registre" in French
    - Add constraints to activity crash screen textview

commit 0460d94
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Tue Nov 11 13:31:38 2025 -0700

    Config changes for usable build

    Only significant change is to specify a Java toolchain (17) in the top-level build.gradle.kts file, so it doesn't implicitly use your local version

commit b68612d
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Nov 6 11:25:29 2025 -0700

    First APK build workflow

    Kover report can't function without build

commit 4c790a2
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Nov 6 10:39:17 2025 -0700

    First attempt at coverage report

commit e376ff8
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Oct 30 15:15:22 2025 -0700

    Remove prettier XML plugin

    XML plugin causes errors in Super-Linter action flow. This is a known problem and is unlikely to be resolved

commit d865162
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Oct 30 14:55:32 2025 -0700

    Add commit message input to workflow_dispatch

commit 5611477
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Oct 30 14:35:03 2025 -0700

    Slight fix + test commit

commit 6df090b
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Oct 30 14:07:21 2025 -0700

    Format all XML and README files

commit 537913e
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Oct 30 14:03:04 2025 -0700

    Finish Prettier Config

    Add xml formatting, remove JS test file.
    Tested use of Prettier Kotlin plugin, but it's ill-maintained and errors on many files so will try to use ktlint to handle kotlin formatting

commit a49d744
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Oct 30 13:16:24 2025 -0700

    Test Prettier pre-commit (#10)

commit 909d253
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Oct 30 13:12:55 2025 -0700

    Debug Prettier pre-commit (#9)

commit 3011ce0
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Oct 30 13:07:32 2025 -0700

    Debug Prettier pre-commit (#8)

commit 38db27c
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Oct 30 13:02:52 2025 -0700

    Debug Prettier pre-commit (#7)

commit 7cdabd9
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Oct 30 12:28:50 2025 -0700

    Debug Prettier pre-commit (#6)

commit 8b09517
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Oct 30 12:24:44 2025 -0700

    Debug Prettier pre-commit (#5)

commit bcba2cd
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Oct 30 12:02:20 2025 -0700

    Test Prettier pre-commit (#4)

commit ef08187
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Oct 30 11:58:17 2025 -0700

    Debug Prettier pre-commit (#3)

    Add back lint-staged

commit a45ebec
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Oct 30 11:51:51 2025 -0700

    Debug Prettier pre-commit (#2)

commit e16f9ae
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Oct 30 11:40:42 2025 -0700

    Debug Prettier pre-commit (#1)

    Add back husky install script in package.json

commit 5124610
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Oct 30 11:36:24 2025 -0700

    Test pre-commit Prettier action

    This commit will be effectively rolled back, it's just to test Prettier in action

commit 3737c03
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Oct 30 11:32:23 2025 -0700

    Correct badges

commit e5fa935
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Oct 30 11:22:33 2025 -0700

    Reformat badges

commit 428e122
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Oct 30 11:20:33 2025 -0700

    Add Prettier, Super-Linter badges

commit 5f96903
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Oct 30 11:19:05 2025 -0700

    Implement pre-commit formatting with Prettier

commit 3aa1690
Author: Thalia Wood <42354895+polygeist111@users.noreply.github.com>
Date:   Thu Oct 30 10:55:49 2025 -0700

    Add Actions linting
@polygeist111
Copy link
Copy Markdown
Collaborator Author

polygeist111 commented Mar 30, 2026

I had forgotten my teammate's work hadn't been integrated to main yet either, so this PR will also introduce the unit tests they've written so far, as well as all the KDoc comments. The issues identified by gemini have to do with changes made by the test writing team, so I can discuss with them in the next few days how to resolve.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 30, 2026

Code Coverage

File Coverage [94.39%]
app/src/main/java/com/greybox/projectmesh/messaging/network/MessageNetworkHandler.kt 50.00%
app/src/main/java/com/greybox/projectmesh/messaging/network/MessageService.kt 56.00%
app/src/main/java/com/greybox/projectmesh/messaging/repository/ConversationRepository.kt 97.73%
app/src/main/java/com/greybox/projectmesh/messaging/utils/MessageMigrationUtils.kt 90.00%
app/src/main/java/com/greybox/projectmesh/testing/TestDeviceService.kt 4.76%
app/src/main/java/com/greybox/projectmesh/user/UserRepository.kt 100.00%
app/src/main/java/com/greybox/projectmesh/viewModel/SelectDestNodeScreenViewModel.kt 68.18%
app/src/test/java/com/greybox/projectmesh/DeviceStatusManagerTest.kt 100.00%
app/src/test/java/com/greybox/projectmesh/debug/CrashHandlerTest.kt 96.00%
app/src/test/java/com/greybox/projectmesh/extension/ContentResolverExtensionTest.kt 100.00%
app/src/test/java/com/greybox/projectmesh/messaging/data/dao/ConversationDaoTest.kt 100.00%
app/src/test/java/com/greybox/projectmesh/messaging/data/dao/MessageDaoTest.kt 100.00%
app/src/test/java/com/greybox/projectmesh/messaging/network/MessageNetworkHandlerTest.kt 100.00%
app/src/test/java/com/greybox/projectmesh/messaging/network/MessageServiceTest.kt 95.12%
app/src/test/java/com/greybox/projectmesh/messaging/repository/ConversationRepositoryTest.kt 100.00%
app/src/test/java/com/greybox/projectmesh/messaging/repository/MessageRepositoryTest.kt 100.00%
app/src/test/java/com/greybox/projectmesh/messaging/utils/MessageMigrationUtilsTest.kt 100.00%
app/src/test/java/com/greybox/projectmesh/user/UserDaoTest.kt 100.00%
app/src/test/java/com/greybox/projectmesh/user/UserRepositoryTest.kt 100.00%
app/src/test/java/com/greybox/projectmesh/viewModel/HomeScreenViewModelTest.kt 98.63%
app/src/test/java/com/greybox/projectmesh/viewModel/LogScreenViewModelTest.kt 100.00%
app/src/test/java/com/greybox/projectmesh/viewModel/NetworkScreenViewModelTest.kt 100.00%
app/src/test/java/com/greybox/projectmesh/viewModel/OnboardingViewModelTest.kt 100.00%
app/src/test/java/com/greybox/projectmesh/viewModel/PingScreenViewModelTest.kt 100.00%
app/src/test/java/com/greybox/projectmesh/viewModel/ReceiveScreenViewModelTest.kt 100.00%
app/src/test/java/com/greybox/projectmesh/viewModel/SelectDestNodeScreenViewModelTest.kt 100.00%
app/src/test/java/com/greybox/projectmesh/viewModel/SendScreenViewModelTest.kt 100.00%
app/src/test/java/com/greybox/projectmesh/viewModel/SettingsScreenViewModelTest.kt 100.00%
app/src/test/java/com/greybox/projectmesh/viewModel/SharedUriViewModelTest.kt 100.00%
app/src/test/java/com/greybox/projectmesh/views/LogScreenUILogicTest.kt 100.00%
app/src/test/java/com/greybox/projectmesh/views/NetworkScreenUiLogic.kt 96.47%
app/src/test/java/com/greybox/projectmesh/views/OnboardingUiLogic.kt 100.00%
app/src/test/java/com/greybox/projectmesh/views/PingScreenUiLogic.kt 98.15%
app/src/test/java/com/greybox/projectmesh/views/SelectDestNodeScreenUiLogic.kt 100.00%
Total Project Coverage 17.86%

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request significantly improves the project's robustness by introducing an extensive suite of unit tests for core components, including repositories, viewmodels, and utility classes. It also standardizes the codebase with KDoc documentation and integrates Kover and Dokka for coverage and documentation generation. Feedback identifies critical issues in FileEncoder.kt regarding potential OutOfMemoryError when reading large files and failures due to URL length limits when transmitting file content as query parameters. Additionally, the review points out redundant dependencies in build.gradle.kts, potential resource leaks due to unclosed streams, and risks associated with direct serialization of Throwable objects in the CrashHandler.

val fp = encodebase64(appctxt, imageURI) //encodes file to base64
if(!fp.equals("Cannot encode file")) {
val efp = URLEncoder.encode(fp, "UTF-8") //ensures that the file URI is utf-8 encoded
val connection =
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-critical critical

The entire Base64-encoded file content is being passed as a query parameter in the URL. Most HTTP servers and Android's HttpURLConnection have strict limits on URL length (typically between 2KB and 8KB). This approach will fail for all but the smallest files. Additionally, sensitive or large data should always be sent in the request body, not the URL.

try {
fun encodebase64(ctxt: Context, inputuri: Uri): String? {
return try {
val encodedstrm: InputStream? = ctxt.contentResolver.openInputStream(inputuri)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using readBytes() on an InputStream without a size limit reads the entire content into memory. This will cause an OutOfMemoryError if the file being encoded is large. For a mesh network application where files might be shared, it is better to process the stream in chunks or use a more memory-efficient encoding approach.

// ===============================
// Unit testing (JVM) deps added
// ===============================
testImplementation("junit:junit:4.13.2")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The dependency junit:junit:4.13.2 is being added explicitly here, but it is already included via libs.junit on line 90. This is redundant and can lead to dependency resolution issues.

    testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.8.1")

*/
private fun launchActivity(applicationContext: Context, activity: Class<*>, exception: Throwable) {
val crashIntent = Intent(applicationContext, activity).also {
it.putExtra("CrashData", Gson().toJson(exception))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Serializing a Throwable object directly using Gson is generally discouraged. Throwable objects often contain circular references (e.g., through the cause field or suppressed exceptions) and platform-specific internal fields that can cause StackOverflowError or JsonIOException during serialization. It is safer to extract and serialize only the necessary information, such as the message and stack trace.

Comment on lines +133 to +141
val instream = appctxt.contentResolver.openInputStream(imageURI)
val outstream = connection.outputStream
val readingbuffer = ByteArray(1024)
var finishedreading: Int
while (instream?.read(readingbuffer).also { finishedreading = it!! } != -1) {
outstream.write(readingbuffer, 0, finishedreading)
}
outstream.close()
instream?.close()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The InputStream and OutputStream are not being closed reliably. If an exception occurs during the while loop (line 138), the close() calls at lines 140 and 141 will be skipped, leading to a resource leak. Use the .use { ... } extension function or a finally block to ensure resources are always released.

Test to see if the absence of them in a logged commit impacts the CI functionality, or if they can (preferably) remain ephemeral
Change hardcoded text for string property text in activity main and crash layouts.
Changes main string to app_name, and crash screen to new text_view string.

NOTE: text_view exists in all localization string files but is not localized, as it is a proper name of a feature and I am unsure GB's preference for translating it.
Converts all hardcoded versions in app/build.gradle.kts to instead use the preferred gralde/libs.versions.toml management option. Additionally, removes duplicate entries, and applies initial alphabetical and purpose sorts to dependency order.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant