fix(luggage): serialize shim-writing idempotency tests to close fork/exec race - #459
Merged
Merged
Conversation
…exec race The four `installer::idempotency` tests that write a shell shim and then `Command::output()` it intermittently failed under parallel `cargo test` due to the well-known fork+ETXTBSY race (rust-lang/rust#100904): one thread's in-flight write FD raises the inode's i_writecount while another thread forks for execve, and the child gets ETXTBSY. Add `serial_test` as a dev-dependency and mark the three shim-writing tests (`matching_version_returns_true`, `nonmatching_version_returns_false`, `rust_tool_id_resolves_to_rustc_binary`) with `#[serial_test::serial]` so their write+exec windows cannot overlap. Verified by running `cargo test -p luggage --lib installer::idempotency` 25x consecutively — all green. Full `cargo test -p luggage` and `cargo clippy -p luggage --tests -- -D warnings` also clean. The two tests that don't write a shim (`missing_binary_returns_false`, `primary_binary_defaults_to_tool_id`) are left parallel — they don't participate in the race. Closes #456 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 tasks
4 tasks
joshjhall
added a commit
that referenced
this pull request
May 17, 2026
…c race (#481) The three `installer::validate` tests that write a shell shim and then `Command::output()` it intermittently fail under parallel `cargo test` due to the same fork+ETXTBSY race (rust-lang/rust#100904) that #459 fixed for `installer::idempotency`: one thread's in-flight write FD raises the inode's i_writecount while another thread forks for execve, and the child gets ETXTBSY. Validate's tests use the identical `write_shim` pattern but were never serialized. Observed in CI run 25982111224 on the merge-to-main of #479, where `mismatched_output_returns_validation_failed` failed with `assertion failed: message.contains("1.95.0")` — the shim's exec returned an ETXTBSY error message that, naturally, doesn't contain the target version string. Ubuntu's faster fork/exec exposes the race more reliably than macOS / Windows. Mark all three shim-writing tests (`matching_output_passes`, `mismatched_output_returns_validation_failed`, `propagates_env_to_subprocess`) with `#[serial_test::serial]`. The crate's `serial_test` dev-dependency was already added in #459. Verified by running `cargo test -p luggage --lib installer::validate` 25x consecutively — all green. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
serial_test = \"3\"tocrates/luggage[dev-dependencies].crates/luggage/src/installer/idempotency.rs(matching_version_returns_true,nonmatching_version_returns_false,rust_tool_id_resolves_to_rustc_binary) with#[serial_test::serial].cargo testfork/exec race (rust-lang/rust#100904) where an in-flightfs::writeFD raised the inode'si_writecountwhile another threadfork()+execve()'d a shim — child gotETXTBSY. CI run 25649484773 caught one variant onmainpost-feat(containers-common): broaden Zed extensions on dev_tools and docker #453.The two tests that don't write a shim (
missing_binary_returns_false,primary_binary_defaults_to_tool_id) are left parallel — they don't participate in the race. Production code (already_installed,primary_binary) is unchanged.Test plan
cargo test -p luggage --lib installer::idempotency— 25 consecutive iterations, all greencargo test -p luggage— full crate suite green (lib + integration + doc)cargo clippy -p luggage --tests -- -D warnings— cleanRust Tests (stibbons) — ubuntu-latestgreen on this PRmainruns green to confirmCloses #456
🤖 Generated with Claude Code