Skip to content

Fail instead of warning when frozen mode can't update the lockfile - #9750

Open
hsbt wants to merge 2 commits into
masterfrom
claude/rubygems-issue-9549-d50efa
Open

Fail instead of warning when frozen mode can't update the lockfile#9750
hsbt wants to merge 2 commits into
masterfrom
claude/rubygems-issue-9549-d50efa

Conversation

@hsbt

@hsbt hsbt commented Aug 2, 2026

Copy link
Copy Markdown
Member

bundle install and bundle check in frozen mode printed Cannot write a changed lockfile while frozen. to stderr and exited 0 when regenerating the lockfile would change it, so invalid lockfiles went unnoticed in CI. This makes write_lock raise ProductionError instead. To avoid failing on environment-only differences, the frozen comparison now ignores BUNDLED WITH even across bundler major versions, and the lockfile generator reproduces the locked bundler CHECKSUMS entry instead of recording one for the running bundler version, so deploys running a different bundler version than the one that generated the lockfile keep working. A bundler checksum entry that contradicts BUNDLED WITH still fails. This complements #9715, which catches drift visible to ensure_equivalent_gemfile_and_lockfile. The cases caught here are canonical-form differences such as the out-of-order orphan entries from the report.

Fixes #9549

bundle install and bundle check in frozen mode printed "Cannot write a
changed lockfile while frozen." to stderr and exited 0 when regenerating
the lockfile would change it, so invalid lockfiles went unnoticed in CI.
Raise ProductionError instead. To avoid failing on environment-only
differences, ignore BUNDLED WITH even across bundler major versions and
reproduce the locked bundler CHECKSUMS entry instead of recording one
for the running bundler version.

#9549

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
These lockfiles deviated from the canonical form bundler generates (a
missing or extra trailing slash on the source remote, unsorted GEM and
DEPENDENCIES entries), so frozen mode used to print a warning and keep
going. Now that a changed lockfile raises in frozen mode, align them
with what bundler actually writes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@hsbt
hsbt force-pushed the claude/rubygems-issue-9549-d50efa branch from e1ecc67 to 2a2b5cc Compare August 4, 2026 01:56
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.

BUNDLE_FROZEN=1 bundle install proceeds with install and exits 0 with many different forms of invalid lockfile

1 participant