Repository navigation
test(sessions): build the rollback-journal fixture without setup syncs - #1578
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
Brings in #1578, which builds the rollback-journal fixture without setup syncs and fixes the Fast checks timeout seen on this branch. Co-Authored-By: Claude Opus 5.5 <[email protected]>
## Change Makes five tests that failed on CI pass reliably. All five failures were in the tests' own setup, not in product code; no product code changes. No timeout, retry, fixed sleep or weakened assertion was added. - **omo multiline paste** (`server/core/omo-pane-send.test.ts`, failed on main 10-22 05:29Z and 08:15Z: expected bracketed paste, received bare `a\nb`). - Cause: the fixture shell printed "ready" and then `exec`'d `sleep`. During that exec, Linux can briefly show an empty `/proc/<pid>/environ`, so the composer missed `OMO_CODING_AGENT_DIR` and the holder record. - Fix: the ready shell now stays blocked on stdin, and cleanup waits for it to exit. - Under load: 7 failures in 500 runs before, 0 in 500 after. - **Heavy paging tests** (`opencode.test.ts` 1.x and long-session paging and /undo, `conversation.test.ts` Devin cache and Agy ledger; 60 s timeouts at 65-108 s on CI). - Cause: the SQLite fixtures synced every row to disk. Devin alone spent 11.2 s in 496 `fsync` calls. - Fix: the throwaway fixture writers set `PRAGMA synchronous = OFF`; committed visibility, locking, data volume and assertions are unchanged. This follows #1578. - Per test, alone: 5-20 s before, under 0.2 s after. - With eight heavy files at once: 1,506 pass, 0 fail. - **OpenCode v2 contract tests** (`opencode.contract.test.ts`: `@effect` queued while the pane works, failed 3 times, once on main; first key never waits on the event stream). - Cause: the pending receipt confirmed the PTY write before the stand-in had read Enter, and cases moved on before the previous send was consumed. - Fix: each case waits for the stand-in's byte reports to confirm consumption, and matches reports by their offset in the shared log. - Results: 1 failure in 5 runs before, 0 in 13 after. The whole file run 3 times: 60 pass. Also checked: the Portal "unrelated process" failures on main (10-22 06:17Z and 06:33Z) predate #1638, which fixed them. That fixture fails 3 times in 500 runs without #1638's change and never with it. ## Validation - `bun run check fast`: passes. - The changed files on this branch: unit 170 pass, contract 20 pass. Test-only changes; no changelog fragment.
Change
Reduce the setup cost of
never reads a crashed writer's uncommitted change from a rollback-journal storeinserver/session-history.test.ts.The existing setup already used one transaction, but enabled a one-page cache before inserting 2,000 padded rows. That made setup spill pages to disk unnecessarily. Build the existing Hermes SQL fixture and eight padded rows in one transaction with the normal cache and
synchronous=OFF. Restoresynchronous=FULL, then enable the one-page cache and cache spilling for the uncommitted transaction under test. The smaller dataset still spills the changed user-message page, as demonstrated by the mutation test below.The real SQLite DELETE journal, uncommitted updates, copied database and hot journal, and original assertions are unchanged. Disk syncs are disabled only for committed setup writes, not the crash scenario. No fixed sleeps, timeout increases, production changes, or changelog fragment.
Validation
Measured on the same loaded Linux PC with Bun 1.4.3, based on main
90b66e85:The baseline measurement used
--timeout 120000solely to obtain a completed timing (16.90 s command wall time). An intermediate 32-row version passed alone but took 10.39 s under heavier disk load in a full-file run, so it was not sufficient. The final revision also removes all committed setup syncs and reduces the padding to eight rows.Regression proof: temporarily changed
openDatabaseinserver/session-history.tsfrommayBeImmutable && wal && !loggedtomayBeImmutable && !logged, making rollback-journal databases open immutable and ignore recovery. The optimized test failed its original assertion:Restored the production guard immediately afterward; the final diff changes only the test.
HERDR_TEST_MODE=unit bun test ./server/session-history.test.ts: 69 passed, 0 failed; 65.71 s (65.77 s wall). The rollback-journal test passed in 639.50 ms with the default timeout, about 26 times faster than baseline.bun test ./scripts/conventions.test.ts ./server/conventions.test.ts: 19 passed, 0 failed; 4.46 s (4.52 s wall).git diff --check: clean.The earlier full-file run of the intermediate 32-row revision also timed out five unchanged SQLite tests during heavier disk contention. None of those tests were edited; the final full-file run above passed all 69 tests.