+5
−2
Loading
Adds an optional rule_extras: keyword to Limiter#check / #peek (and
Evaluator + the convenience wrapper). Hash flows through to one-arity
callables on Rule#limit / Rule#period via arity dispatch in
resolve_value:
- 0-arity: val.call (existing behavior, e.g. global settings)
- 1+arity: val.call(rule_extras) (new — receives the caller-supplied
hash, may be nil)
Backwards compatible: zero-arity callables and plain values are
unchanged. Existing tests pass without modification.
This is the second of two MRs needed for cohort 4 (the first is !292,
which added count_distinct: at the rule level). Cohort 4's per-namespace
limits live on namespace.namespace_settings and can't be resolved by
zero-arity callables — the callable can't reach the request context.
rule_extras: is the channel for that context.
Implements gitlab-com/gl-infra/production-engineering#29071
Co-Authored-By:
Claude Opus 4.7 (1M context) <noreply@anthropic.com>