Relationships
↔ sibling #4711#4712 Flaky: SqliteReadModel.recover tests depend on wall-clock timing and fail under load
Opened by stack72 · 11/13/2026· Shipped 11/13/2026
Two tests in src/infrastructure/datastore_v3/sqlite_read_model_test.ts (added by swamp-club#4677, commit 3fc69ff93) failed in a verify-build run on a heavily loaded machine (load average 15 to 17), on a branch that does not touch the datastore (swamp-club#4707, commit 436a425d8):
- 'SqliteReadModel.recover: a recovery asked to be targeted runs in full and says why: dirty_tracking_recent (4, swamp-club#4581)' FAILED (5s)
- 'SqliteReadModel.recover: an interrupted writer after a long history over many models recovers one dirty name without the compacted base, the catalog clear or any other partition (swamp-club#4581)' FAILED (55s)
History: each passed in 52 of 53 recorded local verify-build runs; this run is the only failure. The same file passes alone on the same commit (115 passed, 2m07s).
Likely cause for the first: the case arranges since = Date.now() and expects reason dirty_tracking_recent, which #targetedFallback in sqlite_read_model.ts returns only when dirtyTrackingSince() >= since - DIRTY_TRACKING_MARGIN_MS (2000 ms). When setup between the start of dirty tracking and Date.now() takes longer than 2 s under load, the reason changes and the assertion fails. That is a wall-clock dependency, which AGENTS.md rules out for tests. The second test runs 55 s in the same recovery path and likely has a similar timing assumption; its assertion message was lost because the shard was killed at the run-tests 15-minute limit before printing its failure summary.
Suggested fix: inject the clock (or the tracking start) so the case controls trackedSince relative to since, instead of reading Date.now() after a setup of unbounded length.
Shipped
Click a lifecycle step above to view its details.
Sign in to post a ripple.