Skip to content

Commit d4e51dd

Browse files
hsbtclaude
andcommitted
Skip bundler self-checksum for unreleased bundlers
Using `Bundler.gem_version.end_with?(".dev")` only skips the own checksum on master, but patch releases run from a source checkout (e.g., bumping bundler/lib/bundler/version.rb to 4.0.11 on a release branch) still record the checksum, which is environment dependent on the local gem cache and causes frozen-lock drift on CI. Generalize the guard with `released_bundler?`, which returns false for any prerelease version and for bundlers loaded outside of an installed gem location (`/specifications/`), so dev workflows don't record self-checksums while released installs still do. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f72d9d9 commit d4e51dd

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

bundler/lib/bundler/lockfile_generator.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def add_section(name, value)
103103
end
104104

105105
def bundler_checksum
106-
return [] if Bundler.gem_version.to_s.end_with?(".dev")
106+
return [] unless released_bundler?
107107

108108
bundler_spec = definition.sources.metadata_source.specs.search(["bundler", Bundler.gem_version]).last
109109
return [] unless File.exist?(bundler_spec.cache_file)
@@ -115,5 +115,11 @@ def bundler_checksum
115115

116116
[definition.sources.metadata_source.checksum_store.to_lock(bundler_spec)]
117117
end
118+
119+
def released_bundler?
120+
return false if Bundler.gem_version.prerelease?
121+
# Released gem specs live under .../specifications/; source checkouts don't.
122+
Gem.loaded_specs["bundler"]&.loaded_from.to_s.include?("/specifications/")
123+
end
118124
end
119125
end

0 commit comments

Comments
 (0)