Skip to content

test(realfs): size the FIFO pipeline deadline as a deadlock watchdog - #3075

Merged
chaliy merged 1 commit into
mainfrom
eve/clever-mccarthy-dtjmmh
Dec 4, 2026
Merged

chaliy merged 1 commit into
mainfrom
eve/clever-mccarthy-dtjmmh

Conversation

@chaliy

@chaliy chaliy commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

What changed

async_runtime_regression's wait for the FIFO pipeline moves from an inline
Duration::from_millis(500) to a named PIPELINE_DEADLINE of 60 s, and the
constant carries the measurement and the reasoning. Test-only; no production
code and no change to what either test asserts.

Why

This deadline turned Coverage red on #3071 — a Dependabot bump that touched
one npm lockfile and no Rust at all:

thread 'async_runtime_regression::realfs_pipeline_completes_on_multi_thread_runtime'
panicked at crates/bashkit/tests/realfs_tests.rs:585:17:
RealFs blocked the Tokio runtime during async pipeline execution

The pipeline costs 54–58 ms natively (5 runs, measured by timing the
recv_timeout directly), almost all of it DelayedFifoWriter's deliberate
50 ms sleep. 500 ms was ~9x that, and cargo tarpaulin is more than 9x slower
than 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 RealFs does not finish late — it does
not finish: the spawned waker task never gets polled, so the touch on the FIFO
waits 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 a
short deadline") — the same doctrine, applied to a deadline whose job is
liveness. That section now records the case.

Before / After

  • Deadline margin — 500 ms against a 54–58 ms pipeline (~9x, loses to
    tarpaulin) → 60 s (~1000x).
  • Happy path cost — unchanged. The deadline is never reached when the
    pipeline completes: cargo test -p bashkit --features realfs --test realfs_tests is 52/52 in 0.25 s, same as before.
  • A real block — still caught, by the identical assertion and the identical
    rescue path; it reports after 60 s instead of 500 ms.

Risk

  • Low
  • A genuinely deadlocked runtime now takes 60 s to report instead of 500 ms.
    That is the whole cost, and it is only paid on a failure.
  • Nothing else reads the constant, and both RuntimeKind variants go through
    it.

Checklist

  • Tests added or updated — this is the test change; both existing
    assertions are preserved
  • Backward compatibility considered

Generated by Claude Code


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

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.
@bashkit-pr-reviewer

Copy link
Copy Markdown

Review verdict: approve — test-only deadlock-watchdog fix, no issues

This PR sizes the async_runtime_regression FIFO pipeline wait as a deadlock watchdog: Duration::from_millis(500) → named PIPELINE_DEADLINE = 60s in crates/bashkit/tests/realfs_tests.rs, with the measurement (~54-58ms, mostly the deliberate 50ms sleep) and the tarpaulin/#3071 reasoning recorded on the constant and in knowledge/operations/testing.md, plus a knowledge/log.md entry. That matches the project's rule (decision as comment + knowledge updated in the same change).

Findings by severity: none. No production code, no sandbox-boundary, VFS, parsing, or limit change; the recv_timeout rescue/unwedge path is unchanged, only the duration. The deliberate tradeoff — a genuine block now takes up to 60s per test to report — is the documented intent of a liveness deadline (a blocked RealFs waits forever, so longer only delays an unchanged verdict) and is consistent with the ~1000x-native sizing already used for the tenant-stress budgets.

Context read beyond the diff: realfs_tests.rs run_fifo_pipeline (both RuntimeKind legs, rescue-writer join/panic path), AGENTS.md, and knowledge/operations/testing.md resource-cap/deadlock section. Full diff reviewed (truncated: false, 3 files); no build/test run per reviewer sandbox (reasoned from code).

@chaliy
chaliy merged commit bb359fc into main Dec 4, 2026
87 checks passed
@chaliy
chaliy deleted the eve/clever-mccarthy-dtjmmh branch December 4, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant