Skip to content

FE-2642 fix(billing-web): show the reason the server gave for a refused quote or subscribe - #19185

Merged
dante01yoon merged 2 commits into
jaewon/checkout-quote-stale-recoveryfrom
jaewon/fe-2642-billing-web-server-refusal
Sep 28, 2026
Merged

dante01yoon merged 2 commits into
jaewon/checkout-quote-stale-recoveryfrom
jaewon/fe-2642-billing-web-server-refusal

Conversation

@dante01yoon

@dante01yoon dante01yoon commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Why

When the server refuses a quote or a subscribe and says why, billing-web shows "We couldn't reach the billing service. Please try again." The app shows the server's sentence for the same refusal (projectFailure in subscriptionOperationView.ts). A customer who pays on billing-web should read what they would have read in the app. Found in M2 verification case B5, where a 400 TRANSITION_NOT_ALLOWED quote refusal was reported as a network failure.

Root cause

codeForHttpStatus folds every 400/422/5xx into REQUEST_FAILED and every 409 into CONFLICT, so the code no longer says what went wrong. account-core already carries the server's sentence on BillingFailure.serverMessage for hosts to show. The app shows it. billing-web's coded('failure', code) never reads it.

How

useHostedCopy gains refusal(failure). For the two status buckets (REQUEST_FAILED, CONFLICT) it shows serverMessage when the server sent one. Every code billing-web words itself (OPERATION_ALREADY_PENDING, QUOTE_STALE, auth codes) keeps its own copy. The checkout, subscription, payment-method and invoice surfaces use it wherever they hold a failure.

AS IS / TO BE

AS IS TO BE
AS IS: generic network failure copy TO BE: server refusal reason

Live against testcloud, /v1/checkout?plan=team_per_credit_monthly for a Metronome-billed team workspace: POST /api/billing/preview-subscribe answered 400 with the message "Per-credit Team plans require Stripe billing; migration from Metronome billing is not yet supported".

Plan position

# PR Scope
1 #19097 FE-3045 drop the billing-web plan grid
2-8 #19098 → #19115 FE-3046/3047/3048/3050 shared checkout (G7)
9 #19126 FE-3056 re-quote a stale quote
10 this PR FE-2642 show the server's refusal reason
graph LR
  A[#19097 grid removal] --> B[#19098..#19115 G7] --> C[#19126 stale quote] --> D[FE-2642 server refusal reason]
  style D fill:#f9d71c,color:#000
Loading

@dante01yoon dante01yoon added needs-backport Fix/change that needs to be cherry-picked to the current feature freeze branch core/1.55 Backport PRs for core 1.55 cloud/1.55 Backport PRs for cloud 1.55 labels Sep 28, 2026
@dante01yoon
dante01yoon requested a review from a team as a code owner September 28, 2026 04:10
@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: Comfy-Org/ComfyUI_frontend/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 2d01935e-531d-4a1f-bbed-6470dd49d44e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

@github-actions

github-actions Bot commented Sep 28, 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 02380de424f3857e552d6a7b21758ccb32af439b

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

📦 Bundle Size

⏳ Size data collection in progress…

@dante01yoon

Copy link
Copy Markdown
Collaborator Author

Red: 6e3ba8892d adds the tests alone; billing-web-unit fails on exactly the two new cases (https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/36376593090/job/108784662632). Green: 67b7990cc7 adds the fix.

@codecov

codecov Bot commented Sep 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...billing-web/src/components/PaymentMethodsPanel.vue 50.00% 1 Missing ⚠️
apps/billing-web/src/views/CheckoutView.vue 66.66% 0 Missing and 1 partial ⚠️
@@                           Coverage Diff                            @@
##           jaewon/checkout-quote-stale-recovery   #19185      +/-   ##
========================================================================
+ Coverage                                 84.09%   85.02%   +0.93%     
========================================================================
  Files                                      3188     2374     -814     
  Lines                                    155025   134452   -20573     
  Branches                                  40131    34375    -5756     
========================================================================
- Hits                                     130365   114318   -16047     
+ Misses                                    23011    19722    -3289     
+ Partials                                   1649      412    -1237     
Flag Coverage Δ
billing-web-unit 85.25% <83.33%> (+0.13%) ⬆️
website-unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...billing-web/src/components/SubscriptionActions.vue 92.30% <100.00%> (ø)
...s/billing-web/src/components/SubscriptionPanel.vue 95.23% <100.00%> (ø)
apps/billing-web/src/composables/useHostedCopy.ts 87.50% <100.00%> (+4.16%) ⬆️
apps/billing-web/src/views/InvoicesView.vue 100.00% <100.00%> (ø)
...billing-web/src/components/PaymentMethodsPanel.vue 87.50% <50.00%> (ø)
apps/billing-web/src/views/CheckoutView.vue 83.79% <66.66%> (+0.38%) ⬆️

... and 814 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:xhigh PR risk grade (advisory shadow check; grader-owned) label Sep 28, 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.

Reviewed the two-commit delta against its declared stacked base. The shared billing contract explicitly sanctions serverMessage for customer display; machine serverCode remains unrendered, and semantic error codes retain billing-web's localized copy. Focused billing-web validation passed: CheckoutView, InvoicesView, and SubscriptionView (69 tests), plus billing-web typecheck. CI is green and the reviewed head is 67b7990. The configured cross-model cascade was unavailable, so this verdict uses the documented lead-review fallback.

@dante01yoon
dante01yoon merged commit d94ceb3 into jaewon/checkout-quote-stale-recovery Sep 28, 2026
80 checks passed
@dante01yoon
dante01yoon deleted the jaewon/fe-2642-billing-web-server-refusal branch September 28, 2026 12:54
christian-byrne added a commit that referenced this pull request Sep 28, 2026
)

