fix(luggage): serialize shim-writing validate tests to close fork/exec race - #481
Merged
Conversation
…c race 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>
joshjhall
added a commit
that referenced
this pull request
May 17, 2026
Bug-fix patch release for the 2026-05-17 auto-patch incident: - fix(luggage) #481: serialize shim-writing validate tests to close fork+ETXTBSY race that broke `cargo test` on Ubuntu after the v4.19.1 merge. - fix(tests) #485: make `tests/changed_features.sh` exit 0 on no-feature-match input (was tripping `set -u` on empty assoc array and silently failing PR-tier `Detect changed features` on every workflow/docs/base-images PR since #467). - fix(ci) #484: skip `upload-sarif` on ephemeral `auto-patch/**` refs to prevent `ref not found` errors after the auto-merge branch cleanup. - fix(ci) #483: move the auto-patch compatibility-matrix update from the pre-merge `auto-merge` job to the `post-merge` job so the SHA that ships matches the SHA the original CI validated. - fix(base) #482: add `apt-get upgrade -y` to the debian-12-amd64 base image so fresh builds pick up Debian security advisories (libc-bin, libcap2, libsystemd0 — all HIGH-severity, all fixed upstream). No behavior changes to the build matrix, feature scripts, or runtime. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 tasks
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
crates/luggage/src/installer/validate.rswith#[serial_test::serial]to close the same fork+ETXTBSY race that fix(luggage): serialize shim-writing idempotency tests to close fork/exec race #459 fixed forinstaller::idempotency.matching_output_passes,mismatched_output_returns_validation_failed,propagates_env_to_subprocess) use the identicalwrite_shim+Command::output()pattern but were never serialized.Root cause
CI run 25982111224 — the merge-to-main of #479 — failed on Ubuntu only with:
The assertion fires inside the `ValidationFailed { message, .. }` arm. The only `message` formats that don't contain the requested version are the launch-failure branches (`binary not found`, `failed to launch`, `exited N: ...`). Under parallel `cargo test`, one thread's in-flight write-FD on the shim raises `i_writecount` while another thread forks for `execve`, and the child returns `ETXTBSY` (rust-lang/rust#100904). Ubuntu's faster fork/exec exposes it; macOS / Windows runners did not reproduce.
This is the same diagnosis and fix recipe that #459 applied to `idempotency.rs` — the `serial_test` dev-dep is already wired in.
Test plan
🤖 Generated with Claude Code