Upgrade gitlab-labkit to 5.9.0
What does this MR do and why?
Upgrades gitlab-labkit from 5.8.0 to 5.9.0 and synchronizes Gemfile.lock and Gemfile.next.lock.
5.9.0 adds one opt-in feature: admit_counted_values for count_distinct rate limit rules (gitlab-org/ruby/gems/labkit-ruby!404 (merged)). Nothing in gitlab-rails uses it until !268802 (merged), which caps the distinct external participants a namespace can add to Service Desk tickets per day.
What changed in 5.9.0
All code changes are in lib/labkit/rate_limit/ and come from that MR (gitlab-org/ruby/gems/labkit-ruby@v5.8.0...v5.9.0):
- New
Ruleoptionadmit_counted_values(defaultfalse). Only valid oncount_distinctrules, and rejected on:skiprules.nilmeans not set. - New
ADMIT_SCRIPTfor rules that set it. A value already in the window's set is allowed without changing the count. A new value is added only while the count is below the limit. Otherwise the request is blocked and the value is not added. peekon those rules reports the same decision ascheckwhen the identifier has thecount_distinctvalue, without writing.- Docs only: the rate limit README and doc comments describe the new mode, and
exceeded?is no longer described as "counter > limit".
Existing rules don't change. Counter, plain count_distinct, ban and :skip rules run the same scripts and report the same results as in 5.8.0.
The release also contains three commits that don't touch code: two edits to labkit-ruby's AGENTS.md (ee00b5a, d21eb29) and a CODEOWNERS change (16130c2).
Bundler cooldown
The Gemfile sets cooldown: 7, and 5.9.0 was published on 2026-11-13. The lockfiles were generated with bundle lock --conservative --update gitlab-labkit --cooldown 0, as for the 5.8.0 upgrade in !268007 (merged). Without the bypass, the normal lock works from 2026-11-20. The bypass still needs approval for this release.
References
- labkit-ruby change: gitlab-org/ruby/gems/labkit-ruby!404 (merged)
- Contract: gitlab-org/quality/tooling/labkit-spec!52 (merged)
- Consumer: !268802 (merged)
- Previous upgrade: !268007 (merged)
Screenshots or screen recordings
Not applicable: dependency upgrade with no UI change.
How to set up and validate locally
-
Run
bundle installand check thatbundle info gitlab-labkitshows 5.9.0. -
In the Rails console, check that existing rules still load and that the new option is available:
Gitlab::ApplicationRateLimiter::LabkitAdapter::SupportedRateLimits.all.size Labkit::RateLimit::Rule.new(name: 'example', limit: 1, period: 60, characteristics: [:user], count_distinct: :value, admit_counted_values: true).admit_counted_values # => true
Checklist
-
bundle lock --print | diff Gemfile.lock -is empty (with--cooldown 0) -
BUNDLE_GEMFILE=Gemfile.next bundle lock --print --lockfile Gemfile.lock | diff Gemfile.next.lock -is empty (with--cooldown 0) - Diff is 3 files:
Gemfile,Gemfile.lock,Gemfile.next.lock - The
sha256in both lockfiles matches the one RubyGems publishes for 5.9.0 -
spec/lib/gitlab/application_rate_limiter_spec.rb,spec/lib/gitlab/application_rate_limiter/andspec/lib/gitlab/middleware/labkit_rack_rate_limit_spec.rbpass locally - Decision on the cooldown bypass
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.