Skip to content

Add bundle doctor cooldown to check a lockfile against the cooldown - #9995

Closed
jjb wants to merge 2 commits into
ruby:masterfrom
jjb:bundle-doctor-cooldown
Closed

jjb wants to merge 2 commits into
ruby:masterfrom
jjb:bundle-doctor-cooldown

Conversation

@jjb

@jjb jjb commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

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

The cooldown feature currently comes into action when a gem is being installed or updated, but there is no way to "check" a lockfile.

It would be nice to check a lockfile for cooldown violations, in particular in CI.

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

this PR implements bundle doctor cooldown, which reads the lockfile and fetches the publish time of each locked gem. It compares each publish time with the cooldown for the source of the gem. When a locked gem is inside the cooldown window, the command prints the gem and exits 1.

$ bundle doctor cooldown --cooldown 14
Fetching gem metadata from https://rubygems.org/.........
The following locked gems are inside the cooldown window:
  * parser 3.3.13.0 (in cooldown for 7 more days)
  * rack 3.2.8 (in cooldown for 14 more days)
  * rubocop 1.92.2 (in cooldown for 13 more days)

Behavior:

  • The command reads the cooldown the same way as bundle install. See cooldown in bundle-config(1).
  • A version fails when any published build of it is inside the window. This includes builds for platforms that the lockfile does not list. The resolver uses the same rule.
  • Gems from git and path sources have no publish time, so the command skips them.
  • When the gem server gives no publish time for a locked gem, the command names the gem in a warning. That gem does not cause a failure. The resolver ignores such versions without a warning, but a silent skip in a CI check gives a false pass.
  • When no cooldown applies, the command says so and exits 0. It does not connect to the gem server.

I chose bundle doctor for the check. bundle doctor already checks the bundle for problems and exits 1 when it finds one. So the check goes there, next to diagnose and ssl. here are other places it could live instead:

  • bundle check: this command works offline. A cooldown check adds network access to it.
  • bundle lock: this command writes the lockfile. A read-only mode does not fit it.
  • a new bundler-foo gem, like bundler-audit

Make sure the following tasks are checked

The cooldown only filters versions when Bundler resolves, and versions
already in the lockfile are exempt, so a version that is too new stays
in the lockfile once it gets there. The new subcommand reads the
lockfile as written, fetches the publish time of each locked version,
and exits 1 when one is inside the cooldown window, so CI can catch it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jjb
jjb marked this pull request as ready for review October 30, 2026 20:15
@hsbt

hsbt commented Nov 27, 2026

Copy link
Copy Markdown
Member

I don't want to add and maintain another subcommand for this in Bundler itself, so I'm closing this.

@hsbt hsbt closed this Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants