-
Notifications
You must be signed in to change notification settings - Fork 4
AuthTests: TokenRepository resilience tests #263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
6b5ab36 to
8d40b4c
Compare
e0b49ea to
e7e1e32
Compare
8d40b4c to
0480a2f
Compare
0480a2f to
ae28229
Compare
237e28f to
45b76c5
Compare
c11afad to
55b0998
Compare
022ca36 to
232cc69
Compare
…401, store failures with XCTExpectFailure, cooldown TODO)
The new coalescing + transient error handling provides implicit cooldown: - First call on 503: attempts refresh, returns stored credentials - Second call: credentials not expired, returns cached without refresh This is improved behavior that prevents hammering the server after transient failures. Updated test name and assertions to verify this implicit cooldown via stored credentials pattern. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
232cc69 to
bb71731
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds comprehensive resilience tests for TokenRepository to validate behavior under edge cases like rate limiting, concurrent refresh operations, persistence failures, and repeated transient errors. These tests document current behavior and help prevent forced logouts or session breakage when access tokens expire quickly.
Key Changes:
- Introduces
TokenRepositoryResilienceTestscovering rate limits, concurrent refresh coalescing, persistence failures, and transient error handling - Adds specialized test doubles (
FailingFakeTokensStore,SequencedFakeTokenService) for deterministic failure scenarios - Documents current throwing behavior for persistence failures to guide future soft-fail improvements
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Why
Strengthen coverage for scenarios that historically lead to forced logouts or broken sessions when access tokens expire quickly: rate limiting, concurrent refresh, persistence failures, and repeated transient errors.
What
TokenRepositoryResilienceTestscovering:FailingFakeTokensStore,SequencedFakeTokenService) to drive the scenarios deterministically.Notes
auth/refresh-coalescing(RefreshCoordinator injection).Tests
swift test --filter TokenRepositoryResilienceTests