Preserve recoverable WordPress login exchange failures - #122
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped, preserves fail-closed behavior for permanent rejections, and is backed by targeted tests that verify retryability, header preservation, and replay rejection.
Pull request overview
Updates the backend WordPress login code-exchange path to treat certain upstream HTTP failures as transient (retryable) rather than permanently rejecting the login, while preserving Retry-After and ensuring pending login state can be recovered and retried.
Changes:
- Classify WordPress exchange HTTP
429/502/503/504responses as transient, returning the same status code (andRetry-Afterwhen present) instead of converting to a permanent400. - Extend callback transient-failure handling to restore pending login state for
429in addition to existing gateway statuses. - Add end-to-end identity endpoint tests that exercise the real exchange adapter against synthetic HTTP responses, validating retry completion and replay rejection.
File summaries
| File | Description |
|---|---|
| backend/app/main.py | Preserves transient upstream exchange failures (including 429) and forwards Retry-After while keeping pending login state retryable. |
| backend/tests/test_identity_endpoints.py | Adds tests covering transient vs permanent upstream WordPress exchange responses, including Retry-After preservation and state replay protection. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Scope
Fix one verified identity-exchange error-handling defect. Exactly two files change:
backend/app/main.pyandbackend/tests/test_identity_endpoints.py.Retry-Afterheader and restore pending login state for 429 as well as the existing transient gateway statuses.Reproduction and validation
New tests exercise the real exchange adapter against synthetic HTTP responses, rather than replacing it with an already-classified exception.
git diff --checkand the tracked-secret boundary check passed.The uploaded tree is exactly
47cb2799f438a822f74728bd9e3e0431ea39e96e, matching tested local commit0dcfdb580a0c6b778e1911aede19a59ff8949e05. The GitHub-created commit has different metadata but identical source contents.Release boundary
Draft for review only. Do not merge or deploy as part of opening this PR. This proves a recoverability defect and its local repair; it does not establish that production joint WordPress/CalorieApp sign-in is restored. A compatible rollout and a successful live completion check remain necessary.