From 325228e2b802d350afa01a37689fac6f2ca33f1d Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Fri, 29 May 2026 16:38:03 +0900 Subject: [PATCH] [ruby/rubygems] Cover cooldown outdated annotation and update error path Adds three E2E checks against the v2 cooldown artifice: the negative CLI value is rejected at parse time, `bundle outdated --cooldown` tags the latest-but-cooled version in both table and parseable output, and `bundle update --cooldown 99999` surfaces the cooldown hint when every candidate is filtered. These were the remaining coverage gaps called out in the adversarial review. https://github.com/ruby/rubygems/commit/3df6b300f7 Co-Authored-By: Claude Opus 4.7 --- spec/bundler/install/cooldown_spec.rb | 88 +++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/spec/bundler/install/cooldown_spec.rb b/spec/bundler/install/cooldown_spec.rb index 35415950d82..1368726c2c7 100644 --- a/spec/bundler/install/cooldown_spec.rb +++ b/spec/bundler/install/cooldown_spec.rb @@ -44,6 +44,12 @@ RSpec.describe "bundle install with the cooldown setting" do expect(the_bundle).to include_gems("myrack 1.0.0") end + + it "rejects a negative --cooldown value" do + bundle "install --cooldown=-7", artifice: "compact_index", raise_on_error: false + + expect(err).to match(/non-negative integer/) + end end context "configuration" do @@ -154,5 +160,87 @@ RSpec.describe "bundle install with the cooldown setting" do expect(the_bundle).to include_gems("ripe_gem 2.0.0") end + + it "annotates in-cooldown versions in bundle outdated table output" do + gemfile <<-G + source "https://gem.repo3" + gem "ripe_gem", "1.0.0" + G + + lockfile <<-L + GEM + remote: https://gem.repo3/ + specs: + ripe_gem (1.0.0) + + PLATFORMS + #{lockfile_platforms} + + DEPENDENCIES + ripe_gem (= 1.0.0) + + BUNDLED WITH + #{Bundler::VERSION} + L + + bundle "outdated --cooldown 7", artifice: "compact_index_cooldown", raise_on_error: false + + expect(out).to match(/ripe_gem.*\(cooldown \d+d\)/) + end + + it "annotates in-cooldown versions in bundle outdated --parseable output" do + gemfile <<-G + source "https://gem.repo3" + gem "ripe_gem", "1.0.0" + G + + lockfile <<-L + GEM + remote: https://gem.repo3/ + specs: + ripe_gem (1.0.0) + + PLATFORMS + #{lockfile_platforms} + + DEPENDENCIES + ripe_gem (= 1.0.0) + + BUNDLED WITH + #{Bundler::VERSION} + L + + bundle "outdated --cooldown 7 --parseable", artifice: "compact_index_cooldown", raise_on_error: false + + expect(out).to match(/ripe_gem.*in cooldown for \d+ more day/) + end + + it "surfaces a cooldown hint when bundle update filters every candidate" do + gemfile <<-G + source "https://gem.repo3" + gem "ripe_gem" + G + + lockfile <<-L + GEM + remote: https://gem.repo3/ + specs: + ripe_gem (1.0.0) + + PLATFORMS + #{lockfile_platforms} + + DEPENDENCIES + ripe_gem + + BUNDLED WITH + #{Bundler::VERSION} + L + + bundle "update ripe_gem --cooldown 99999", artifice: "compact_index_cooldown", raise_on_error: false + + expect(err).to match(/excluded by the cooldown setting/) + expect(err).to match(/--cooldown 0/) + end end end