Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Don't report locked gems in the cooldown summary - #9981

Merged
hsbt merged 1 commit into
ruby:masterfrom
dentarg:bundler-cooldown-locked-summary
Oct 30, 2026
Merged

hsbt merged 1 commit into
ruby:masterfrom
dentarg:bundler-cooldown-locked-summary

Conversation

@dentarg

@dentarg dentarg commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

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

When a Gemfile source has cooldown: set, any resolve that keeps gems at their locked versions prints a "skipped by the cooldown setting" entry for every locked gem that has a newer release inside the cooldown window. This happens with bundle lock --add-platform, or with bundle install / bundle lock after an unrelated Gemfile change.

The entries say resolved <locked version> instead, which credits the cooldown for a version the lockfile chose. Nothing was unlocked, so the resolver keeps the locked version anyway, and --cooldown 0 writes an identical lockfile. In one of our apps, adding a platform or a gem prints 23 such lines.

Reproduction:

cat > Gemfile <<'GEMFILE'
source "https://rubygems.org", cooldown: 3650

gem "rake"
GEMFILE

cat > Gemfile.lock <<'LOCK'
GEM
  remote: https://rubygems.org/
  specs:
    rake (10.0.0)

PLATFORMS
  ruby

DEPENDENCIES
  rake

BUNDLED WITH
  4.0.23
LOCK

bundle lock --add-platform x86_64-linux
The following gem versions were skipped by the cooldown setting:
  * rake 13.4.2 (available in 3456 days), resolved 10.0.0 instead

What is your fix for the problem, implemented in this PR?

filter_cooldown / cooldown_excluded_versions record every newer candidate inside the window as skipped. Locked versions themselves are exempt (#9599), but the newer candidates are still recorded. cooldown_skipped_summary then only drops versions that aren't newer than the resolved one or don't satisfy the requirements. For a locked gem that isn't being unlocked, the locked version wins by preference (top-level gems only get a >= locked floor), so the newer versions pass that check and are reported, even though the resolver would not have picked them without the cooldown either.

The summary now skips gems that aren't being unlocked and resolved to their locked version. Gems being updated (bundle update, bundle update GEM, bundle lock --update) and gems new to the lockfile are still reported.

Command Before After
bundle lock --add-platform x86_64-linux rake 13.4.2 …, resolved 10.0.0 instead no summary
add gem "rack", bundle lock rack 3.2.7 … and rake 13.4.2 … rack only
bundle lock --update rake rake 13.4.2 …, resolved 11.3.0 instead unchanged
bundle lock --update rake 13.4.2 …, resolved 11.3.0 instead unchanged

The added spec fails without the fix:

Failure/Error: expect(out).not_to include("ripe_gem 2.0.0")

Related: #9576, #9599.

Make sure the following tasks are checked

When a source has `cooldown:` set, any resolve that keeps gems at their
locked versions, such as `bundle lock --add-platform` or `bundle
install` after a Gemfile change, listed every locked gem with a newer
release inside the window as "skipped by the cooldown setting".

Those entries credited the cooldown for a version the lockfile chose.
The gem was not unlocked, so the resolver keeps the locked version with
or without the cooldown, and `--cooldown 0` writes the same lockfile.

Skip gems that are not being unlocked and resolved to their locked
version. Gems being updated and gems new to the lockfile are still
reported.
@hsbt
hsbt merged commit 2c98682 into ruby:master Oct 30, 2026
114 checks passed
@dentarg
dentarg deleted the bundler-cooldown-locked-summary branch November 2, 2026 22:22
hsbt added a commit that referenced this pull request Nov 5, 2026
The spec added by #9981 refers to compact_index_v2, which replaced compact_index_cooldown only on master.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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