Manual backport of #19185. Preserves the 1.55 checkout implementation
while applying the server-refusal formatting behavior.\n\nVerification:
billing-web typecheck passed; focused CheckoutView suite passed (29/29).

Co-authored-by: Dante <bunggl@naver.com>
christian-byrne added a commit that referenced this pull request Sep 28, 2026
…9304)

Manual backport of #19185. Preserves the 1.55 checkout implementation
while applying the server-refusal formatting behavior.\n\nVerification:
identical patch to the locally verified core/1.55 backport (billing-web
typecheck and focused CheckoutView suite 29/29).

Co-authored-by: Dante <bunggl@naver.com>
@christian-byrne christian-byrne removed needs-backport Fix/change that needs to be cherry-picked to the current feature freeze branch core/1.55 Backport PRs for core 1.55 cloud/1.55 Backport PRs for cloud 1.55 labels Sep 28, 2026
comfy-pr-bot pushed a commit that referenced this pull request Sep 29, 2026
…9099, #19100, #19101, #19104) (#19442)

## Why

Backport of the FE-3046 billing-web shared-checkout stack to
`core/1.55`. The auto-backport bot hit cherry-pick conflicts on each of
these. The 1.55 release needs billing-web to render the same checkout as
the app, including the team invite on success.

## How

### Cherry-picked (in order, `-x`)

