Skip to content

Skip bundler self-checksum on ruby-core in test fixtures#9506

Merged
hsbt merged 2 commits intomasterfrom
skip-bundler-checksum-on-ruby-core
Apr 30, 2026
Merged

Skip bundler self-checksum on ruby-core in test fixtures#9506
hsbt merged 2 commits intomasterfrom
skip-bundler-checksum-on-ruby-core

Conversation

@hsbt
Copy link
Copy Markdown
Member

@hsbt hsbt commented Apr 30, 2026

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

In ruby-core test setup, bundler is loaded as a default gem and the bundler.gem cache file is not present on disk where LockfileGenerator#bundler_checksum looks for it.

As a result, the generator omits the bundler checksum from the regenerated lockfile, while the test's checksums_section helper still adds it, making the "does not change the lock" expectations in setup_spec.rb fail on ruby-core CI for release branches (where Bundler::VERSION does not end in .dev).

Make sure the following tasks are checked

In ruby-core test setup, bundler is loaded as a default gem and the
bundler.gem cache file is not present on disk where
LockfileGenerator#bundler_checksum looks for it. As a result, the
generator omits the bundler checksum from the regenerated lockfile,
while the test's checksums_section helper still adds it, making the
"does not change the lock" expectations in setup_spec.rb fail on
ruby-core CI for release branches (where Bundler::VERSION does not end
in .dev). Mirror the generator's give-up conditions in the helper so
that test fixtures and the regenerated lockfile stay in sync.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 30, 2026 01:53
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

Adjusts the spec lockfile checksum fixture helper to better match Bundler’s lockfile generation behavior when running inside ruby-core, where the bundler .gem cache file may not be available for checksumming.

Changes:

  • Updates checksums_section to skip adding the bundler checksum when running in a ruby-core context.
  • Expands inline documentation to explain why bundler checksums are omitted in these environments.

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

Comment thread spec/support/checksums.rb Outdated
Comment thread spec/support/checksums.rb Outdated
# - .dev: development builds have no released bundler.gem to checksum.
# - ruby_core?: bundler is loaded as a default gem, so bundler.gem
# is not present on disk under the test gem cache.
next if Bundler::VERSION.to_s.end_with?(".dev") || ruby_core?
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@hsbt hsbt merged commit 40112f7 into master Apr 30, 2026
97 checks passed
@hsbt hsbt deleted the skip-bundler-checksum-on-ruby-core branch April 30, 2026 02:41
matzbot pushed a commit to ruby/ruby that referenced this pull request Apr 30, 2026
fixtures
(ruby/rubygems#9506)

* Skip bundler self-checksum on ruby-core in test fixtures

In ruby-core test setup, bundler is loaded as a default gem and the
bundler.gem cache file is not present on disk where
LockfileGenerator#bundler_checksum looks for it. As a result, the
generator omits the bundler checksum from the regenerated lockfile,
while the test's checksums_section helper still adds it, making the
"does not change the lock" expectations in setup_spec.rb fail on
ruby-core CI for release branches (where Bundler::VERSION does not end
in .dev). Mirror the generator's give-up conditions in the helper so
that test fixtures and the regenerated lockfile stay in sync.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

ruby/rubygems@40112f7663

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
hsbt added a commit that referenced this pull request Apr 30, 2026
The blanket skip in checksums_section from #9506 caused 82 ruby-core test
failures whose lockfile expectations legitimately include the bundler
checksum (paths that go through `bundle install` where bundler is
activated as a gem). Revert that change and instead tag only the
affected setup_spec example with :ruby_repo, since its
`ruby "require 'bundler/setup'"` invocation is the one case where
bundler is loaded from $LOAD_PATH and Source::Metadata's synthetic
bundler spec has no cache_file on disk.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
hsbt added a commit that referenced this pull request Apr 30, 2026
* Skip bundler self-checksum on ruby-core in test fixtures

In ruby-core test setup, bundler is loaded as a default gem and the
bundler.gem cache file is not present on disk where
LockfileGenerator#bundler_checksum looks for it. As a result, the
generator omits the bundler checksum from the regenerated lockfile,
while the test's checksums_section helper still adds it, making the
"does not change the lock" expectations in setup_spec.rb fail on
ruby-core CI for release branches (where Bundler::VERSION does not end
in .dev). Mirror the generator's give-up conditions in the helper so
that test fixtures and the regenerated lockfile stay in sync.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
(cherry picked from commit 40112f7)
hsbt added a commit that referenced this pull request Apr 30, 2026
The blanket skip in checksums_section from #9506 caused 82 ruby-core test
failures whose lockfile expectations legitimately include the bundler
checksum (paths that go through `bundle install` where bundler is
activated as a gem). Revert that change and instead tag only the
affected setup_spec example with :ruby_repo, since its
`ruby "require 'bundler/setup'"` invocation is the one case where
bundler is loaded from $LOAD_PATH and Source::Metadata's synthetic
bundler spec has no cache_file on disk.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
(cherry picked from commit 66c7546)
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