Repository navigation
CI: share one bundler scrub across test helpers (#823) - #1536
Merged
Mikola Lysenko (mikolalysenko) merged 3 commits intoOct 14, 2026
Merged
Conversation
Three gem suites each swept BUNDLE_* and GEM_* by hand before running `bundle`, and the hosted production suite ran `bundle` with no bundler scrub at all. The GEM_* half went against cache_env.rs's rule that rvm/chruby's GEM_HOME/GEM_PATH must stay, so the suites could break a developer's version-managed ruby. The production suites' socket-patch child also kept an ambient BUNDLE_PATH or COMPOSER_VENDOR_DIR, which moves the crawl off the fixture. Every bundle child now goes through scrub_socket_vars plus hermetic::Extra::Bundle, which also drops RUBYOPT (a `bundle exec` shell pins every child to the outer Gemfile). socket-patch children that crawl a project (the production suites and run_vex) use the new hermetic::CRAWLER_EXTRAS. A ratchet in spawn_env_hygiene rejects new private BUNDLE_* sweeps. Refs #823 Assisted-by: Claude Code:claude-opus-5-5
This was referenced Oct 14, 2026
Review fixes for the shared bundler scrub: - socket-patch children that crawl a real tree now go through hermetic::scrub_crawler_inputs, which also points BUNDLE_USER_CONFIG at a missing file. Without it the ruby crawler fell back to the developer's ~/.bundle/config, so a global `path` or `gemfile` there could still move the gem crawl off the fixture. - Extra::Bundle also drops RUBYLIB, which `bundle exec` sets to the outer bundler's lib dir. - The new hygiene test is #[serial] like every other with_ambient caller, and it now checks the pins and the RUBYOPT/RUBYLIB removal. Assisted-by: Claude Code:claude-opus-5-5
Mikola Lysenko (mikolalysenko)
marked this pull request as ready for review
October 14, 2026 16:22
Collaborator
Author
|
BugBot review Generated by Claude Code |
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 7dfba36. Configure here.
Tanmay Singla (Tanmay182003)
approved these changes
Oct 14, 2026
Mikola Lysenko (mikolalysenko)
deleted the
agent/fix-ci-hermetic-bundle-children
branch
October 14, 2026 17: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 23)
Problem
Test children that run
bundleeach had their own environment scrub,and the copies had drifted:
e2e_vendored_production,e2e_vendor_gem_buildande2e_redirect_gem_buildswept everyBUNDLE_*and everyGEM_*by hand. RemovingGEM_HOME/GEM_PATHgoes againsttests/common/cache_env.rs's rule: rvm/chruby export them andbundleresolves through them, so the suites could break adeveloper's version-managed ruby. Two of the three also skipped the
SOCKET_*scrub.e2e_hosted_productionranbundlethroughtool()with no bundlerscrub, so an ambient
BUNDLE_PATH,BUNDLE_FROZENorRUBYOPTreached it.socket-patchchild got onlyExtra::Venv, soan ambient
BUNDLE_PATH/BUNDLE_GEMFILEorCOMPOSER_VENDOR_DIRmovedthe crawl off the fixture.
Change (test-only)
hermetic::Extra::Bundlealso removesRUBYOPT(abundle execshell sets
-rbundler/setup, which pins child rubies to the outerGemfile). It keeps
GEM_HOME/GEM_PATH, as before.hermetic::CRAWLER_EXTRAS(Venv,Bundle,Composer) for asocket-patchchild that crawls a real tree. The production suites'run/run_socketandvex_e2e_common::run_vexuse it. Env a testpasses is applied after the scrub, so it still wins.
bundlehelpers usescrub_socket_vars+Extra::Bundle. Both production suites'pm_commandaddsExtra::Bundle, which covers the hostedtool("bundle")calls.spawn_env_hygiene: the bundle test also checksRUBYOPTis removedand
GEM_PATHkept; a new test coversCRAWLER_EXTRAS; a new ratchetno_private_bundler_sweepsrejects a hand-rolledstarts_with("BUNDLE_")sweep outsidehermetic.rs.socket-patchchildren that crawl a real tree gothrough
hermetic::scrub_crawler_inputs(CRAWLER_EXTRASplusBUNDLE_USER_CONFIGpinned to a missing file, so the ruby crawlercan't fall back to a developer's
~/.bundle/config). The pin is notin
Extra::Bundle, becausebundlechildren get their ownBUNDLE_USER_HOMEfromcache_env::isolate, which it would shadow.Extra::Bundlealso dropsRUBYLIB(set bybundle exec). The gembuild suites'
run_socketuse the same helper.Evidence
cargo test -p socket-patch-cli --all-features --test spawn_env_hygiene:20 passed. On
origin/mainthe new ratchet would flag the 3 helperfiles (
grep 'starts_with("BUNDLE_")'matches them there).cargo test -p socket-patch-cli --all-features --test spawn_env_hygiene --test e2e_vendor_gem_build --test e2e_redirect_gem_build --test e2e_redirect_gem_stale_install --test apply -- --include-ignored(ruby 3.3.6): 20 + 43 + 51 + 42 + 136 passed.
cargo fmt --all -- --checkandcargo clippy --workspace --all-features -- -D warnings(the CI lint) are clean. The productionsuites compile (
--no-run). They ande2e_gemneed the livepatches API, which this sandbox can't reach ("tunnel error"), so they
run on the scheduled full tier.
cargo test --workspaceran out of disk in the sandbox. Thelean PR run covers it.
Code review (
/code-review high)Fixed: missing
#[serial]on the new hygiene test; the~/.bundle/configfallback for crawler spawns;RUBYLIBunderbundle exec; thin assertions in the new test; the staleGEM_SPEC_CACHEdoc; the gem build suites now use the shared helper.Not fixed, with reasons:
hermetic::commandfor every spawn.That changes ~20 more suites, so it belongs in a later Spawn every CLI test child through one hermetic Command builder; 10 test files inherit ambient SOCKET_* today #823 slice
rather than this one.
no_private_bundler_sweepsto other spellings. It is a ratchetagainst copying the old pattern back. A fuzzier match would flag
legitimate code, and the env tests are what actually pin behavior.
pm_commandbetween the two production suites. That duplicatepredates this PR and is out of scope here.
tool_command("bundle")for Windowsbundle.bat. The gem buildsuites only run on Linux.
CI cost
Test-only, no workflow changes. A lean PR run keeps the same job count
and minutes (about 28 Linux jobs, ~8 min wall), before and after.
🤖 Generated with Claude Code
https://claude.ai/code/session_018oK2ooQLZpyw2hVVqctE9C
Generated by Claude Code
Generated by Claude Code