Skip to content

fix(backend): give the rate limiters account-unique namespace IDs - #28

Open
gcharang wants to merge 1 commit into
devfrom
fix/unique-rate-limit-namespace
Open

gcharang wants to merge 1 commit into
devfrom
fix/unique-rate-limit-namespace

Conversation

@gcharang

@gcharang gcharang commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

What

apps/backend/wrangler.jsonc moves RATE_LIMITER from namespace 1001 to 52001 (production) and from 1002 to 52002 (staging).

Why

Rate-limit namespace_ids are account-scoped. An inventory of every Worker's rate-limit bindings in the Cloudflare account (2026-10-09) found:

  • 1001: understudy-backend:RATE_LIMITER (300/60), mailflare:LOGIN_RATE_LIMIT (20/60) and wang-fei-voice-studio:VOICE_START_LIMITER (10/60)
  • 1002: understudy-backend-staging:RATE_LIMITER (300/60) and mailflare-nomixhq:LOGIN_RATE_LIMIT (20/60)

Workers that share a namespace share its counter space while declaring different limits. Keys don't overlap today, since understudy hashes its keys with telemetryPseudonym and mailflare uses scope:ip, so the conflict is latent. No other binding in the account uses 52001 or 52002. mailflare moves to 51001/51002 separately.

Effect

  • The limiter counters reset once when each environment deploys. Limits and periods are unchanged.
  • Staging picks this up through the normal deploy workflow on merge.
  • Production picks it up on its next deploy; production deploys stay disabled until the protocol-3 cutover.

Verification

  • Config-only change. wrangler.jsonc still parses, and the diff touches only the two namespace_id values.
  • Not run locally in this repo: no test reads the namespace IDs (rg for 1001/1002/namespace_id found only this file and an unrelated doc).

🤖 Generated with Claude Code

Rate-limit namespace IDs are account-scoped. 1001 was also bound by
mailflare and wang-fei-voice-studio, and 1002 by mailflare-nomixhq,
so their counters and limit configs shared a space. Production moves
to 52001 and staging to 52002; no other Worker in the account uses
either. Counters reset once on deploy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant