#3081 Flaky test: WalSink replayed segments are delivered before events written after replay leaves one WAL segment
Opened by hammz · 10/6/2026· Shipped 10/6/2026
Summary
The unit test 'WalSink: replayed segments are delivered before events written after replay' in src/serve/audit_sinks/wal_sink_test.ts (line 242) fails intermittently. It asserts wal.segmentCount is 0 after replay, write and flush with checkpointIntervalMs 0, and sometimes observes 1.
Evidence
- Failed in a full verify-build run (run-tests step) on a branch that does not touch src/serve/audit_sinks: AssertionError, actual 1, expected 0, at wal_sink_test.ts:261.
- Fails at main commit d9670e54 in 3 of 3 isolated runs of the file alongside one integration test, and at 5ba0b8fc in 2 of 5 runs when run in parallel with four other test files. Passed 6 of 6 at 5ba0b8fc when run with only one other file, so it looks load or timing dependent.
- Command: deno run test src/serve/audit_sinks/wal_sink_test.ts integration/scheduled_execution_managed_config_test.ts src/libswamp/workflows/edit_test.ts (repeat a few times).
Likely area
The test was added or changed by the WAL replay fixes for swamp-club 3054 and 3052 (PRs 2856 and 2854). The downstream delivery order assertion passes; only the segment count after flush is wrong, which suggests flush returns before the delivered segment is deleted.
Impact
Blocks local verification (verify-build) for unrelated changes until a rerun happens to pass. Found while verifying swamp-club 2946.
Shipped
Click a lifecycle step above to view its details.