Repository navigation
FE-3176 test(billing-web): a cancel that throws still lets the held Pay finish - #20015
Conversation
🌾 Fallow: ✅ PassedFallow audits the diff for duplication, complexity and dead code. It gates on new findings only, so when the audit completes, a red is something this PR introduced or moved — never inherited backlog. A red can also mean the audit itself did not finish; the details below say which happened. No new findings in the changed files. Reproduce locally# the base the gate compared against
npx fallow audit --root . --quiet --format json \
--changed-since b16e68a9188a82f3d9089c3ca5542146e769f71b
Full docs: ADR-DEVEX-LINT-0015 🧩 Custom Nodes Ecosystem Matrix: 🟡 Withheld — could not measureExecutes the frontend JS of every registry pack that ships any, against this change, in both renderers. The eight This candidate changes nothing the matrix measures, so every expensive stage was skipped. Reproduce locally# build one shard's fixture, then run it
python3 scripts/registry-census/build_matrix.py --shard 1/4
MATRIX_RENDERER=vue MATRIX_VUE=1 \
npx vitest run --config vitest.matrix.config.mts
Full docs: scripts/registry-census/README.md |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (3)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughAdds a checkout test that checks whether cancellation remains available and recovery is requested after challenge cancellation fails. The test then resolves the pending payment successfully and checks for the Success heading. ChangesCheckout challenge recovery
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~5 minutes Change: Other Merge Risk: ⚪ Minimal · up to The new test covers cancellation recovery without changing checkout behavior. No actionable issue remains before merge. 🚥 Pre-merge checks | ✅ 7✅ Passed checks (7 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #20015 +/- ##
==========================================
+ Coverage 84.88% 85.76% +0.88%
==========================================
Files 3449 2519 -930
Lines 165704 141209 -24495
Branches 45207 38415 -6792
==========================================
- Hits 140657 121108 -19549
+ Misses 23087 19581 -3506
+ Partials 1960 520 -1440
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
christian-byrne
left a comment
There was a problem hiding this comment.
Approved at exact head d48cd9c359c852466def864ba4210ce774f68f52.
Full context for agent readers
The focused regression test proves a throwing cancellation releases its own UI state without rejecting or stranding the held payment, then observes the payment completing successfully.
…ed and show coded quote refusals (Comfy-Org#20115) ## Summary On the full-page checkout (`billing_web_checkout_ui = full_page`), reopening a checkout link after "You're all set" now lands on Already completed, and a preview the server refuses with a coded 4xx ends on that refusal (or Plan not available for a Team link without its commit stop) instead of "Couldn't load your checkout · REQUEST_FAILED". Fixes FE-3203 ## Why QA on testcloud (2026-10-04) found two links that end on the generic load failure with Try again, which can never succeed: - **E2.** Subscribe, reach "You're all set", then open the same `/v1/checkout?...` link in the same tab. The tab still remembers the settled operation, but the page shows `REQUEST_FAILED`. Preview answers 400 `TRANSITION_NOT_ALLOWED` "the selected plan is already the current plan". Expected: Already completed (DES-1212, QA case E2). - **G7.** A Team link without a commit stop (`plan=team_per_credit_monthly`, no `team_credit_stop_id`). Preview answers 400 `TRANSITION_NOT_ALLOWED` "team_credit_stop_id is required for the per-credit Team plan". Expected: Plan not available, with View plans on the Team tab. ## Root cause The page already modelled the revisit. Reconciliation reads the remembered settled operation back (`recover({ includeSettled: true })`) into `resolving.settled`, and the reducer turns a quote refusal over it into Already completed. But it only recognised a refusal as a 200 preview with `allowed: false`, which is what the e2e mock answered. The real Cloud refuses these links with a 400 carrying its own code. `captureEvent` mapped every quote error other than `INVALID_PLAN` to `{ type: 'unavailable', code: quoted.code }`, and `quoted.code` is the transport bucket (`codeForHttpStatus(400)` is `REQUEST_FAILED`). So the server's code and message were dropped, and `unavailable` ends on Couldn't load whatever the page had settled. The ordering lead does not apply: `readCapture` dispatches only after reconciliation settles, and a terminal page already ignores stop events. The same mapping explains G7. The Team-without-stop rule (`quotedStop`) only ran on a successful quote whose `new_plan.tier` was `TEAM`, and the real server never returns one for that link. ## How - `useFullPageCheckout`: `quoteFailureEvent` sorts a failed preview. `INVALID_PLAN` stays Plan not available (`retired`). A 4xx that carries a server code is the server's refusal: if the link names no stop and the catalog lists the slug as a `TEAM` plan, it is Plan not available (`team_stop_missing`), and otherwise it is `notAllowed` with `server: { code, message }`. Everything else (5xx, network, no code) stays `unavailable`, so Couldn't load and Try again are unchanged. - `checkoutPage` reducer: `notAllowed` takes an optional `ServerRefusal`. Over a settled operation it is Already completed, as before. Otherwise it is `{ kind: 'refused', server }`. A terminal page still ignores every stop event, so a later refusal cannot replace Already completed. - `endingOf` / `CheckoutEnding.vue`: a server refusal renders Checkout not available with the server's code as the support reference and the server's sentence as the body. - The Team check uses the catalog's `tier`, the same server fact `quotedStop` used, rather than parsing the slug. The link alone cannot say a slug is a Team plan. - Flag-off `CheckoutView.vue` and top-up are untouched. ## Red-green verification | Commit | CI | Purpose | | --- | --- | --- | | `test(billing-web): add failing tests ...` (9f37d89) | Red: [billing-web-unit](https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/37230224860), [billing-web-e2e](https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/37230224891) | E2, G7 and coded refusal end on `REQUEST_FAILED` | | `fix(billing-web): land a finished checkout ...` (38e5c9c) | Green: [billing-web-unit](https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/37230573193), [billing-web-e2e](https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/37230573125) | Same tests pass | The red commit holds the view-level and e2e tests, which use only existing types. The reducer and `endingOf` table cases name the new `ServerRefusal` shape, so they would not typecheck before the fix. They ship in the fix commit. ## Testing - `pnpm exec vitest run src/checkout src/views/FullPageCheckoutView.test.ts src/views/FullPageCheckoutView.journey.test.ts src/views/FullPageTopupView.test.ts src/components/fullPage` (in `apps/billing-web`): 885 passed. - `pnpm exec playwright test` (billing-web e2e, all specs): 134 passed. New specs in `e2e/full-page-endings.spec.ts` mock the real 400 bodies: E2 revisit with `page.goto` of the same link, G7 link with a catalog Team plan, and a coded refusal with nothing settled. - `pnpm --filter @comfyorg/billing-web typecheck`: clean. ## Screenshots Captured from the billing-web e2e build with the real 400 bodies mocked. | | AS IS | TO BE | | --- | --- | --- | | E2: reopen after success | <img width="360" alt="fe3203-asis" src="https://github.com/user-attachments/assets/2496980d-a87f-496b-8164-96b7f0ce536b" /> | <img width="360" alt="fe3203-e2-tobe" src="https://github.com/user-attachments/assets/4cc1097e-3a3a-49da-9fab-431cea0fd6da" /> | | G7: Team link without stop | <img width="360" alt="fe3203-asis" src="https://github.com/user-attachments/assets/2496980d-a87f-496b-8164-96b7f0ce536b" /> | <img width="360" alt="fe3203-g7-tobe" src="https://github.com/user-attachments/assets/1ab7e355-1197-41e2-9493-0c2795c50074" /> | | Coded refusal, nothing settled | <img width="360" alt="fe3203-asis" src="https://github.com/user-attachments/assets/2496980d-a87f-496b-8164-96b7f0ce536b" /> | <img width="360" alt="fe3203-refusal-tobe" src="https://github.com/user-attachments/assets/22c0fe00-25f3-4b96-92a1-9db2ad5b6389" /> | All three AS IS cases rendered the same Couldn't load screen. ## Review focus - The refusal screen shows the server's code (`TRANSITION_NOT_ALLOWED`) as the support reference and the server's message as the body. `BillingFailure.serverCode` says "never render it". It is rendered here only as the support reference, the same way a capability denial shows its reason code. Say if you'd rather show a fixed code. - A settled operation plus a 5xx preview still ends on Couldn't load. A 5xx cannot tell us whether this link is the one that settled. ## Where this sits in the plan Milestone 3: full-page checkout on billing-web behind `billing_web_checkout_ui`. | Item | Status | | --- | --- | | FE-3067, FE-3018..FE-3022, FE-3072 | Merged | | FE-3176 (Comfy-Org#19933), FE-3177 (Comfy-Org#19931), Comfy-Org#20015 | Merged | | QA run 2026-10-04 | Found FE-3203..FE-3208 | | **FE-3203 (this PR)** | **In review** | | FE-3204..FE-3208 | Todo | | M3-9 rollout | Todo | | M3-10 cleanup | Todo | ```mermaid flowchart LR base["FE-3067, FE-3018..3022, FE-3072"] --> f3176["FE-3176 PR 19933"] base --> f3177["FE-3177 PR 19931"] base --> p20015["PR 20015"] f3176 --> qa["QA run 2026-10-04"] f3177 --> qa p20015 --> qa qa --> f3203["FE-3203 this PR"] qa --> rest["FE-3204..3208"] f3203 --> rollout["M3-9 rollout"] rest --> rollout rollout --> cleanup["M3-10 cleanup"] style f3203 stroke-width:3px ```
Summary
Adds one test: after a cancel that throws, Cancel payment is offered again, the payment is re-read, and the held Pay still lands on "You're all set".
Why
Main's test for a throwing cancel only checks that Cancel payment comes back. Nothing proves
pay()is not left awaiting a rejected promise.How
One test in the payment authentication describe. Mutation-checked: removing the throw mapping in
useFullPageCheckout.tsturns it red.AS IS / TO BE
Test-only change, no UI difference.
Testing
pnpm --dir apps/billing-web exec vitest run src/views/FullPageCheckoutView.test.ts: 134 passed. With the.catchremoved: the new test and the existing throw test fail.Follow-up to #19933 (FE-3176).