Repository navigation
test(session): fix drip-writer PID parse race (musl unit-test flake) - #1220
Merged
Merged
Conversation
The drip writer inherits the holder's stdout and writes '.' as soon as it is spawned, sometimes before the holder prints GRANDCHILD_PID=<pid>. The transcript then reads '.GRANDCHILD_PID=123', which the whitespace-word strip_prefix parse rejects. Search for the marker as a substring instead. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the intermittent
musl / unit-testfailure ofasync_api::async_process_session_test::session_post_exit_grace_is_a_cumulative_pipe_read_budgetthat blocks #1217 (zackees/setup-soldr#528).Root cause
It is a race in the test. The Rust caches are not involved.
testbin-session-pipe-holderspawnstestbin-session-drip-writer, which inherits the same stdout pipe. Only after that does the holder printGRANDCHILD_PID=<pid>. The drip writer starts writing.right away, so it sometimes gets a byte into the pipe before the holder'sprintln!. The transcript then reads.GRANDCHILD_PID=123\n..... The test didsplit_whitespace().find_map(|w| w.strip_prefix("GRANDCHILD_PID=")), which never matches.GRANDCHILD_PID=123. The result is theexpect("fixture reports drip-writer pid")panic at line 526, even thoughabandonedwas true.This ordering depends on scheduling, which is why the same commit passes on one runner and fails on another (ae15e7b vs 5acb3ff, e82a4cf vs 49c1af4). The 35 ms grace is not the problem: the PID line is written well before the holder exits.
Evidence
x86_64-unknown-linux-musl200 times: 7 runs started with.GRANDCHILD_PID=...instead ofGRANDCHILD_PID=....Fix
The test now looks for the
GRANDCHILD_PID=marker anywhere in the transcript and parses the digits after it. The timing contract, the grace value and the fixtures are unchanged.RED -> GREEN (x86_64-unknown-linux-musl, single test looped)
async_process_session_test.rs:526Validation
soldr cargo fmt --all -- --check: passsoldr cargo clippy --workspace --all-targets -- -D warnings: pass, also with-p running-process --features async-process --testssoldr cargo build --workspace: passasync_process_session_testmodule: 15/15 passcargo check --tests --features async-processforx86_64-pc-windows-msvcandaarch64-apple-darwin: passbash ./lint: pass🤖 Generated with Claude Code