This note tracks the P0+P1 coverage hardening wave on top of origin/main.
The new file-level gates are implemented by scripts/coverage-file-gate.mts and root scripts:
bun run coverage:gate:p0bun run coverage:gate:p1
| File | Statements | Branches | Status |
|---|---|---|---|
packages/common/src/local-first/Sync.ts |
96.83% | 90.83% | ✅ |
packages/common/src/local-first/Db.ts |
99.47% | 91.66% | ✅ |
packages/common/src/local-first/Worker.ts |
95.23% | 100.00% | ✅ |
packages/web/src/local-first/DbWorker.ts |
98.91% | 93.47% | ✅ |
| File | Target | Current | Status |
|---|---|---|---|
packages/common/src/local-first/LocalAuth.ts |
>=75 / >=60 |
100.00 / 94.11 |
✅ |
packages/web/src/local-first/LocalAuth.ts |
>=75 / >=60 |
100.00 / 92.30 |
✅ |
packages/nodejs/src/Worker.ts |
>=90 / >=85 |
100.00 / 100.00 |
✅ |
packages/nodejs/src/Sqlite.ts |
>=90 / >=85 |
100.00 / 93.75 |
✅ |
Coverage gate status:
bun run coverage:gate:p0✅bun run coverage:gate:p1✅
- Adapter/wrapper coverage:
packages/web/test/Evolu.test.tspackages/web/test/Worker.test.tspackages/react-web/test/local-first/Evolu.test.tspackages/nodejs/test/WebPlatform.test.ts
- Common helper/runtime branch coverage:
packages/common/test/local-first/Kysely.test.tspackages/common/test/local-first/Schema.test.ts(index add/drop,createQueryBuilderoptions,getEvoluSqliteSchema)packages/common/test/Error.test.ts(handleGlobalErrorbranches)packages/common/test/String.test.ts(new file)packages/common/test/local-first/LocalAuth.test.ts(mnemonic path, missing account, username fallback, unregister without fallback owner)packages/web/test/LocalAuth.test.ts(credential throw/missing userHandle/legacy metadata/create-null branches)packages/common/test/local-first/Relay.test.ts(zero-byte write path and mutex-abort propagation)
- Small runtime hardening:
packages/common/src/String.tsnow guaranteesstringreturn even whenJSON.stringifyreturnsundefined(symbolcase).
packages/nodejs/test/Relay.test.ts- Added deterministic websocket scenarios for
subscribe -> broadcast -> unsubscribe. - Added restart scenario with existing relay DB file.
- Added deterministic websocket scenarios for
packages/web/test/DbWorker.test.ts- Added failure-race coverage where follower waits on failing shared
initPromiseand later recovery succeeds.
- Added failure-race coverage where follower waits on failing shared
packages/web/src/local-first/DbWorker.ts- Added optional test hook
createDriverintorunWebDbWorkerPortWithOptionsfor deterministic init-failure injection (runtime default unchanged).
- Added optional test hook
packages/nodejs/src/local-first/Relay.ts- Fixed WS message handling lifecycle to use daemon runner deps (
_run.daemon.addDeps(...)) so callbacks are not aborted afterstartRelayreturns. - Kept runtime payload path simple and Bun/Node compatible (
Buffer.from(...)for outbound binary sends).
- Fixed WS message handling lifecycle to use daemon runner deps (
Prioritized by risk + effort for next PR slices:
packages/web/src/Sqlite.ts(82.92% / 76.92%, missing3/13branches)- Remaining branches are OPFS init paths in main thread (
encrypted/default) and warning fallback; deterministic coverage likely needs injectable sqlite-wasm facade.
- Remaining branches are OPFS init paths in main thread (
packages/common/src/local-first/Protocol.ts(92.93% / 88.83%, missing24/215)- Slightly below 90 branch; higher complexity than the three items above.
packages/common/src/Console.ts(84.21% / 84.00%, missing8/50)- Moderate complexity; mostly branch-focused unit tests.
packages/common/src/local-first/Relay.ts(96.00% / 85.00%, missing3/20)
- Small remaining branch gap after latest write-path additions.
packages/nodejs/src/local-first/Relay.ts(97.77% / 81.25%, missing3/16)
- Remaining branch gap is now isolated in guarded branches around owner auth and ws event variants; can be closed with focused adapter tests.
packages/common/src/Type.ts(73.50% / 68.32%, missing121/382)
- Big-impact but not a quick win; needs dedicated focused campaign.
308958f4fix(nodejs): use daemon runner for relay ws message handlinge61403e8test(web): cover shared initPromise failure cleanup5e8ac520test(nodejs): cover relay subscribe and restart paths67f34c74test(relay): cover zero-byte and mutex-abort write paths69e3811dtest(local-auth): expand common and web edge-case coverage4ddb510cdocs(ai): refresh coverage progress snapshot and quick-win backlog71ce2289fix(common): guarantee string fallback in safelyStringifyUnknownValuec18a4777test(common): expand schema and error branch coverage6653d541test(common): fix Kysely test import ordering for Biome