-
Notifications
You must be signed in to change notification settings - Fork 2
[MS-1309] Suspending removed from functions that return flows #1579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Housekeeping change to align Kotlin coroutine APIs with Flow best practices by removing suspend from functions that return Flow, updating implementations and tests accordingly across infra, feature, and fingerprint scanner modules.
Changes:
- Removed
suspendfrom multiple Flow-returning repository/use-case/controller APIs (e.g., matching, events, scanner OTA). - Refactored implementations to build cold flows via
flow { emitAll(...) }/flowOn(...)rather than suspending up front. - Updated unit tests to use
every/verifyand to collect flows where execution is now collection-driven.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| testing/data-generator/src/test/java/com/simprints/feature/datagenerator/events/InsertSessionEventsUseCaseTest.kt | Updates mocking for non-suspend Flow API (every vs coEvery). |
| infra/sync/src/test/java/com/simprints/infra/sync/usecase/ObserveSyncableCountsUseCaseTest.kt | Updates mocks/verifications for non-suspend Flow-returning repository calls. |
| infra/matching/src/main/java/com/simprints/infra/matching/usecase/MatcherUseCase.kt | Removes suspend from matcher Flow API. |
| infra/matching/src/main/java/com/simprints/infra/matching/usecase/FingerprintMatcherUseCase.kt | Aligns implementation signature with non-suspend Flow API. |
| infra/matching/src/main/java/com/simprints/infra/matching/usecase/FaceMatcherUseCase.kt | Aligns implementation signature with non-suspend Flow API. |
| infra/events/src/test/java/com/simprints/infra/events/event/local/EventLocalDataSourceTest.kt | Collects flows to trigger execution after APIs became cold/non-suspend. |
| infra/events/src/test/java/com/simprints/infra/events/EventRepositoryImplTest.kt | Updates mocking/verifications for non-suspend Flow methods. |
| infra/events/src/main/java/com/simprints/infra/events/event/local/EventLocalDataSource.kt | Refactors Room flow wrapper to non-suspend and uses flow/emitAll/flowOn; makes loadAllEvents() cold. |
| infra/events/src/main/java/com/simprints/infra/events/EventRepositoryImpl.kt | Removes suspend from Flow-returning repository methods. |
| infra/events/src/main/java/com/simprints/infra/events/EventRepository.kt | Updates interface to expose Flow-returning methods as non-suspend. |
| infra/event-sync/src/test/java/com/simprints/infra/eventsync/sync/up/workers/EventUpSyncUploaderWorkerTest.kt | Updates mocking for non-suspend Flow method. |
| fingerprint/infra/scanner/src/test/java/com/simprints/fingerprint/infra/scanner/v2/scanner/ota/un20/Un20OtaControllerTest.kt | Ensures OTA flow is collected; adds early-cancel coverage. |
| fingerprint/infra/scanner/src/test/java/com/simprints/fingerprint/infra/scanner/v2/scanner/ota/stm/StmOtaControllerTest.kt | Adds early-cancel coverage for STM OTA flow. |
| fingerprint/infra/scanner/src/test/java/com/simprints/fingerprint/infra/scanner/v2/scanner/ota/cypress/CypressOtaControllerTest.kt | Adds early-cancel coverage for Cypress OTA flow. |
| fingerprint/infra/scanner/src/test/java/com/simprints/fingerprint/infra/scanner/v2/scanner/ScannerTest.kt | Updates mocks/verifications for non-suspend OTA APIs. |
| fingerprint/infra/scanner/src/test/java/com/simprints/fingerprint/infra/scanner/helpers/Un20OtaHelperTest.kt | Updates mocking for non-suspend Flow API. |
| fingerprint/infra/scanner/src/test/java/com/simprints/fingerprint/infra/scanner/helpers/StmOtaHelperTest.kt | Updates mocking for non-suspend Flow API. |
| fingerprint/infra/scanner/src/test/java/com/simprints/fingerprint/infra/scanner/helpers/CypressOtaHelperTest.kt | Updates mocking for non-suspend Flow API. |
| fingerprint/infra/scanner/src/main/java/com/simprints/fingerprint/infra/scanner/v2/scanner/ota/un20/Un20OtaController.kt | Removes suspend from program(); wraps OTA into a cold flow. |
| fingerprint/infra/scanner/src/main/java/com/simprints/fingerprint/infra/scanner/v2/scanner/ota/stm/StmOtaController.kt | Removes suspend from program(); wraps OTA into a cold flow. |
| fingerprint/infra/scanner/src/main/java/com/simprints/fingerprint/infra/scanner/v2/scanner/ota/cypress/CypressOtaController.kt | Removes suspend from program(); wraps OTA into a cold flow. |
| fingerprint/infra/scanner/src/main/java/com/simprints/fingerprint/infra/scanner/v2/scanner/Scanner.kt | Removes suspend from OTA-start methods returning Flow. |
| fingerprint/connect/src/main/java/com/simprints/fingerprint/connect/screens/ota/OtaViewModel.kt | Refactors internal OTA step builder to a cold flow. |
| feature/matcher/src/test/java/com/simprints/matcher/screen/MatchViewModelTest.kt | Updates mocks/verifications for non-suspend matcher Flow APIs. |
| feature/external-credential/src/test/java/com/simprints/feature/externalcredential/screens/search/usecase/MatchCandidatesUseCaseTest.kt | Updates mocks for non-suspend matcher Flow APIs. |
...src/main/java/com/simprints/fingerprint/infra/scanner/v2/scanner/ota/stm/StmOtaController.kt
Outdated
Show resolved
Hide resolved
.../java/com/simprints/fingerprint/infra/scanner/v2/scanner/ota/cypress/CypressOtaController.kt
Outdated
Show resolved
Hide resolved
...c/main/java/com/simprints/fingerprint/infra/scanner/v2/scanner/ota/un20/Un20OtaController.kt
Outdated
Show resolved
Hide resolved
In the code to be deprecated and difficult to verify
|



JIRA ticket
Will be released in: 2026.2.0
Notable changes
Additional work checklist