Skip to content

Bundler's path tier rule is written twice in ruby_crawler, and store discovery ignores BUNDLE_DISABLE_SHARED_GEMS: "false" #1931

Closed

Description

[agent] Filed by the scheduled architecture audit (audit-core). Register: register.

Kind: bug (duplicated rule that drifted). Register ID: A53.

Problem

Bundler's Settings#path tier rule (the first config tier that sets path, path.system or disable_shared_gems decides, and a falsy disable_shared_gems means system gems) is implemented twice in crawlers/ruby_crawler.rs, and the two copies disagree:

  • Copy A: bundler_sets_explicit_path L1347-L1379,`` used by bundler_uses_system_gems. It treats `disable_shared_gems` set to a falsy value as "use system gems", as Bundler does.
  • Copy B: bundler_path_tier L880-L907 plus config_path_tier L2410-L2423,````` used by store discovery. disable_shared_gems only makes a tier count. `system` is read from `BUNDLE_PATH__SYSTEM` alone:
    system: bundle_config_setting_including_empty(contents, "BUNDLE_PATH__SYSTEM")
        .is_some_and(|v| bundler_truthy(&v)),
  • Partial copies of the same rule: the shadowed check (L519-L520),`````` global_path_config_unless_env_path_settings L2164-L2174,``````` and the same-file `path.system` drop in `parse_bundle_config_path_with` L2377-L2395.````````
  • Two structs model the same concept: BundlerPathSettings and BundlerPathTier.

Executed in a scratch copy of the workspace at cbbbdb9. The project has a Gemfile, a leftover vendor/bundle store, and a .bundle/config containing BUNDLE_DISABLE_SHARED_GEMS: "false".

As a control, the same project with BUNDLE_PATH__SYSTEM: "true" returns [].

Proposed change

Replace the copies with one resolver over BundlerPathSettings that returns { explicit_path, system, deciding_tier }. Use it from discovery (bundler_path_tier), from shadowed, and from bundler_uses_system_gems. Then delete BundlerPathTier and config_path_tier, and fold global_path_config_unless_env_path_settings into the resolver.

Size

1 file (crawlers/ruby_crawler.rs), about −80/+40 production lines, plus one test.

Acceptance criteria

  • A new unit test: disable_shared_gems: "false" with a leftover vendor/bundle yields no bundle store, and the gem env homes are kept.
  • Existing path.system, BUNDLE_PATH and deployment tests pass unchanged.
  • One tier resolver remains, and one settings struct.

Activity

  1. added
    bugSomething isn't working
    arch-auditFiled by a scheduled architecture audit routine (see the architecture review discussion)
    on Nov 1, 2026
  2. mikolalysenko commented on Nov 1, 2026

    @mikolalysenko
    CollaboratorAuthor

    [agent] Triage: priority:p1 (Bundler). Related to #1935, which plans to move the resolver this issue unifies; fix this first. No open PR covers it.


    Generated by Claude Code

  3. mikolalysenko commented on Nov 1, 2026

    @mikolalysenko
    CollaboratorAuthor

    [agent] Claiming this issue (shared root cause: Bundler's path tier rule is implemented twice in ruby_crawler and store discovery's copy ignores a falsy disable_shared_gems). Branch: agent/fix-bundler-path-tier-resolver. Claim-ID: 2026-11-01T16:21:11Z-b085f2


    Generated by Claude Code

  4. mikolalysenko commented on Nov 1, 2026

    @mikolalysenko
    CollaboratorAuthor

    [agent] Draft PR: #1943


    Generated by Claude Code

  5. added 2 commits that reference this issue on Nov 1, 2026
    ba9a49b
    fe20764
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent:triagedarch-auditFiled by a scheduled architecture audit routine (see the architecture review discussion)bugSomething isn't workingpriority:p1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions