Skip to content

Address remaining cooldown review follow-ups - #9801

Merged
hsbt merged 3 commits into
masterfrom
cooldown-review-followups
Aug 24, 2026
Merged

Address remaining cooldown review follow-ups#9801
hsbt merged 3 commits into
masterfrom
cooldown-review-followups

Conversation

@hsbt

@hsbt hsbt commented Aug 24, 2026

Copy link
Copy Markdown
Member

Implements three remaining review findings from #9576.

effective_cooldown now memoizes the Bundler.settings lookup that the resolver makes once per candidate spec, and cooldown_excluded? checks the day count before touching the locked specs. The lookup being memoized means the value is a snapshot, which is fine because nothing changes the cooldown setting after the sources are built.

An invalid cooldown coming from a config file or from BUNDLE_COOLDOWN used to disable the cooldown silently. It now warns, and says the cooldown ends up disabled for every source, because such a value also overrides any per-source cooldown: in the Gemfile. The check runs at the CLI entry point rather than while reading the setting, so bundle config does not warn merely for listing settings and bundle outdated does not swallow the warning inside its Bundler.ui.silence block. gem warns the same way for gemrc values, and rejects a negative --cooldown outright.

A created_at timestamp without a time zone offset was read as local time, which shifted the cooldown window by whatever offset the machine happened to have. Both halves now complete the missing offset and parse it as UTC. gem outdated and gem update read timestamps through a second parser in Gem::Source that the first pass missed, so both paths share one helper now.

hsbt added 3 commits August 24, 2026 16:59
The resolver asks for the cooldown once per candidate spec, paying a
Bundler.settings lookup each time, so read it once per remote. That
makes the value a snapshot, which is fine because nothing changes the
setting after the sources are built. Also check the day count before
the locked specs lookup, so a resolve without a cooldown configured
stops earlier.
A cooldown from a config file or from BUNDLE_COOLDOWN went through
value.to_i, so "abc" became 0 and "-5" stayed negative, and either one
disabled the cooldown without saying so. Read it with Integer() and
warn, naming the effect: such a value disables the cooldown for every
source, overriding any per-source cooldown: in the Gemfile.

The check runs at the CLI entry point rather than while reading the
setting, so bundle config does not warn merely for listing settings,
and bundle outdated does not swallow it inside Bundler.ui.silence.
gem warns the same way for gemrc values, including ones that are not
even numbers, and rejects a negative --cooldown outright.
A created_at without a time zone offset was parsed as local time, so a
third-party server that omits the offset shifted the cooldown window by
whatever offset the machine running bundler happened to have.
rubygems.org always sends one, so this never showed up against it.
Complete the missing offset with "Z" before parsing, which leaves the
set of accepted formats unchanged.

Time.new(value, in: "UTC") would be the obvious way to say this, but it
raises TypeError on JRuby, and rescue ArgumentError does not catch that.
gem outdated and gem update read timestamps through a second parser in
Gem::Source that still used local time, so route both through one
helper.
@hsbt
hsbt force-pushed the cooldown-review-followups branch from 1b8cf53 to ea314c4 Compare August 24, 2026 08:03
@hsbt
hsbt merged commit b3082bd into master Aug 24, 2026
110 checks passed
@hsbt
hsbt deleted the cooldown-review-followups branch August 24, 2026 08:36
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.

1 participant