Skip to content

test(subprocess): assert ordering, not wall-clock, in the starved-pipe test - #352

Open
mtschoen wants to merge 3 commits into
scanaislop:developfrom
mtschoen:fix/starved-pipe-ordering-assertion
Open

test(subprocess): assert ordering, not wall-clock, in the starved-pipe test#352
mtschoen wants to merge 3 commits into
scanaislop:developfrom
mtschoen:fix/starved-pipe-ordering-assertion

Conversation

@mtschoen

Copy link
Copy Markdown
Contributor

Replaces a wall-clock assertion in the starved-pipe backpressure test with an ordering-based one. The old test required the child to finish writing its full 1MiB output within the first 500ms of a fixed 2000ms busy-spin; under CI load that cushion evaporates and the test reddens even though the subject (capturing subprocess output via temp files instead of pipes) is healthy.

The test's actual invariant is that the child finishes its write while the parent is still starved, not that it finishes within some fixed duration. The fix polls existsSync(markerFile) inside the busy loop up to a generous 30s deadline and asserts on that boolean instead of comparing timestamps: a genuinely pipe-blocked child never writes the marker at all, so real regressions still fail, and the loop exits the moment the marker lands so the healthy path stays fast.

Verified: pnpm typecheck clean, pnpm vitest run tests/subprocess.test.ts 14/14 pass.

🤖 Generated with Claude Code

…e test

The starved-pipe test compared clock readings with a fixed cushion: the
child had to finish writing its 1MiB output within the first 500ms of a
2000ms busy-spin. That cushion describes how fast a process spawns on an
idle machine, not a property of the code under test. Under CI load
(concurrent duplicate runs sharing the runner, in this case) the margin
evaporates and the test reddens while the subject stays healthy.

The test's real invariant is ordering, not duration: the child must
finish its whole write while the parent is still starved and draining
nothing. Replace the fixed-duration spin and timestamp comparison with a
poll that spins until the marker file exists (existsSync, generous 30s
deadline) and assert on that boolean. This is load-tolerant, still fails
on a real regression (a genuinely pipe-blocked child never writes the
marker), and is typically faster since it exits as soon as the marker
lands instead of always burning the fixed spin duration.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@scan-ai-slop-aislop

Copy link
Copy Markdown
Contributor

aislop skipped this PR

This workspace does not have an active paid scanaislop plan. Choose a plan to resume hosted scans and PR gates:

Choose a paid plan

This comment appears once per PR. Further pushes will be skipped silently until the workspace has paid access.

… timeout

The internal poll deadline was 30000ms, exactly vitest's global
testTimeout, so a genuine regression (marker never written) would be
killed by the framework as an opaque timeout instead of failing the
ordering assertion. 20000ms leaves real margin for the assertion to
fire.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@scan-ai-slop-aislop

Copy link
Copy Markdown
Contributor

aislop scan: 100/100 (Healthy) +

Clean run — no errors, no warnings, no auto-fixable findings.

View full report

@mtschoen
mtschoen marked this pull request as ready for review August 16, 2026 00:33
Keep the three facts the code cannot show (ordering invariant drives
spin-until-marker, existsSync keeps the loop starved, deadline must stay
under vitest's testTimeout); drop the change-justification prose that
already lives in the PR description.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
mtschoen added a commit to mtschoen/aislop that referenced this pull request Aug 16, 2026
…ion) into schoen/main

# Conflicts:
#	tests/subprocess.test.ts
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