| PR | main squash | |
|---|---|---|
| #19098 (A) | | skipped: already on `core/1.55` via #19231 |
| #19099 (B) | | skipped: already on `core/1.55` via #19308 |
| #19100 (C) | `4bfdc8a68c` | render the subscription checkout steps
from account-ui |
| #19101 (D) | `d5cf71ce27` | billing-web renders the shared embedded
checkout |
| #19104 (E) | `592588bdd6` | team invite on the checkout success step
(squash includes #19105, #19106, #19115) |

No other prerequisite was cherry-picked.

### Conflicts and resolutions

- **C, `SubscriptionAddPaymentPreviewWorkspace.stripe.test.ts`**
(renamed from `UnifiedStripePaymentSelector.test.ts`). 1.55 mocks
telemetry with an explicit factory because it lacks #18497; main
automocks it. Took C's file as is.
`src/platform/telemetry/__mocks__/index.ts` exists on 1.55, so the
automock resolves and the test passes.
- **D, `apps/billing-web/src/views/CheckoutView.vue`**. 1.55 has #19305
(backport of #19185, show the server's refusal reason), which main does
not have yet. Kept D's checkout and kept 1.55's `refusal()` on the
subscribe failure and the quote-failure panel. Also used `refusal()` for
D's new promotion-code re-quote failure, as the upstream
`jaewon/checkout-quote-stale-recovery` stack does. Dropped the
now-unused `coded`.
- **E, `apps/billing-web/src/session/billingWebAuth.ts`**
(modify/delete). The file does not exist on 1.55 because the unified web
session work (#18880, #18881) is not backported. Deleted it and applied
E's change to what 1.55 has: `billingWebClient.ts` gains the
`BillingWebClient` type (`BillingClient & { invites }`) and `invites:
createWorkspaceInviteCommands({ transport })` on its single
`createBillingWebClient`.
- **E, `BillingShell.vue`**. Kept 1.55's
`createBillingWebClient(billingWebSessionClient())` and added E's
`provideWorkspaceInvites(client.invites)`.
- **E, `HostedSurface.vue`**. Kept 1.55's `useBillingWebSession` and
added E's `returnToHost` import (the return link now closes the tab,
from #19106).
- **E, `CheckoutView.vue`**. Kept `refusal` as above and took E's
`inviteCopy` and `useWorkspaceInvites()`.
- **E, `useSubscriptionCheckout.ts`**. Kept 1.55's `useEventListener`
import and added E's `watch` and `ToastMessageOptions`. 1.55 does not
use `onScopeDispose`, so it is not imported.
- **E, `useSubscriptionCheckout.test.ts`**. The toast mock gains E's
`remove`. 1.55 has no `removeGroup` usage, so `mockToastRemoveGroup` is
not added.

One extra commit updates a #19305 test case. For a refused subscribe
with `OPERATION_ALREADY_PENDING`, it expected the generic failure copy
because 1.55 had no copy for that code. D adds that copy, so the case
now expects billing-web's own wording, matching the upstream stack.

## Verification

- `pnpm typecheck` (app, account-core, billing-web, account-ui,
billing-contract): pass
- billing-web unit tests: 277/277
- account-ui unit tests: 224/224
- account-core unit tests: 1227/1227
- `src/platform/workspace` + `src/platform/cloud/subscription`: 2320
passed, 1 expected fail
- oxfmt, oxlint and eslint on the changed files: clean

## AS IS / TO BE

Same UI as the original PRs; see the AS IS / TO BE media in #19101 and
#19104.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
comfy-pr-bot pushed a commit that referenced this pull request Sep 29, 2026
…19099, #19100, #19101, #19104) (#19443)

## Why

Backport of the FE-3046 billing-web shared-checkout stack to
`cloud/1.55`. The auto-backport bot hit cherry-pick conflicts on each of
these. The 1.55 release needs billing-web to render the same checkout as
the app, including the team invite on success.

## How

### Cherry-picked (in order, `-x`)

| PR | main squash | |
|---|---|---|
| #19098 (A) | | skipped: already on `cloud/1.55` via #19232 |
| #19099 (B) | | skipped: already on `cloud/1.55` via #19309 |
| #19100 (C) | `4bfdc8a68c` | render the subscription checkout steps
from account-ui |
| #19101 (D) | `d5cf71ce27` | billing-web renders the shared embedded
checkout |
| #19104 (E) | `592588bdd6` | team invite on the checkout success step
(squash includes #19105, #19106, #19115) |

No other prerequisite was cherry-picked.

### Conflicts and resolutions

- **C, `SubscriptionAddPaymentPreviewWorkspace.stripe.test.ts`**
(renamed from `UnifiedStripePaymentSelector.test.ts`). 1.55 mocks
telemetry with an explicit factory because it lacks #18497; main
automocks it. Took C's file as is.
`src/platform/telemetry/__mocks__/index.ts` exists on 1.55, so the
automock resolves and the test passes.
- **D, `apps/billing-web/src/views/CheckoutView.vue`**. 1.55 has #19304
(backport of #19185, show the server's refusal reason), which main does
not have yet. Kept D's checkout and kept 1.55's `refusal()` on the
subscribe failure and the quote-failure panel. Also used `refusal()` for
D's new promotion-code re-quote failure, as the upstream
`jaewon/checkout-quote-stale-recovery` stack does. Dropped the
now-unused `coded`.
- **E, `apps/billing-web/src/session/billingWebAuth.ts`**
(modify/delete). The file does not exist on 1.55 because the unified web
session work (#18880, #18881) is not backported. Deleted it and applied
E's change to what 1.55 has: `billingWebClient.ts` gains the
`BillingWebClient` type (`BillingClient & { invites }`) and `invites:
createWorkspaceInviteCommands({ transport })` on its single
`createBillingWebClient`.
- **E, `BillingShell.vue`**. Kept 1.55's
`createBillingWebClient(billingWebSessionClient())` and added E's
`provideWorkspaceInvites(client.invites)`.
- **E, `HostedSurface.vue`**. Kept 1.55's `useBillingWebSession` and
added E's `returnToHost` import (the return link now closes the tab,
from #19106).
- **E, `CheckoutView.vue`**. Kept `refusal` as above and took E's
`inviteCopy` and `useWorkspaceInvites()`.
- **E, `useSubscriptionCheckout.ts`**. Kept 1.55's `useEventListener`
import and added E's `watch` and `ToastMessageOptions`. 1.55 does not
use `onScopeDispose`, so it is not imported.
- **E, `useSubscriptionCheckout.test.ts`**. The toast mock gains E's
`remove`. 1.55 has no `removeGroup` usage, so `mockToastRemoveGroup` is
not added.

The cloud branch takes the same resolved commits from the core backport;
they applied without further conflicts.

One extra commit updates a #19304 test case. For a refused subscribe
with `OPERATION_ALREADY_PENDING`, it expected the generic failure copy
because 1.55 had no copy for that code. D adds that copy, so the case
now expects billing-web's own wording, matching the upstream stack.

## Verification

- `pnpm typecheck` (app, account-core, billing-web, account-ui,
billing-contract): pass
- billing-web unit tests: 277/277
- account-ui unit tests: 224/224
- account-core unit tests: 1226/1226
- `src/platform/workspace` + `src/platform/cloud/subscription`: 2325
passed, 1 expected fail
- oxfmt, oxlint and eslint on the changed files: clean

## AS IS / TO BE

Same UI as the original PRs; see the AS IS / TO BE media in #19101 and
#19104.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants