Repository navigation
test(realfs): size the FIFO pipeline deadline as a deadlock watchdog - #3075
Conversation
async_runtime_regression waited 500 ms for a pipeline that costs 54-58 ms natively, almost all of it DelayedFifoWriter's deliberate 50 ms sleep. That ~9x margin lost the race under cargo tarpaulin and turned Coverage red on #3071, a Dependabot bump that touched one npm lockfile and no Rust at all: "RealFs blocked the Tokio runtime during async pipeline execution". The number was wrong in kind, not only in size. What this deadline detects is a deadlock, not slowness: a blocked RealFs leaves the spawned waker task unpolled, so the touch on the FIFO waits forever, which is why the rescue writer exists to unwedge it. Waiting longer only delays a verdict it cannot change, so a tight number buys nothing but a race with the machine. PIPELINE_DEADLINE is now 60 s, ~1000x the native cost and past any instrumentation this repo runs, and a genuine block still reports inside the minute. The constant carries the measurement and the reasoning, so the next reader has no cause to re-tighten it. knowledge/operations/testing.md records the liveness-deadline case alongside the cap-versus-clock rule it inverts.
Review verdict: approve — test-only deadlock-watchdog fix, no issuesThis PR sizes the Findings by severity: none. No production code, no sandbox-boundary, VFS, parsing, or limit change; the Context read beyond the diff: |
What changed
async_runtime_regression's wait for the FIFO pipeline moves from an inlineDuration::from_millis(500)to a namedPIPELINE_DEADLINEof 60 s, and theconstant carries the measurement and the reasoning. Test-only; no production
code and no change to what either test asserts.
Why
This deadline turned
Coveragered on #3071 — a Dependabot bump that touchedone npm lockfile and no Rust at all:
The pipeline costs 54–58 ms natively (5 runs, measured by timing the
recv_timeoutdirectly), almost all of itDelayedFifoWriter's deliberate50 ms sleep. 500 ms was ~9x that, and
cargo tarpaulinis more than 9x slowerthan an uninstrumented run, so the test reported a blocked runtime where the
runtime was merely instrumented.
The number was wrong in kind, not only in size. What this deadline detects is
a deadlock, not slowness. A blocked
RealFsdoes not finish late — it doesnot finish: the spawned waker task never gets polled, so the
touchon the FIFOwaits forever, which is exactly why the rescue writer below it exists to unwedge
the thread. So waiting longer cannot change the verdict, and a tight number buys
nothing except a race with the machine. 60 s is ~1000x the native cost, past any
instrumentation this repo runs, and a genuine block still reports inside the
minute.
This is the inverse of the cap-versus-clock rule in
knowledge/operations/testing.md("only a test that asserts a timeout sets ashort deadline") — the same doctrine, applied to a deadline whose job is
liveness. That section now records the case.
Before / After
tarpaulin) → 60 s (~1000x).
pipeline completes:
cargo test -p bashkit --features realfs --test realfs_testsis 52/52 in 0.25 s, same as before.rescue path; it reports after 60 s instead of 500 ms.
Risk
That is the whole cost, and it is only paid on a failure.
RuntimeKindvariants go throughit.
Checklist
assertions are preserved
Generated by Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.