carlos / platform Public

Flake: TestDrainReleaseSnapshotEarlyRefusalReleasesTheWAL waits only 2 s for the WAL fd open

Failed once on main CI at 63706d9c (internal/lease, 2.01 s): app.db-wal is still open after the release: the snapshot encoder was not released. The same worker logged a 1.5 s process stall.

Cause: the test (from the move-speed fix, 32a59ad5) polls /proc/self/fd for at most 2 s (release_snapshot_test.go:256). In production the snapshot's encoder goroutine releases the WAL descriptor asynchronously after snapshotWithin closes the pipe; nothing joins it. That is harmless (a read-only descriptor lingering briefly after the release), but a stalled worker can beat a 2 s window. The test asks "is it eventually released", not "within 2 s".

Fix: widen the bound to 30 s (the check still fails on a real leak, where the descriptor never closes). Going in on branch held-floor-capability.

Fixed on main as c208389: the fake now refuses only the drain release's own snapshot (marked context); the store monitor's snapshots are never refused, so litestream's reader leak (#811) can't trigger in this test. CI green; 30 targeted + 3 full-package local runs passed. The drain release frees the WAL in ~1.5 ms. #802 was not the cause.