Repository navigation
fix(approval): stop telling permanent 403/404 details failures to retry - #548
Conversation
A 403/404 on the approval details fetch means the user lacks view:purchases or account access, so retrying cannot succeed. Say so for those statuses and keep the retry wording for network errors and 5xx. Refs #529.
|
@coderabbitai full review |
|
|
Warning Review limit reached
This review includes 4 billable files and costs up to $1.00.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 15 seconds for your next included review. View limit detailsLimit details: You’ve used all 2 included reviews currently available. Your 54 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (4)
Comment |
Keep the server message for 403 and 404, say 404 may mean not found or out of account access, leave History wording as on main, and make the e2e retry case use a retryable 500.
What
When the approval details fetch fails with 403 or 404, the approval-link toast no longer says "Open the approval link again to retry". 403 now says loading details requires the view:purchases permission and access to the purchase's account. 404 says the purchase was not found or is outside your account access (getPurchaseDetails returns 404 both for a missing execution and for an out-of-scope one). Both keep the server's error message in the text. 401, 5xx and network errors keep the retry wording.
History is untouched (history.ts is identical to main). A separate wording for History is not needed because GET /api/history already requires view:purchases (internal/api/handler_history.go:21).
Why
Since #497 the approval modal refuses to open when the details fetch fails. For an approver without access, 403/404 is permanent, so the retry advice can never work. This is the toast half of #529.
Not done (deliberately)
The backend half (a token-authorised details read) is not implemented, so #529 stays open (
Refs):GET /api/purchases/approve/{id}is already the side-effecting token approve (internal/api/router.go:163).validateApprovalTokenis unexported (internal/purchase/approvals.go:111), so a read bound to the token would need it exported.getPurchaseDetailsreturns more than the modal needs.A new authorization surface is parked as an owner decision.
Verification
npx webpack --mode production) and rannpx playwright test tests-e2e/history-action-confirmation.spec.tson Chromium locally: 13 passed. The History retry case now stubs a retryable 500, and new cases cover the approval link with 403 and 404 (wording, server message, no try again/retry text, no modal, no POST).