GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — test: fix hostile-decoy env race flaking the setup-matrix and e2e suites by mikolalysenko · Pull Request #135 · SocketDev/socket-patch Conversation
Collaborator
The flakeSeen twice in CI (both times on Root causeSeveral test binaries deliberately set hostile ambient env decoys process-wide ( Mechanism proven RED/GREENMade the CI schedule deterministic locally: a 10ms delay before the decoy set (simulating the late thread start CI runners hit) plus a 25ms window between scrub snapshot and spawn → 2/3 host_guard tests fail on every run with the exact CI assertion; with the fix in place and the same probes, 5/5 runs green. (Probes not committed.) The fixApplied to every test binary that mutates process env and has parallel siblings (
Single-test binaries with ValidationAll touched binaries run locally: pypi/deno/maven/nuget/safety_cow/vendor_pypi_build green (docker-gated cases skip/fail identically on an untouched checkout — pre-existing local-env, e.g. the known BASELINE GAP cases). The 🤖 Generated with Claude Code
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactionsCI flake (seen twice: setup_matrix_pypi
host_guard::poetry_check_recognizes_structural_hook_host, exit 2 with a
clap --help hint): several test binaries set hostile ambient env decoys
PROCESS-WIDE (std::env::set_var) to prove the child-env scrub in their
run helpers works, while sibling tests run on parallel threads. The
scrub snapshots std::env::vars_os() and then spawns; a set_var landing
between a sibling's snapshot and its spawn reaches the child un-scrubbed
and (for SOCKET_STRICT=banana etc.) aborts its arg parse with exit 2.
Mechanism proven RED/GREEN by making the schedule deterministic: a 10ms
delay before the decoy set (simulating the late thread start CI hits)
plus a 25ms window between snapshot and spawn fails 2/3 host_guard
tests on EVERY run without the fix, and 0/5 runs with it (probes not
committed).
Fix, applied to every binary that mutates process env with >1 test
(setup_matrix_{pypi,npm,deno,maven,nuget}, e2e_safety_cow,
e2e_vendor_pypi_build):
- #[serial_test::serial] on every test in the binary — serial only
excludes other #[serial] tests, so annotating just the mutator would
fix nothing
- smc::DecoyGuard, an RAII setter that removes the decoys on drop, so a
panicking assertion can't leave the process env poisoned for the tests
that run after it (npm and nuget previously never removed their decoys
at all)
Co-Authored-By: Claude Fable 5 <[email protected]>
Mikola Lysenko (mikolalysenko)
requested a review
from Wenxin Jiang (Wenxin-Jiang)
Wenxin Jiang (Wenxin-Jiang)
approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Mikola Lysenko (mikolalysenko)
added a commit
that referenced
this pull request
…allel] (#136) Follow-up to #135, which fixed the hostile-decoy env race in the setup-matrix suites and documented the gotcha this sweep now applies repo-wide: #[serial] only excludes OTHER #[serial] tests. Nine crawler_*_e2e binaries (and cli_global_args) have #[serial] tests that swap process-global state — HOME, VIRTUAL_ENV, PATH, XDG dirs, even the process cwd (composer) — around in-process crawler calls, while dozens of unmarked sibling tests run concurrently on other threads. Unlike #135's child-spawn snapshot race (a microseconds window), the in-process variant exposes siblings for the mutator's entire body: any sibling whose crawl probes HOME-based global caches mid-swap sees the wrong universe. A helper-aware sweep of every test binary in both crates confirmed all MUTATING tests are already #[serial] (including mutation hidden inside helpers like crawler_npm_e2e's with_empty_path); the gap was solely the unmarked siblings. Fix: #[serial_test::parallel] on all 205 of them — parallel-marked tests keep running concurrently with each other but are excluded while any #[serial] test holds the lock, so suite wall-time is unchanged (binaries' runtimes identical before/after). Mechanism proven RED/GREEN with a throwaway probe pair (not committed): a #[serial] test swapping HOME for 150ms + an UNMARKED sibling asserting HOME stays stable fails 3/3 runs; marking the sibling #[parallel] passes 5/5. Same primitive as #135's proof, in-process variant. Single-test binaries with env mutation (e2e_golang_build, setup_matrix_env_guard) have no intra-process race and stay untouched. Co-authored-by: Claude Fable 5 <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. 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. |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |