Repository navigation
ci: Apply a Bundler cooldown to dependency resolution - #35
Merged
Merged
Conversation
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
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 |
…7 days Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
kinyoklion
marked this pull request as ready for review
August 27, 2026 16:16
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6f0f1fb. Configure here.
2 of 3 tasks
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
keelerm84
approved these changes
Aug 27, 2026
kinyoklion
added a commit
to launchdarkly/ruby-server-sdk
that referenced
this pull request
Oct 2, 2026
Resolve dependencies only to gem versions that have been public for at least seven days, using Bundler's [cooldown](https://blog.rubygems.org/2026/06/03/cooldown-let-new-gems-be-vetted.html). Equivalent of launchdarkly/openfeature-ruby-server#35. - No pinning and no lockfile: we still get the newest version matching each constraint, just not one published in the last week - `ld-eventsource` is exempt, so the exact-version bump right after one of its releases still resolves - Requires Bundler >= 4.0.13, so CI pins Bundler to 4.0.19 — except on `jruby-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 - Because that job has no cooldown, this PR also runs RuboCop serially (openfeature-ruby-server#34): `--parallel` is broken under JRuby as of RuboCop 1.90.0, which the `jruby-9.4` job picks up regardless - Contributors on Bundler 2.x are unaffected — the setting is silently ignored, so they simply resolve to the newest versions **Requirements** - [ ] I have added test coverage for new or changed functionality - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [x] I have validated my changes against all supported platform versions **Related issues** Port of launchdarkly/openfeature-ruby-server#35 and, for the RuboCop step, launchdarkly/openfeature-ruby-server#34. <details> <summary>Implementation details</summary> **How cooldown works** `source "https://rubygems.org", cooldown: 7` makes Bundler consult the per-version `created_at` timestamp in rubygems.org's v2 compact index during resolution and pass over any version younger than the window. Versions whose source does not expose `created_at` (private registries, pre-v2 entries) stay resolvable, so this never silently blocks a resolution. `--cooldown 0` / `BUNDLE_COOLDOWN=0` is 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 second `source` block for the *same* URI does not get its own value. Naming the registry's index host gives a distinct remote that can carry `cooldown: 0`: ```ruby source "https://index.rubygems.org", cooldown: 0 do gem "ld-eventsource" end ``` The gemspec requires `ld-eventsource` at an exact version, deliberately, so that bugfixes there are always tied to a new SDK version. Without the exemption, the first seven days after each `ld-eventsource` release 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.4` exception, and the RuboCop step** Bundler 4.0.19 requires Ruby >= 3.2, and JRuby 9.4 reports `RUBY_VERSION` 3.1.7: ``` ERROR: Error installing bundler: bundler-4.0.19 requires Ruby version >= 3.2.0. The current ruby version is 3.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.4` job resolves with Bundler 2, which ignores `cooldown:`. That job therefore keeps installing brand-new gem versions — including RuboCop 1.90.0, whose `--parallel` mode is broken under JRuby, which failed the first CI run on this branch: ``` 1.90.0 (using Parser 3.3.12.0, rubocop-ast 1.50.0, analyzing as Ruby 3.1, running on jruby 3.1.7) [java] ``` On JRuby the `parallel` gem cannot fork, so it runs work in threads; RuboCop 1.90 began preserving cop instances across files, and shared cop instances seeing concurrent `processed_source` values produce thousands of internal cop errors and phantom offenses. Dropping `--parallel` fixes it, and parallelism is a negligible speedup on 185 files. openfeature-ruby-server does not have the Bundler gap because its matrix is on `jruby-10.0` (Ruby 3.4); moving this repo's matrix to `jruby-10` would 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): | Runtime | Bundler | Result | | --- | --- | --- | | CRuby 3.4.10 | 4.0.19 | `rubocop 1.90.0 (available in 4 days), resolved 1.89.0 instead`, same for `aws-partitions`; 1046 examples 0 failures; RuboCop clean | | CRuby 3.2 | 4.0.19 | same cooldown skips, resolution succeeds | | CRuby 3.4.10 | 2.6.9 | resolves the same Gemfile without error, ignoring `cooldown:` | | JRuby 9.4.15 | 2.6.9 | resolves without error (no cooldown), RuboCop 1.90.0: `--parallel` → 37497 internal cop errors and 965 phantom offenses; serial → 185 files inspected, no offenses | **Alternatives considered** - Pin Bundler 4.0.19 for every job: breaks the `jruby-9.4` job outright. - `cooldown: 3` with no exemption: shorter window, and still breaks for three days after each `ld-eventsource` release. - Commit a `Gemfile.lock` and 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_COOLDOWN` in CI only: leaves local `bundle install` unprotected, and cannot express a per-source exemption. </details> 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 <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > Adds a **seven-day cooldown** on the primary RubyGems source so `bundle install` prefers gem versions that have been public for at least a week, without pinning or committing a lockfile. > > **`ld-eventsource`** is pulled through a second source (`index.rubygems.org`) with **`cooldown: 0`**, so first-party releases can still resolve immediately when the gemspec bumps an exact version. > > CI’s shared Ruby setup now installs **Bundler 4.0.19** on CRuby (needed for cooldown) and keeps **Bundler 2** on **`jruby-9`** matrix jobs, where Ruby 3.1 cannot run Bundler 4 and the cooldown setting is ignored anyway. > > **CONTRIBUTING.md** documents the cooldown, the `ld-eventsource` exemption, the Bundler 4 requirement, and **`--cooldown 0`** for emergency resolution. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit e9313b8. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.
launchdarkly-server-sdkis exempt, so a constraint bump right after our own release still resolvessetup-rubystepRequirements
Related issues
Follow-up to #34: the RuboCop 1.90.0 breakage that PR works around would have been held out of CI by this cooldown.
Implementation details
How it 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:Without this,
cooldown: 7fails resolution outright today: our gemspec requireslaunchdarkly-server-sdk ~> 8.15, 8.15.0 was published 2026-08-20, and no older version satisfies the constraint, so every candidate is inside the window.Exempting it is also the right policy: we publish that gem, so it is not the untrusted-third-party case cooldown defends against.
Verification
Ran locally in containers against this branch (no lockfile, Bundler 4.0.19):
rubocop 1.90.0 (available in 6 days), resolved 1.89.0 instead;launchdarkly-server-sdk 8.15.0resolved; 73 examples 0 failures; 15 files inspected, no offenses-javaplatform gem through the exempt remoteAlso confirmed Bundler 2.6.9 (Ruby 3.4's default) resolves the same Gemfile without error, ignoring the
cooldown:option.Alternatives considered
cooldown: 3with no exemption: shorter window, and still breaks for three days after each of our own SDK releases.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 the CI workflow only: leaves localbundle installunprotected, and cannot express a per-source exemption.bundle-safe-updategem (pre-dates Bundler's feature): a low-adoption single-maintainer dependency, which is itself supply-chain risk.Link to Devin session: https://app.devin.ai/sessions/47847578334a4bd497c24e3859630cd2
Requested by: @kinyoklion
Note
Overview
CI and local installs now resolve gems from rubygems.org only if the version has been published for at least seven days, using Bundler’s
cooldownon the mainGemfilesource—without adding a lockfile or pinning versions beyond existing constraints.launchdarkly-server-sdkis pulled through a second source (index.rubygems.orgwithcooldown: 0) so first-party releases still resolve immediately; the PR description notes this is required because the current~> 8.15constraint would otherwise fail resolution.GitHub Actions pins Bundler 4.0.19 on
ruby/setup-rubyin the shared CI composite action and the Windows workflow so cooldown is honored in CI. CONTRIBUTING.md documents the behavior, the Bundler 4.0.13+ requirement, and--cooldown 0for urgent updates.Reviewed by Cursor Bugbot for commit a2cca54. Bugbot is set up for automated code reviews on this repo. Configure here.