test(sync): cover the cache-lock gate on SyncWorker/SendWorker + the provisioner await #231

Merged
JMR-dev merged 3 commits from test-cache-lock-gate-coverage into main 2026-07-03 16:41:20 +00:00
JMR-dev commented 2026-07-03 16:04:39 +00:00 (Migrated from github.com)

Closes the unit-coverage gap the "same-class crash-state" audit flagged: the EncryptedCacheGuard cache-lock gate on pre-auth DB entry points had zero test coverage (which is how the PruneWorker/BackfillWorker gap in #224 went unnoticed).

Added

  • SyncWorkerTest, SendWorkerTest — locked → retry() with the Lazy DB deps never resolved; unlocked → runs. (PruneWorker/BackfillWorker got the same tests in #229.)
  • DatabaseProvisionerTest — a case proving prepareCache() suspends on an auth-bound resolvePassphrase until it resolves (the precondition the guard exists to keep off a background thread) — the provisioner test previously only exercised the instant-passphrase appLock = false path.

Not here

IdleService shares the same guard but is an Android Service (its start path needs startForeground/Context), so it isn't JVM-unit-testable without Robolectric — its gate coverage is routed to the instrumented ticket #226.

Preflight green (build, unit tests, androidTest compile, lint, ktlint, detekt).

Closes #225

🤖 Generated with Claude Code

Closes the unit-coverage gap the "same-class crash-state" audit flagged: the `EncryptedCacheGuard` cache-lock gate on pre-auth DB entry points had **zero** test coverage (which is how the PruneWorker/BackfillWorker gap in #224 went unnoticed). ## Added - **`SyncWorkerTest`, `SendWorkerTest`** — locked → `retry()` with the `Lazy` DB deps **never resolved**; unlocked → runs. (PruneWorker/BackfillWorker got the same tests in #229.) - **`DatabaseProvisionerTest`** — a case proving `prepareCache()` **suspends** on an auth-bound `resolvePassphrase` until it resolves (the precondition the guard exists to keep off a background thread) — the provisioner test previously only exercised the instant-passphrase `appLock = false` path. ## Not here `IdleService` shares the same guard but is an Android `Service` (its start path needs `startForeground`/Context), so it isn't JVM-unit-testable without Robolectric — its gate coverage is routed to the instrumented ticket #226. Preflight green (build, unit tests, androidTest compile, lint, ktlint, detekt). Closes #225 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.