named-gate child that exits early is misreported as EPIPE (flaky named-gate-diagnostics test) - #603
Rahulstark2 wants to merge 1 commit into
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@khaliqgant Targeted The Linux artifact workflow is failing in the unrelated |
Checking this out in the next few days. Thanks for your contributions! |
Summary
Closes #598
Fix
word_count_boundsdiagnostics incorrectly reportingEPIPEwhen the child process exits non-zero after closing stdin.Problem
When
wcexits before consuming all of its stdin, Node'sspawnSynccan setresult.errortoEPIPEeven though the child process has a valid exit status.Previously,
result.errorwas checked first, so a child that exited with code2could incorrectly produce:This masked the actual child exit status.
Changes
result.signalfirst to preserve signal diagnostics.result.statusbeforeresult.error.result.errorwhen the child has no exit status (status === null).wcexits with code2without reading stdin.EPIPEcondition.Verification
npx vitest run tests/named-gate-diagnostics.test.tsnpm run buildpassednpm run typecheckpassednpm run typecheck:testspassedEPIPE.Expected Behavior
With the fix, a child that exits with code
2is reported as:instead of incorrectly reporting:
Note
Low Risk
Narrow change to error-message ordering for one named gate plus a test; no auth, data, or API surface impact.
Overview
Fixes
word_count_boundsgate diagnostics so awc -wchild that exits with a real status is not mislabeled ascould not run wc -w: EPIPEwhen Node also setsspawnSync’serrorafter stdin is closed early.The lowered gate command now checks signal, then non-null exit status (including nonzero), and only falls back to
result.errorwhenstatus === null. A regression test stubswctoexit 2with large input to reproduce the flaky EPIPE case and expectsexited 2withoutEPIPEin stderr.Reviewed by Cursor Bugbot for commit 48e94b2. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Fixes
word_count_boundsdiagnostics misreportingEPIPEwhen a child process exits non-zero after closing stdin. The fix checkssignalfirst, then the exit status, and only usesspawnSync'serrorwhen the child has no exit status.wc -w exited 2instead ofcould not run wc -w: EPIPE.wcthat exits 2 without reading 100,000 bytes of stdin.Written for commit 48e94b2. Summary will update on new commits.