ci: Apply a Bundler cooldown to dependency resolution - #425
Draft
kinyoklion wants to merge 2 commits into
Draft
Conversation
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
|
@cursor review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolve dependencies only to gem versions that have been public for at least seven days, using Bundler's cooldown. Equivalent of launchdarkly/openfeature-ruby-server#35.
ld-eventsourceis exempt, so the exact-version bump right after one of its releases still resolvesjruby-9.4, which is Ruby 3.1 and cannot install Bundler 4 at all, so it stays on Bundler 2 and resolves without a cooldown--parallelis broken under JRuby as of RuboCop 1.90.0, which thejruby-9.4job picks up regardlessRequirements
Related issues
Port of launchdarkly/openfeature-ruby-server#35 and, for the RuboCop step, launchdarkly/openfeature-ruby-server#34.
Implementation details
How cooldown works
source "https://rubygems.org", cooldown: 7makes Bundler consult the per-versioncreated_attimestamp in rubygems.org's v2 compact index during resolution and pass over any version younger than the window. Versions whose source does not exposecreated_at(private registries, pre-v2 entries) stay resolvable, so this never silently blocks a resolution.--cooldown 0/BUNDLE_COOLDOWN=0is the escape hatch when the newest release is exactly the one you want, e.g. a security fix.Why the second source block
Cooldown is stored per remote URI (
Bundler::Source::Rubygems#remote_cooldowns), with no per-gem option, and a secondsourceblock for the same URI does not get its own value. Naming the registry's index host gives a distinct remote that can carrycooldown: 0:The gemspec requires
ld-eventsourceat an exact version, deliberately, so that bugfixes there are always tied to a new SDK version. Without the exemption, the first seven days after eachld-eventsourcerelease would be un-resolvable: every candidate satisfying the new exact constraint is inside the cooldown window. Exempting it is also the right policy — we publish that gem, so it is not the untrusted-third-party case cooldown defends against.The
jruby-9.4exception, and the RuboCop stepBundler 4.0.19 requires Ruby >= 3.2, and JRuby 9.4 reports
RUBY_VERSION3.1.7:So the shared setup action selects the Bundler version per runtime rather than pinning one for all of them, and the
jruby-9.4job resolves with Bundler 2, which ignorescooldown:. That job therefore keeps installing brand-new gem versions — including RuboCop 1.90.0, whose--parallelmode is broken under JRuby, which failed the first CI run on this branch:On JRuby the
parallelgem cannot fork, so it runs work in threads; RuboCop 1.90 began preserving cop instances across files, and shared cop instances seeing concurrentprocessed_sourcevalues produce thousands of internal cop errors and phantom offenses. Dropping--parallelfixes it, and parallelism is a negligible speedup on 185 files. openfeature-ruby-server does not have the Bundler gap because its matrix is onjruby-10.0(Ruby 3.4); moving this repo's matrix tojruby-10would let cooldown apply everywhere, but that is a supported-platform change and out of scope here.Verification
Ran locally in containers against this branch (no lockfile):
rubocop 1.90.0 (available in 4 days), resolved 1.89.0 instead, same foraws-partitions; 1046 examples 0 failures; RuboCop cleancooldown:--parallel→ 37497 internal cop errors and 965 phantom offenses; serial → 185 files inspected, no offensesAlternatives considered
jruby-9.4job outright.cooldown: 3with no exemption: shorter window, and still breaks for three days after eachld-eventsourcerelease.Gemfile.lockand let Dependabot bump it with a cooldown: gives an auditable dependency history, but pins a library to specific versions and stops testing against the newest supported ones.bundle config set cooldown/BUNDLE_COOLDOWNin CI only: leaves localbundle installunprotected, and cannot express a per-source exemption.Link to Devin session: https://app.devin.ai/sessions/9e2aad687cd743149ff71c0a1fcfd936
Open in Devin Desktop: https://app.devin.ai/desktop/session/9e2aad687cd743149ff71c0a1fcfd936?variant=devin
Requested by: @kinyoklion