From 7988b2c524e7b86a30945919d61ee54b23bf5486 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 7 May 2026 20:38:58 +0900 Subject: [ruby/rubygems] Propagate overrides into Definition#resolve lockfile-reuse paths Definition#resolve falls back to an existing lockfile when nothing about the Gemfile or the locked deps changed. The two SpecSet rebuild paths (deleted_deps subset and the redundant-platform-specific-gems fallback) constructed fresh SpecSet instances without carrying @overrides forward, so any LazySpec produced from them lost its override context. After Step G that mattered: an :all metadata override does not pre-unlock anything by design, which means it must flow through these reuse paths intact. Without it, the materialize layer either silently re-resolved (which churns the lockfile) or, on the install-time check, fell back to the spec's strict required_ruby_version metadata. Calling with_overrides on both rebuilt SpecSets keeps the install-time behavior consistent across resolve and lockfile-reuse paths. https://github.com/ruby/rubygems/commit/81fb91a8b1 Co-Authored-By: Claude Opus 4.7 (1M context) --- lib/bundler/definition.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index 2aa74804ba..45c6e9a693 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -338,11 +338,11 @@ module Bundler elsif no_resolve_needed? if deleted_deps.any? Bundler.ui.debug "Some dependencies were deleted, using a subset of the resolution from the lockfile" - SpecSet.new(filter_specs(@locked_specs, @dependencies - deleted_deps)) + SpecSet.new(filter_specs(@locked_specs, @dependencies - deleted_deps)).with_overrides(@overrides) else Bundler.ui.debug "Found no changes, using resolution from the lockfile" if @removed_platforms.any? || @locked_gems.may_include_redundant_platform_specific_gems? - SpecSet.new(filter_specs(@locked_specs, @dependencies)) + SpecSet.new(filter_specs(@locked_specs, @dependencies)).with_overrides(@overrides) else @locked_specs end -- cgit v1.2.3