Skip to content

FE-3176 test(billing-web): a cancel that throws still lets the held Pay finish - #20015

Merged
dante01yoon merged 1 commit into
mainfrom
jaewon/fe-3176-cancel-throw-pay-lands
Oct 3, 2026
Merged

dante01yoon merged 1 commit into
mainfrom
jaewon/fe-3176-cancel-throw-pay-lands

Conversation

@dante01yoon

Copy link
Copy Markdown
Collaborator

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.ts turns 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 .catch removed: the new test and the existing throw test fail.

Follow-up to #19933 (FE-3176).

@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

🌾 Fallow: ✅ Passed

Fallow 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 measure

Executes the frontend JS of every registry pack that ships any, against this change, in both renderers. The eight ecosystem-matrix shard checks are a harness self-test; the pack verdict is matrix-verdict.

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

@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (3)
docs/guidance/testing-principles.md — configured
docs/guidance/typescript.md — configured
src/AGENTS.md — auto-discovered

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: Comfy-Org/ComfyUI_frontend/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 66aced36-8f0b-4e70-9873-4267e6ce7a0e
📥 Commits

Reviewing files that changed from the base of the PR and between b16e68a and d48cd9c.

📒 Files selected for processing (1)
  • apps/billing-web/src/views/FullPageCheckoutView.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

Adds 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.

Changes

Checkout challenge recovery

Layer / File(s) Summary
Verify challenge cancellation recovery
apps/billing-web/src/views/FullPageCheckoutView.test.ts
Adds a test that checks Cancel payment availability and recovery after cancellation rejects, then verifies that a successful payment result leads to the Success heading.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to d48cd

The new test covers cancellation recovery without changing checkout behavior. No actionable issue remains before merge.

🚥 Pre-merge checks | ✅ 7
✅ Passed checks (7 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: a test for a throwing cancel that does not prevent the held Pay from finishing.
Description check ✅ Passed The description explains the test, its purpose, implementation, and reported validation. It omits the template’s Changes and Review Focus headings, but the key information is present.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
End-To-End Regression Coverage For Fixes ✅ Passed The PR title and commit subject use “test,” not bug-fix language. The PR description says this is a test-only change with no UI difference. The required bug-fix signal is absent, so the check does not…
Website End-To-End Regression Coverage ✅ Passed No website runtime files changed. The PR changes only apps/billing-web/src/views/FullPageCheckoutView.test.ts, which is outside apps/website/src/ and apps/website/public/. The website end-to-end…
Adr Compliance For Entity/Litegraph Changes ✅ Passed The PR changes only apps/billing-web/src/views/FullPageCheckoutView.test.ts. It does not modify src/lib/litegraph/, src/ecs/, or graph-entity files, so this check does not apply.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 3, 2026

Copy link
Copy Markdown

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     
Flag Coverage Δ
billing-web-unit 92.15% <ø> (ø)
website-unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.
see 930 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added the risk:medium PR risk grade (advisory shadow check; grader-owned) label Oct 3, 2026

@christian-byrne christian-byrne left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@dante01yoon
dante01yoon added this pull request to the merge queue Oct 3, 2026
Merged via the queue into main with commit b2f2af2 Oct 3, 2026
91 checks passed
@dante01yoon
dante01yoon deleted the jaewon/fe-3176-cancel-throw-pay-lands branch October 3, 2026 22:11
ksanislo pushed a commit to ksanislo/ComfyUI_frontend that referenced this pull request Oct 5, 2026
…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
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:medium PR risk grade (advisory shadow check; grader-owned)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants