Skip to content

feat(BA-7365): key the rate limit counter by user id - #13778

Draft
jopemachine wants to merge 2 commits into
feature/BA-7364-auth-response-user-identityfrom
feature/BA-7365-user-keyed-rate-limit-counter
Draft

feat(BA-7365): key the rate limit counter by user id#13778
jopemachine wants to merge 2 commits into
feature/BA-7364-auth-response-user-identityfrom
feature/BA-7365-user-keyed-rate-limit-counter

Conversation

@jopemachine

@jopemachine jopemachine commented Aug 14, 2026

Copy link
Copy Markdown
Member

📚 Stacked PRs

This PR is part of a 5-PR stack. Merge in order:

  1. ⬇️ feat(BA-7364): deliver the login user id in the auth response #13777feat(BA-7364): deliver the login user id in the auth response
  2. 👉 feat(BA-7365): key the rate limit counter by user id #13778feat(BA-7365): key the rate limit counter by user id ← you are here
  3. ⬇️ feat(BA-7362): move the per-user API rate limit to the user resource policy #13779feat(BA-7362): move the per-user API rate limit to the user resource policy
  4. ⬇️ feat(BA-7363): publish the per-user rate limit to the shared Redis DB #13784feat(BA-7363): publish the per-user rate limit to the shared Redis DB
  5. ⬇️ feat(BA-7365): add a per-user rate limit middleware to the web server #13771feat(BA-7365): add a per-user rate limit middleware to the web server

Only the final tip (#13771) is guaranteed to build / pass CI; intermediate PRs are logical slices for reviewability.

Summary

  • ValkeyRateLimitClient.execute_rate_limit_logic() and get_rolling_count() take a UserID and build the counter key (user.<user_id>) themselves, so callers no longer decide the key format.
  • The manager's rate limit middleware counts against the authenticated user instead of the access key, so holding multiple keypairs no longer multiplies a user's allowance.
  • KeyPair.rolling_count in the legacy GraphQL schema resolves against the same per-user counter.

Relates to BA-7365.

@jopemachine
jopemachine requested a review from a team as a code owner August 14, 2026 05:57
@github-actions github-actions Bot added size:M 30~100 LoC comp:manager Related to Manager component comp:common Related to Common component labels Aug 14, 2026
jopemachine added a commit that referenced this pull request Aug 14, 2026
@jopemachine
jopemachine force-pushed the feature/BA-7365-user-keyed-rate-limit-counter branch from 3f23516 to ef4b9b6 Compare August 14, 2026 05:58
@jopemachine
jopemachine marked this pull request as draft August 14, 2026 09:12
jopemachine added a commit that referenced this pull request Aug 14, 2026
@jopemachine
jopemachine force-pushed the feature/BA-7365-user-keyed-rate-limit-counter branch from ef4b9b6 to 0881fa0 Compare August 14, 2026 09:25
jopemachine added a commit that referenced this pull request Aug 14, 2026
@jopemachine
jopemachine force-pushed the feature/BA-7365-user-keyed-rate-limit-counter branch from 0881fa0 to 1b8bfd3 Compare August 14, 2026 09:34
@jopemachine
jopemachine force-pushed the feature/BA-7364-auth-response-user-identity branch from 1c8bb74 to b581df7 Compare August 14, 2026 09:37
jopemachine and others added 2 commits August 14, 2026 23:06
`execute_rate_limit_logic()` and `get_rolling_count()` take a `UserID` and
build the counter key themselves, and the manager's rate limit middleware
counts against the authenticated user instead of the access key, so holding
multiple keypairs no longer multiplies a user's allowance.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:common Related to Common component comp:manager Related to Manager component size:M 30~100 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant