Repository navigation
test(auth): cover non-401 token errors and expiry boundaries (backport #432 to stable/10) - #535
Merged
Merged
Conversation
* test(auth): cover non-401 token errors and expiry boundaries The 401 path was well covered; nothing drove a 5xx, a transport error, or a 200 whose body cannot yield a token, and nothing ever moved the clock. So the raise_for_status branch, the "missing access_token or expires_in" branch, the skew calculation and the 401 cooldown were all unasserted in both providers. These add, for the sync and async providers: a 5xx and a transport error, each asserted to be retried rather than memoized and to leave no tarpit file behind, which is the distinction that matters for a non-401; five malformed 200 bodies, asserted to cache nothing in memory or on disk; and, driven through the injected clock so they are deterministic, reuse just before the skew-adjusted expiry and a refetch just after, the clamp that keeps a lifetime shorter than the skew from landing in the past, an expired file-cached entry replaced and unlinked even when the refetch fails, a still-valid entry served without a request, and the 401 cooldown on both sides of its boundary. Checked that they bite: memoizing every status, not only 401, fails the non-401 tests; removing the skew fails the expiry tests. Closes #427 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda * chore(auth): pin the clamped expiry, and mirror the cases on the async provider From Copilot's review. The short-lifetime test asserted only that every call refetched, which removing max(0.0, ...) also satisfies -- an expiry ten seconds in the past looks identical from the outside. It now asserts the stored expiry equals the clock's current time, so the clamp the test is named after is what it checks; both sync and async fail against that mutant. The clamp and the three on-disk cache cases were sync-only, although the async provider has its own expiry calculation and its own cache loading. All four now have async counterparts. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RcVhnekJQeXnMfPhs9pYda --------- Co-authored-by: Claude <noreply@anthropic.com> (cherry picked from commit a2da089)
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The OAuth regression-test backport has no active review issues.
No open issues 🎉
What changed in this PR
Backports #432 to stable/10, extending OAuth authentication regression coverage for the gaps identified in #427 without changing production behavior.
Changes:
- Covers non-401 endpoint failures, transport errors, and malformed token responses for both sync and async providers.
- Uses an injected clock to verify token expiry, skew clamping, and 401 cooldown behavior deterministically.
- Checks valid and expired disk-cache entries, including removal when token refetch fails.
| File | Description |
|---|---|
tests/acceptance/test_pluggable_auth.py |
Adds shared test helpers and 26 cases covering OAuth failures, caching, and timing boundaries. |
Review effort: Balanced
Member
|
🤖 The changes in this PR were produced by nano-agent, an autonomous agent. Commits are authored under the operator's own git identity when one is resolvable (the human running the fleet), so they can satisfy CLA/DCO requirements; this note records that the work was generated by the agent. |
Member
|
nano-ack: issuecomment-7284899372 — Acknowledged: informational attribution note only; no code change required. |
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.
Backport of #432 to
stable/10.Generated code is restored from
stable/10and regenerated by the Backport workflow in a separatechore(gen)commit.relates to #425 #427