Wave 2: data layer (C) + metadata/scanning (D)
Room entities/DAOs/DB, PocketBase Retrofit client + auth interceptor, SyncEngine (push-then-pull, LWW, tombstones, client-generated ids), SettingsStore, AppContainer. Open Library + Google Books merge, ISBN validation, CameraX + ML Kit scanner plumbing. Verified by orchestrator: assembleDebug exit 0; testDebugUnitTest exit 0, 68 tests, 0 failures, 0 errors. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016bThmkmyUUdqQpy3MXFFe5
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
Your wave-2 work is mostly good and `assembleDebug` passes. But you ended your turn
|
||||
reporting that `testDebugUnitTest` was "running in background, will report once it
|
||||
completes" — you never confirmed it. The orchestrator ran it. IT FAILS.
|
||||
|
||||
68 tests ran, 2 failed, both yours, both in
|
||||
`app/app/src/test/java/org/modg/bookshelf/ui/scan/ScannerControllerTest.kt`:
|
||||
|
||||
ScannerControllerTest > "valid barcode emits on scanResults"
|
||||
ScannerControllerTest > "invalid barcode does not reach scanResults"
|
||||
both: kotlinx.coroutines.test.UncompletedCoroutinesError:
|
||||
After waiting for 1m, the test body did not run to completion
|
||||
|
||||
Diagnosis (confirm it yourself before acting): `ScannerController._scanResults` is a
|
||||
`MutableSharedFlow<String>(extraBufferCapacity = 1)` with NO `replay`. Both tests call
|
||||
`onBarcodeScanned(...)` BEFORE anything subscribes, so with replay=0 the emission goes
|
||||
nowhere, and the later `scanResults.first()` suspends forever until runTest's timeout.
|
||||
|
||||
Fix the TEST, not the production semantics, unless you have a concrete reason to do
|
||||
otherwise. replay=0 is correct for a barcode scanner — a newly-attached collector must
|
||||
not receive a stale scan from earlier. So make the test subscribe BEFORE emitting, e.g.
|
||||
start the collector with `async`/`backgroundScope`, use `runCurrent()` to let it
|
||||
subscribe, then call `onBarcodeScanned(...)`. Keep both tests' original intent intact:
|
||||
the second one must still prove the invalid barcode is filtered out and only the valid
|
||||
ISBN arrives. Do not weaken a test into an assertion-free or trivially-true test, and
|
||||
do not delete a test to make the suite green.
|
||||
|
||||
Then VERIFY, and this time actually wait for the result before you answer:
|
||||
~/bookshelf/tasks/gw testDebugUnitTest
|
||||
(use that wrapper, never ./gradlew directly). It must exit 0 with 0 failures.
|
||||
|
||||
Reply with: the command's real exit code, the failure count, and one line on what you
|
||||
changed. Nothing else.
|
||||
Reference in New Issue
Block a user