Repository navigation
CI: hermetic spawns in gem/vendor suites (#823) - #1505
Merged
Mikola Lysenko (mikolalysenko) merged 4 commits intoOct 14, 2026
Merged
Conversation
Assisted-by: Claude Code:claude-opus-5-5
e2e_gem, vendor_gem_lockfile_only_e2e and vendor_rerun_no_network_e2e started socket-patch with a bare Command::new and their own SOCKET_* sweeps, which let an ambient SOCKET_NO_CONFIG through and never forced the update check off. None of them scrubbed Bundler's environment: an ambient BUNDLE_PATH, or a ~/.bundle/config that sets one, adds the developer's gems to the crawl, so both gem scan tests fail on main (3 gems found instead of 2). All three now spawn through hermetic::command with Extra::Bundle; e2e_gem's unscoped scans also scrub an activated venv and use the stand-in HOME, and its bundle install child scrubs BUNDLE_* before setting its own BUNDLE_PATH. The files leave PENDING_RAW_SPAWNS, so the spawn_env_hygiene ratchet keeps them hermetic. Refs #823 Assisted-by: Claude Code:claude-opus-5-5
The ruby crawler also reads the user's ~/.bundle/config and the `gem env` homes (GEM_HOME, GEM_PATH, ~/.gem). The two vendor suites kept the real HOME, and none of the three removed GEM_PATH, so a developer's global bundler path or gem home could still change which gem store these tests crawl. Give the vendor suites' CLI children the stand-in HOME e2e_gem already uses, and remove both gem-home vars from every gem-crawling CLI child. Refs #823 Assisted-by: Claude Code:claude-opus-5-5
Mikola Lysenko (mikolalysenko)
marked this pull request as ready for review
October 13, 2026 21:27
Collaborator
Author
|
BugBot review Generated by Claude Code |
5 tasks
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit abd04cc. Configure here.
Tanmay Singla (Tanmay182003)
approved these changes
Oct 13, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Oct 13, 2026
…-gem-vendor # Conflicts: # crates/socket-patch-cli/tests/spawn_env_hygiene.rs
Tanmay Singla (Tanmay182003)
approved these changes
Oct 13, 2026
Mikola Lysenko (mikolalysenko)
deleted the
agent/fix-ci-hermetic-gem-vendor
branch
October 14, 2026 00:00
This was referenced Oct 14, 2026
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.
LLM Description written by Claude Code:claude-opus-5-5
Refs #823 (slice 14; the issue stays open for the remaining
PENDING_RAW_SPAWNSfiles)What
Three suites still on
PENDING_RAW_SPAWNSstartedsocket-patchwith a bareCommand::newand their ownSOCKET_*sweeps, which had drifted fromtests/common/hermetic.rs. Those sweeps let an ambientSOCKET_NO_CONFIGthrough and never forced the update check off. None of the suites guarded Bundler's environment:e2e_gem.rs: its unscoped scans assert the exact purl set the gem crawler sends upstream. The crawler readsBUNDLE_PATH,BUNDLE_APP_CONFIG, the user's~/.bundle/configand thegem envhomes. With an ambientBUNDLE_PATHpointing at a store that holds a gem, or aHOMEwhose.bundle/configsets one,scan_discovers_vendored_gemsandscan_discovers_gems_with_gemspecboth fail onmain(left: Some(3), right: Some(2)).vendor/vendor_gem_lockfile_only_e2e.rsandvendor/vendor_rerun_no_network_e2e.rshad the same partial sweeps, kept the realHOME, and scrubbed gem state only partly (BUNDLE_PATH/GEM_HOMEby name, noGEM_PATH).All three now spawn through
hermetic::commandwithExtra::Bundle. Their gem-crawling CLI children also dropGEM_HOME/GEM_PATHand get the stand-inHOMEfromjvm_env::isolate_cli.e2e_gemandvendor_rerun_no_network_e2eaddExtra::Venv. Thebundle installchild ine2e_gemscrubsSOCKET_*andBUNDLE_*before setting its ownBUNDLE_PATH. The two cargo-only spawns invendor_rerun_no_network_e2ealready pinCARGO_HOME, so they only move tohermetic::command. The three files leavePENDING_RAW_SPAWNS, so thespawn_env_hygieneratchet keeps them hermetic.This PR doesn't touch
common/hermetic.rs, so it doesn't overlap with #1498 / #1502 there. All three PRs remove different lines fromPENDING_RAW_SPAWNS, so whichever lands later needs a trivial rebase of that list.Test-only change; no product code touched.
CI cost
No workflow change. A lean PR run has the same job count (~28 Linux jobs) and job-minutes before and after, because these suites already run in the same jobs.
Test evidence
cargo fmt --all -- --check: clean.cargo clippy --workspace --all-features -- -D warnings: clean. Clippy on thee2e_gem/vendor/spawn_env_hygienetest targets reports only existing lints in files this PR doesn't touch (prebuilt_common/mod.rs,e2e_golang_redirect.rs, duplicate-module warnings).main(cargo test -p socket-patch-cli --all-features --test e2e_gem):BUNDLE_PATH=<store holding rogue-9.9.9>: 21 passed, 2 failed (scan_discovers_gems_with_gemspec,scan_discovers_vendored_gems).HOME=<home whose .bundle/config sets BUNDLE_PATH to that store>: the same 2 failed.BUNDLE_PATH=<store>;BUNDLE_APP_CONFIG=<config dir>;HOME=<that home>;GEM_HOME/GEM_PATH=<store>; andSOCKET_ECOSYSTEMS=npm SOCKET_NO_CONFIG=0 SOCKET_DRY_RUN=true SOCKET_CLI_API_TOKEN=x VIRTUAL_ENV=<dir>:--test e2e_gem: 23 passed (3 live-API tests ignored, as in CI)--test vendor -- vendor_gem_lockfile_only_e2e vendor_rerun_no_network_e2e: 20/20--test spawn_env_hygiene: 15/15e2e_gemtests need the live Socket API and Bundler. CI runs them on demand only (ci.yml:1169-1178), and they weren't run here. Their only change is the hermetic env on the CLI child, plus theSOCKET_*/BUNDLE_*scrub on thebundle installchild that runs before it setsBUNDLE_PATH./code-review high
HOME, so~/.bundle/configand~/.gemcould still reach the crawl.GEM_PATHwas never removed. Thee2e_gemdoc comment claimed more isolation than the code gave.e2e_gem's privaterun/assert_run_okintocommon::run_bin_with_envwith anextrasparameter. That touches every caller of the shared runner, so it belongs in its own change. Earlier slices made the same call.HOMEhandling intoExtra::Bundle.Extra::Bundlealso scrubs realbundlechildren, and those need an ambientGEM_HOMEon version-managed Rubies (rvm, chruby). Doing that would also put a third PR onhermetic.rswhile CI: hermetic spawns in NuGet/PyPI suites (#823) #1498 and CI: hermetic spawns in Cargo/Composer suites (#823) #1502 edit it. The removal stays on the CLI children.🤖 Generated with Claude Code
https://claude.ai/code/session_01J5o3ceqEyqmPQbY2WJMEB1
Note
Low Risk
Changes are limited to test harness environment scrubbing; no runtime CLI or production behavior is modified.
Overview
Gem and vendor CLI tests now spawn through the shared
hermetichelper instead of bareCommand::newplus hand-rolledSOCKET_*loops, so behavior matchestests/common/hermetic.rs(forced opt-outs, no drift onSOCKET_NO_CONFIG/ update checks).In
e2e_gem, the CLIrunhelper useshermetic::commandwithExtra::BundleandExtra::Venv, clearsGEM_HOME/GEM_PATH, and stand-inHOMEviajvm_env::isolate_cliso unscoped scan assertions on exact PURL sets cannot pick up the developer’s Bundler or gem homes.bundle installscrubsSOCKET_*andBUNDLE_*before pinningBUNDLE_PATHon the fixture.vendor_gem_lockfile_only_e2eandvendor_rerun_no_network_e2eget the same hermetic spawn forvendor(plus bundle/venv scrub and gem-home isolation where the crawlers read Ruby/Python state). Cargo-only vendor paths in the rerun suite only switch tohermetic::commandwhile still settingCARGO_HOME.Those three files are removed from
PENDING_RAW_SPAWNSinspawn_env_hygiene.rs, tightening the ratchet that forbids new bare binary spawns. Test-only; no product code changes.Reviewed by Cursor Bugbot for commit abd04cc. Configure here.
Generated by Claude Code