Repository navigation
Fix gem crawler missing Bundler .bundle root (#967) - #968
Open
Mikola Lysenko (mikolalysenko) wants to merge 3 commits into
Open
Mikola Lysenko (mikolalysenko) wants to merge 3 commits into
Mikola Lysenko (mikolalysenko) wants to merge 3 commits into
Conversation
Assisted-by: Claude Code:claude-opus-5-5
This was referenced Oct 6, 2026
With `default_install_uses_path` (Bundler 2.x) or `simulate_version 5` (Bundler 4.x), and no path in any settings tier, `bundle install` puts the project's gems in `<root>/.bundle/<engine>/<abi>/gems` and `bundle exec` loads them from there. The gem crawler never probed that root, so agent `apply` patched only the system copy, `vex` attested not_affected over the unpatched loaded copy, and the hosted stale-install guard missed a stale `.bundle` materialization. Resolve the deciding Bundler path tier once (explicit path and `path.system`) and probe `<root>/.bundle` whenever that tier names no path and no truthy `path.system`, mirroring `Path#base_path`. Like the other explicit roots it keeps the `gem env` fallback on for default gems. Fixes #967 Assisted-by: Claude Code:claude-opus-5-5
Assisted-by: Claude Code:claude-opus-5-5
Mikola Lysenko (mikolalysenko)
marked this pull request as ready for review
October 6, 2026 23:08
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 25e3ca6. Configure here.
Tanmay Singla (Tanmay182003)
approved these changes
Oct 7, 2026
Collaborator
Author
|
[agent] Ready for review at
Generated by Claude Code |
This branch has not been deployed
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
Fixes #967
Stacked on #916 (base branch
agent/fix-gem-path-system-default-root). Both issues come from the same gap: the gem crawler's install-root discovery doesn't model Bundler'sSettings#path→Path#use_system_gems?/base_pathresolution. #916 handles thesystem_pathhalf (#915). This PR handles thebase_path = ".bundle"half and generalizes #916'sbundler_path_systeminto abundler_path_tierresolver both halves share. Once #916 merges, GitHub retargets this PR tomain.Root cause
When no settings tier sets
path,path.systemordisable_shared_gems, Bundler'suse_system_gems?is!default_install_uses_path?on 2.x and!bundler_5_mode?on 4.x (checked in the 2.5.22 and 4.0.18 sources). Sosimulate_version 5turns it off, and Bundler 5 will make that the default. When it's false,base_pathis<root>/.bundle, and gems install to<root>/.bundle/<engine>/<abi>/gems.discover_bundle_stores_implnever probed that root. So agentapplypatched only the system copy,vexattestednot_affectedover the unpatched loaded copy, and the hosted stale-install guard missed a stale.bundlecopy.Fix
bundler_path_tierreturns the deciding tier'sexplicit_pathandsystem(orNone). Fix gem crawl ignoring Bundler path.system (#915) #916'spath.systemhandling is unchanged on top of it.<cwd>/.bundleis probed (both layouts) when that tier names no path and no truthypath.system. The version-dependent flags aren't read: the scoped store only exists once Bundler installed there, which is the same "probe if present" rule the defaultvendor/bundleuses. Like the other explicit roots, it keeps thegem envfallback on, because default gems stay in the system homes..bundleroot only counts for a Ruby project (Bundler manifest present), like the other explicit roots.CLI_CONTRACT.md"Gem install roots" now lists the root.Tests (red → green)
ruby_crawler::tests::dot_bundle_base_path_is_crawled(no config, localsimulate_version 5, localdefault_install_uses_path, falsypath.system)ruby_crawler::tests::dot_bundle_base_path_with_global_flag_is_crawledruby_crawler::tests::dot_bundle_base_path_is_skipped_when_bundler_does_not_use_it(controls: local/env/global path, empty path,path.systemin each tier, non-Ruby dir)crawler_ruby_e2e::dot_bundle_base_path_crawls_the_loaded_copy(ambient discovery finds the.bundlecopy before thegem envhome; local and env flags)e2e_redirect_gem_stale_install::gem_hosted_stale_dot_bundle_install_warns_and_is_not_attested(hosted guard names the stale.bundlecopy, same-run--vexdoesn't attest)Per-issue checklist:
.bundledefault install path (default_install_uses_pathon 2.x,simulate_version 5on 4.x), so agentapplypatches the system copy andvexattestsnot_affectedwhile Bundler loads the unpatched.bundle/ruby/<abi>copy #967: agentapply/vex(crawler unit + e2e tests above) and the hosted stale guard (CLI e2e above).Real Bundler check (Ruby 3.3.6, Bundler 4.0.18,
bundle config set --local simulate_version 5,bundle install→./.bundle/ruby/3.3.0/gems/colorize-0.8.1, hand-written manifest):socket-patch apply --offline --json→applied, andbundle execnow loads the patched file (include?("SOCKET-PATCHED")→true).socket-patch vex→not_affected. After reverting the.bundlecopy by hand,vexomits the purl (not_applied).Local runs:
cargo clippy --workspace --all-features -- -D warnings: clean.rustfmt --checkon the changed files: clean. CI has no fmt job, andmainisn't fmt-clean repo-wide.cargo test --workspace --all-features: 10829 passed, 12 failed. All 12 are chmod/unwritable-file tests (e.g.vendor_state_write_failure_reports_failed_event,copy_tree::relax_loop_must_not_traverse_symlinked_root). They can't fail a write when run as root, which this container is. None of them touch gem code, and CI runs them as non-root.Notes
.bundleagainstBundler.root. Like the other roots here, this uses--cwd. ABUNDLE_GEMFILEthat moves the root is Gem agent crawl ignores thatBUNDLE_GEMFILE=gemfiles/x.gemfilemovesBundler.root, so a relative bundle path resolves to the wrong dir,applypatches the system copy andvexattestsnot_affectedwhile Bundler loads the unpatchedgemfiles/vendor/bundlecopy #952's separate cause.🤖 Generated with Claude Code
Generated by Claude Code