Skip to content

test(pipeline): tolerate broken pipes from early child exits - #3832

Merged
KuSh merged 2 commits into
rtk-ai:developfrom
Hubujiu:fix/test-pipeline-broken-pipe
Oct 2, 2026
Merged

KuSh merged 2 commits into
rtk-ai:developfrom
Hubujiu:fix/test-pipeline-broken-pipe

Conversation

@Hubujiu

@Hubujiu Hubujiu commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

The stdin test helper can race with a child that rejects its arguments and exits before reading stdin. Allow only BrokenPipe from write_all, then collect the child's output and exit status. Other write errors still fail the test.

Add a deterministic regression: a child closes stdin and exits with status 7, while the parent writes more than a pipe buffer. The test checks that the helper returns the child's stdout and status rather than panicking.

Fixes #3739.

Test plan

  • cargo fmt --all --check
  • cargo clippy --all-targets
  • cargo test --all on Windows, Rust 1.98.0 (MSVC).
  • All three stdin tests executed in a standalone harness on Windows with Git for Windows sh/wc; the early-exit regression fails with the original helper (BrokenPipe) and passes with the fix.

The integration file is cfg(unix), so ordinary Windows Cargo tests skip it. The standalone check removed that gate only in a temporary copy; the committed file keeps its platform boundary. Native Linux/macOS execution remains for CI.

Hubujiu and others added 2 commits September 2, 2026 20:57
The child's exit already closes the pipe's read end, so the 8 MiB write
fails with BrokenPipe with or without `exec 0<&-`. Keep only what drives
the result.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

@KuSh KuSh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Round 1 of 3 — APPROVED

Claim: run_with_stdin tolerates BrokenPipe from a child that exits before reading stdin, and a new test pins it (fixes #3739).
Scope: accept.
Ran: wc_preserves_native_failure_exit_code × 2000 per side. Idle: 0 failures on both sides. Under 48 CPU burners, develop fails 929/2000 with BrokenPipe and this PR fails 0/2000. The new test fails 500/500 against the original helper and passes 500/500 on the PR.
Matrix: executed this round.
CI @dddf245b4: all green (10/10).

Blocks merge (0)

Optional

  • The redundant exec 0<&- in the early-exit child is removed in dddf245. The test passed 500/500 without it, because the child's exit already closes the pipe.

Checked and correct

  • Clean merge into current develop; fmt, clippy and pipeline_stdin_test green.
  • Errors other than BrokenPipe still fail the helper.

Next

fixup dddf245 pushed, code-reviewed: it removes the redundant exec 0<&- — approving.

Rounds: 1/3. Threads: 0 open.

@KuSh
KuSh merged commit 083a9c5 into rtk-ai:develop Oct 2, 2026
19 of 20 checks passed
@rtk-release-bot rtk-release-bot Bot mentioned this pull request Oct 2, 2026
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.

wc_preserves_native_failure_exit_code is racy, EPIPE when the child exits before the write

2 participants