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 Rule option admit_counted_values (default false). Only valid on count_distinct rules, and rejected on :skip rules. nil means not set.
  • New ADMIT_SCRIPT for 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.
  • peek on those rules reports the same decision as check when the identifier has the count_distinct value, 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

Screenshots or screen recordings

Not applicable: dependency upgrade with no UI change.

How to set up and validate locally

  1. Run bundle install and check that bundle info gitlab-labkit shows 5.9.0.

  2. 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 sha256 in 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/ and spec/lib/gitlab/middleware/labkit_rack_rate_limit_spec.rb pass 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.

Merge request reports

Loading
Loading