Bump gitlab-labkit to 5.2.1 and make placeholder rate-limit rules callable

What does this MR do and why?

Bumps gitlab-labkit from 5.2.0 to v5.2.1, which validates a static rule limit and period at construction (labkit-ruby!369, merged): Rule.new raises ArgumentError for a static value under 1 on :limit and :log rules. Callables are not validated, so a callable resolving to 0 stays the supported way to express "deny all".

Two EE placeholder rules, code_suggestions_x_ray_dependencies and code_suggestions_x_ray_scan, use a static limit: 0, period: 0. They have no call site, and ApplicationRateLimiter returns early when the resolved limit or period is 0, so they never reach Redis. But SupportedRateLimits.rules builds every rule in one memoized hash with no rescue, so after the gem bump the first throttled? call would raise and every rate-limited endpoint would fail with it.

This MR switches both placeholders to -> { 0 }, which keeps their behaviour and matches how the Sidekiq DB duration rules already express a caller-supplied value, and bumps the gem in the same change so the two cannot land apart. Both lockfiles were re-resolved with bundle lock --update gitlab-labkit --conservative, so only the gitlab-labkit entries change, CHECKSUMS included. Master moved to 5.2.0 independently in the meantime, which carries labkit-ruby!370 but not the construction-time validation. The repo's lockfile consistency checks (bundle lock --print | diff) pass for both.

No behaviour change: SupportedRateLimits.resolve_value already calls zero-arity callables, so limit_for and period_for still return 0 for both keys, and the registry spec already treats them as call-site-less special cases.

References

Screenshots or screen recordings

Not applicable.

How to set up and validate locally

bin/rspec spec/lib/gitlab/application_rate_limiter/labkit_adapter/supported_rate_limits_spec.rb ee/spec/lib/ee/gitlab/application_rate_limiter/labkit_adapter/supported_rate_limits_spec.rb

In a Rails console:

Gitlab::ApplicationRateLimiter::LabkitAdapter::SupportedRateLimits.limit_for(:code_suggestions_x_ray_scan)
# => 0

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.

🤖 Generated with Claude Code

Edited by Sankalp

Merge request reports

Loading
Loading