Files
tech-log-backend/docs/superpowers/plans/2026-07-28-redis-distributed-rate-limit.md
T

46 lines
2.2 KiB
Markdown

# Redis Distributed Rate-Limit Implementation Plan
> Repository commit policy is human-only. Do not stage, commit, amend or push.
### Task 1: Shared edge rate-limit contract
- [x] Write RED contract/policy tests in `shared-contract`.
- [x] Add bounded request, algorithm parameters, policy, decision, outcome and port types.
- [x] Reject unsupported dedup/failure claims and unsafe fixed-point arithmetic.
- [x] Verify the shared contract without Redis/Spring types.
### Task 2: Structured Redis program execution
- [x] Write RED tests for MULTI reply arity/status/ASCII integer bounds and `NOSCRIPT`.
- [x] Add bounded structured `EVALSHA`/`EVAL` command support without changing scalar primitives.
- [x] Add exact catalog descriptors and resource digests for three rate programs.
### Task 3: Three atomic algorithms and semantic provider
- [x] Implement fixed-window Lua and golden vectors.
- [x] Implement sliding-counter Lua with conservative fixed-point arithmetic.
- [x] Implement token-bucket Lua with saturation and exact ceiling retry.
- [x] Add canonical private keys, policy lookup and typed failure mapping.
- [x] Prove denial does not consume quota and revision changes physical state.
### Task 4: Dedicated runtime and explicit composition
- [x] Add strict `app.rate-limit` settings and disabled-zero-side-effect configuration.
- [x] Use a dedicated coordination runtime rather than cache Redis beans/settings.
- [x] Add exact environment registry/application configuration entries.
- [x] Keep readiness at standalone provider R1.
### Task 5: Verification and review
- [x] Run shared/Redis/bootstrap focused checks.
- [x] Run architecture/dependency/env/diff gates.
- [ ] Run the public-path gate with the final combined change set.
- [x] Run an explicit real Redis lane when a service is available.
- [x] Request independent spec and quality review.
The Redis 7.4 service lane executes the exact-boundary admission after a denied non-consuming
request for all three algorithms, excessive clock-regression state immutability, token refill
remainder carry, malformed hash classification, cache NX, and observation-token compare-replace.
The program manifests therefore declare 7.4 as the minimum qualified version until a lower-version
service lane exists.