Repository navigation
Fix gem checks judging unused system gem homes (#1098, #1109) - #1290
Conversation
Assisted-by: Claude Code:claude-opus-5-5
cargo fmt --check fails on main in the bun lock remedy test; rewrap the assertion so the format gate passes. Assisted-by: Claude Code:claude-opus-5-5
Bundler stops using the system gem homes under deployment mode as well as under an explicit path, but the stale-install guard only modeled the explicit path. A fresh deployment checkout with an old copy of the patched gem in the machine gem home got a false stale warning, and scan --mode hosted --vex exited 1 with nothing to attest (#1109). Standalone vex and apply --check still judged every gem env copy whenever vendor/bundle was empty, even under an explicit or deployment path, so they refused to attest a project that never loads that copy (#1098). One predicate now answers whether Bundler uses system gems, counting deployment after the path tiers like Bundler::Settings#path. The stale guard and the vex copy lookup both use it; default gems stay judged. The .bundle default from default_install_uses_path or simulate_version depends on the Bundler version, so those keep the system homes judged. Assisted-by: Claude Code:claude-opus-5-5
|
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 ff9da68. Configure here.
|
[agent] CI on
That points to a live-API problem that started around 15:45 UTC, not a code change. I know of no fix PR to port. I've re-run the failed jobs once (run 37957045166). Bugbot's review of Generated by Claude Code |
|
Ready for review (burn-down agent).
Generated by Claude Code |
Ports #1301 so this PR's CI is not blocked by #1293: production no longer serves the free minimist@1.2.2 patch 80630680, which breaks hosted-e2e and e2e_safety_pnpm on main as well. Same change as #1301; it becomes a no-op once #1301 lands on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YRcjmQwhWGod7X58Hbe5FW
|
[agent] Pushed Generated by Claude Code |
The republished minimist patch (642d7f02) keys its files without the
package/ prefix, so key.split('/', 1)[1] raised IndexError in every
native vlt leg. Ports the matching line from #1302.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YRcjmQwhWGod7X58Hbe5FW
|
[agent] Generated by Claude Code |
|
[final reviewer] I disarmed auto-merge. Tanmay Singla (@Tanmay182003), two commits that aren't merges from
Neither commit touches the gem system-home fix you approved. CI on Generated by Claude Code |
LLM Description written by Claude Code:claude-opus-5-5
Fixes #1098
Refs #1109 (the
deploymentvariants are fixed; the version-dependent.bundleflags are not, see below)Summary
Two gem checks judged a copy in the machine's
gem envhome that Bundler never loads for the project:deploymentor the.bundledefault path, soscan --mode hosted --vexfails withno_applicable_patcheson fresh checkouts #1109, hosted stale-install guard.deployment true(local config, envBUNDLE_DEPLOYMENT, or global config) makes Bundler install intovendor/bundleand never reuse a system copy. On a fresh checkout, though, the guard still flagged an old system-home copy as stale, soscan --mode hosted --vexexited 1 withno_applicable_patches.vex(andapply --check, which shares the lookup). Whenevervendor/bundlewas empty, these judged everygem envcopy, even under an explicit or deploymentpath. An unused unpatched copy made them refuse withnot_applied, both on a fresh checkout and with the patched copy installed in the project's path.Root cause
Nothing gave one answer to "does Bundler use system gems for this project?":
bundler_sets_explicit_pathmodeled onlypath/path.system/disable_shared_gems. It misseddeployment, which Bundler'sSettings#pathreads after the tier loop (path = "vendor/bundle" if self[:deployment]). I checked this in Bundler 2.5.22 and 4.0.18, which agree.vexcopy lookup goes throughget_gem_paths, which keeps thegem envhomes as apply write targets for default gems.Fix
bundler_sets_explicit_pathnow counts a truthydeployment(first tier that sets it, throughto_bool) once no tier decides the path.RubyCrawler::bundler_uses_system_gemsis the one predicate.bundler_install_homes(the stale guard) uses it, and so does a newbundler_unused_system_gem_homes.find_manifest_package_copies_reusing(used byvexandapply --check) drops gem copies under those unused homes, unless the copy is a default gem (spec inspecifications/default/), which Bundler loads from the system home under any path.vex_consumedtable now document the rule.patch/redirect/upstream/mod.rsthat is unformatted onmain, wherecargo fmt --checkfails.Not covered: the
.bundledefault (#1109 stays open)default_install_uses_pathis honored only by Bundler 2.x (settings_flag), andsimulate_version 5only by Bundler 4.x (bundler_5_mode?). In 4.0.18use_system_gems?never readsdefault_install_uses_path, and 2.5.22 never readssimulate_version. A scan can't tell which Bundler will run:BUNDLED WITHrecords who wrote the lock, not who installs it (#751). Skipping the system home on either flag could therefore attest a copy Bundler does load, so both flags keep the system homes judged (fail closed). Regression tests pin this. Closing that gap would need something like probingbundle --versionfrom the project root, which needs a maintainer decision.Test evidence
Red on
main(0a56308, tests only) and green with the fix:gem_hosted_deployment_ignores_system_home_copy(local / env / globaldeployment)no_applicable_patchesgem_hosted_system_gems_settings_still_flag_system_home_copy(falsy deployment,path.system/disable_shared_gems: falseover deployment,simulate_version 5,default_install_uses_path)gem_hosted_standalone_vex_ignores_unused_system_home_copy(fresh local / env / global path, fresh deployment, installedBUNDLE_PATH: gems; control without a path)not_applied, exit 1not_appliedbundler_sets_explicit_path_counts_deployment,is_default_gem_copy_reads_the_default_specifications_dirCommands run locally:
cargo fmt --all -- --check: clean.cargo clippy --workspace --all-features -- -D warnings: clean.cargo test -p socket-patch-cli --all-features --test e2e_redirect_gem_stale_install: 40 passed. Without the fix (src stashed): 38 passed, and the 2 new e2e tests failed.BUNDLER_TEST_VERSION=4.0.18 cargo test -p socket-patch-cli --all-features --test e2e_redirect_gem_build --test e2e_vendor_gem_build -- --ignored: 28 + 8 passed (real Bundler 4.0.18, Ruby 3.3.6).cargo test --workspace --all-features --no-fail-fast: 13508 passed, 13 failed, all outside the gem code. 12 are write-failure tests that make a path unwritable, which root ignores in this sandbox (*_state_write_failure_*,*_write_failure_*,repair_*_unremovable,relax_loop_must_not_traverse_symlinked_root,an_unremovable_hidden_lock_keeps_every_store_entry). The other ispipenv_hosted_to_vendored_names_the_unpatched_requirements, which needs network access to pypi.org.🤖 Generated with Claude Code
https://claude.ai/code/session_01YRcjmQwhWGod7X58Hbe5FW
Generated by Claude Code