Skip to content

Let the gem and bundle cooldown settings cover each other - #9852

Merged
hsbt merged 5 commits into
masterfrom
cooldown-cross-reference
Sep 4, 2026
Merged

Let the gem and bundle cooldown settings cover each other#9852
hsbt merged 5 commits into
masterfrom
cooldown-cross-reference

Conversation

@hsbt

@hsbt hsbt commented Sep 3, 2026

Copy link
Copy Markdown
Member

Setting a cooldown for one of the two tools left the other unprotected. gem read only the :cooldown: gemrc setting and bundler only its own, so a BUNDLE_COOLDOWN in a shell profile did nothing for gem install. Both now read both settings and the longer one applies. gem --cooldown has not shipped in a release yet, so no released behavior changes.

A configured 0 takes part like any other value rather than reading as unset, which keeps --cooldown 0 the way to bypass a cooldown the other tool configures. The flag wins outright, ahead of both settings and of the Gemfile per-source value.

$ cat ~/.gemrc
:cooldown: 7
$ bundle install                       # cooldown 7 applies, read from the gemrc
$ BUNDLE_COOLDOWN=14 gem install foo   # 14 wins over the gemrc 7
$ gem install foo --cooldown 0         # bypasses both

Gem::CooldownSettings holds the value rules both tools now share. Gem::BundlerSettings reads Bundler's config the way Bundler::Settings does, and folding Gem::BundlerVersionFinder onto it fixes an ignored BUNDLE_APP_CONFIG and a missing path separator that kept BUNDLE_VERSION in ~/.bundle/config from ever being read.

Generated with Claude Code

hsbt and others added 5 commits September 4, 2026 10:56
Gem::BundlerVersionFinder resolved Bundler's config files itself, and got
two of the paths wrong: it ignored BUNDLE_APP_CONFIG, and it concatenated
BUNDLE_USER_HOME and the home directory with the file name instead of
joining them, so BUNDLE_VERSION set in ~/.bundle/config was never found.
It also matched BUNDLE_VERSION with a regex of its own rather than
parsing the file, which let a value that is not a version through to
Gem::Version.

Gem::BundlerSettings now does the resolution for every RubyGems caller
that has to agree with something configured for Bundler.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Each of the five commands that take the flag validated it and set it as
a command option itself, and install read it under a string key while
the rest used a symbol.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Setting a cooldown for one of the two tools left the other unprotected,
since `gem` only read the `:cooldown:` gemrc setting and bundler only
read its own. They now read both, and the longer of the two applies, so
either setting alone covers `gem install` and `bundle install` alike.

A configured 0 takes part like any other value rather than reading as
unset, which keeps `--cooldown 0` the way to bypass a cooldown the other
tool configures: the flag wins outright, ahead of both settings and of
the Gemfile per-source value.

Gem::CooldownSettings holds the value rules both tools now share, so a
value that cannot be read as a number of days warns, naming where it came
from, and takes no part in the resolution on either side. On the bundler
side such a value used to read as 0 and suppress a per-source `cooldown:`
in the Gemfile.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The gemrc value takes part in resolving the cooldown but is not one of
the config layers, so `bundle config get cooldown` answered that nothing
was configured, then exited 1, while the cooldown was in force. It is
listed like a stored credential now, which is the other value the config
files do not hold.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Cooldown resolution reads Bundler's settings now, so a developer with one
configured in their shell saw it applied to the fixtures: four install
command tests and two update command tests failed under
BUNDLE_COOLDOWN=60.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@hsbt
hsbt force-pushed the cooldown-cross-reference branch from da96c8f to 42e80d8 Compare September 4, 2026 01:58
@hsbt
hsbt merged commit 0602168 into master Sep 4, 2026
109 checks passed
@hsbt
hsbt deleted the cooldown-cross-reference branch September 4, 2026 02:23
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