Skip to content

Fall back to lockfile version when BUNDLE_VERSION is "lockfile"#9545

Merged
hsbt merged 1 commit into
masterfrom
bundle-version-lockfile-fallback
May 14, 2026
Merged

Fall back to lockfile version when BUNDLE_VERSION is "lockfile"#9545
hsbt merged 1 commit into
masterfrom
bundle-version-lockfile-fallback

Conversation

@hsbt
Copy link
Copy Markdown
Member

@hsbt hsbt commented May 14, 2026

What was the end-user or developer problem that led to this PR?

Bundler treats "lockfile" as a special value for the version setting, meaning "use the version recorded in BUNDLED WITH".

BundlerVersionFinder was passing the raw string to Gem::Version.new and raising ArgumentError both from the env var added in #9538 and from .bundle/config.

Make sure the following tasks are checked

Bundler treats "lockfile" as a special value for the version setting,
meaning "use the version recorded in BUNDLED WITH". BundlerVersionFinder
was passing the raw string to Gem::Version.new and raising ArgumentError
both from the env var added in #9538 and from .bundle/config.
Copilot AI review requested due to automatic review settings May 14, 2026 01:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Gem::BundlerVersionFinder to recognize the special value "lockfile" for the BUNDLE_VERSION setting (and BUNDLE_VERSION env var added in #9538). Previously, the literal string "lockfile" was passed to Gem::Version.new, raising ArgumentError. Now the finder skips assigning that sentinel and falls through to lockfile_version.

Changes:

  • Capture bundle_config_version once into bcv and short-circuit on "system" as before.
  • Skip using bcv as the version when its value is the sentinel "lockfile", so the lockfile's BUNDLED WITH value is used.
  • Add tests covering both the BUNDLE_VERSION=lockfile env var path and the .bundle/config BUNDLE_VERSION: "lockfile" path.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lib/rubygems/bundler_version_finder.rb Treat "lockfile" as a sentinel and fall back to the lockfile-recorded version instead of passing the literal to Gem::Version.new.
test/rubygems/test_gem_bundler_version_finder.rb Adds two tests covering the new sentinel behavior via env var and via global bundle config.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hsbt hsbt merged commit 2406589 into master May 14, 2026
98 checks passed
@hsbt hsbt deleted the bundle-version-lockfile-fallback branch May 14, 2026 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants