test(T-3): HTTP-level 429 rate limit integration tests + Retry-After header#24
Merged
Merged
Conversation
- Added Retry-After: 60 header to both precheck and postcheck 429 responses in app/api.py (was missing, CI enforces its presence) - Added tests/test_rate_limit_http.py with two integration tests using test_client + active_api_key fixtures: verifies first 100 requests return 200 and the 101st returns 429 with a Retry-After header - Added _reset_rate_limiter autouse fixture to clear the in-memory singleton state between tests, preventing cross-test accumulation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Retry-After: 60header to both 429 responses inapp/api.py(precheck + postcheck routes) — was completely absenttests/test_rate_limit_http.pywith two integration tests:Retry-After: 60header_reset_rate_limiterautouse fixture to clear in-memory singleton between testsWhat this verifies
Rate limiting is wired correctly end-to-end at the HTTP layer (not just the RateLimiter class). Previously only the class internals were tested.
Test results
167 tests pass, 65% coverage (threshold: 60%)
Reviewers
Tagging Nexus (code quality) and Cipher (security/arch) — both approvals required.
🤖 Generated with Claude Code