Skip to content

[backport cloud/1.55] FE-2642 show server refusal reason (#19185) - #19304

Merged
christian-byrne merged 1 commit into
cloud/1.55from
backport-19185-to-cloud-1.55
Sep 28, 2026
Merged

christian-byrne merged 1 commit into
cloud/1.55from
backport-19185-to-cloud-1.55

Conversation

@christian-byrne

Copy link
Copy Markdown
Contributor

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

…ed quote or subscribe (#19185)

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.

- Fixes FE-2642 (part 2; part 1, the per-credit Team cards, went away
with the plan grid in #19097)

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

`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 |
|---|---|
| <img width="450" alt="AS IS: generic network failure copy"
src="https://github.com/user-attachments/assets/06659a2b-ee07-479f-b0a5-24e2a805b036"
/> | <img width="450" alt="TO BE: server refusal reason"
src="https://github.com/user-attachments/assets/6880f67d-e73e-43bc-a7b0-175fd1d0ccdd"
/> |

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

| # | 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** |

```mermaid
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
```
@christian-byrne
christian-byrne requested review from a team and dante01yoon as code owners September 28, 2026 22:08
@coderabbitai

coderabbitai Bot commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Ignore keyword(s) in the title.

⛔ Ignored keywords (2)
  • [release]
  • [backport

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: Team

Run ID: f8d6fa68-1d29-4396-8c1a-f893acca18bc

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 d7b8f11d2f6b7429ededc361c1fe5e510a4dfd84

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…

@christian-byrne christian-byrne added the backport Backporting a PR onto a release candidate label Sep 28, 2026
@codecov

codecov Bot commented Sep 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...billing-web/src/components/PaymentMethodsPanel.vue 50.00% 1 Missing ⚠️
@@              Coverage Diff              @@
##             cloud/1.55   #19304   +/-   ##
=============================================
  Coverage              ?   87.65%           
=============================================
  Files                 ?       34           
  Lines                 ?      713           
  Branches              ?      177           
=============================================
  Hits                  ?      625           
  Misses                ?       43           
  Partials              ?       45           
Flag Coverage Δ
billing-web-unit 87.65% <90.90%> (?)

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%> (ø)
apps/billing-web/src/views/CheckoutView.vue 86.40% <100.00%> (ø)
apps/billing-web/src/views/InvoicesView.vue 100.00% <100.00%> (ø)
...billing-web/src/components/PaymentMethodsPanel.vue 87.50% <50.00%> (ø)
🚀 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.

@christian-byrne
christian-byrne merged commit 9303afb into cloud/1.55 Sep 28, 2026
87 checks passed
@christian-byrne
christian-byrne deleted the backport-19185-to-cloud-1.55 branch September 28, 2026 22:23
@github-actions github-actions Bot added the risk:xhigh PR risk grade (advisory shadow check; grader-owned) label Sep 28, 2026
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>
comfy-pr-bot pushed a commit that referenced this pull request Sep 29, 2026
…cribe quote the way the app does (#19482)

## Why

When the server refuses a subscribe because the quote went stale (400
`SUBSCRIPTION_QUOTE_STALE`), billing-web shows "We couldn't reach the
billing service" and keeps the old quote, so every retry is refused the
same way. The embedded checkout already re-quotes.

## Root cause

`issueSubscribe` in
`packages/account-core/src/core/billing/subscriptionCommands.ts` did not
map the stale-quote code, and `CheckoutView.pay` had no branch for it.

## How

The SDK maps a 4xx `SUBSCRIPTION_QUOTE_STALE` to `QUOTE_STALE`.
`CheckoutView.pay` clears `quoteIsCurrent`, re-quotes, and shows "Your
quote changed" or "couldn't be refreshed" copy.

## AS IS / TO BE

Same as #19126, which carries the AS IS description and the TO BE test
evidence. This backport does not change behavior relative to main.

Backport of #19126 to `cloud/1.55`. Cherry-picked with `-x` from
e352169.

## Conflicts

One file, `apps/billing-web/src/views/CheckoutView.vue`, two hunks. Both
took the #19126 side.

- `useHostedCopy()` destructure: 1.55 had `{ refusal }` (FE-2642,
backported in #19304). #19126 needs `coded` back for the stale-quote
copy, so it is `{ coded, refusal }`.
- `pay()`: 1.55 ends with `submitFailure.value = refusal(result)`. The
`QUOTE_STALE` branch (clear `quoteIsCurrent`, re-quote, show "Your quote
changed" or "couldn't be refreshed") is inserted before it, as on main.

The FE-2642 parts of the squash (`useHostedCopy.refusal`, its call sites
in the panels and `InvoicesView`, and the "shows the reason the server
gave for a refused quote" test) were already on `cloud/1.55` and applied
as no-ops. The SDK mapping in `subscriptionCommands.ts` (`refusedWith`
for a 4xx `SUBSCRIPTION_QUOTE_STALE`, `refusedWhilePending` otherwise),
the two locale strings, and the new tests applied cleanly.

## Verification

- `pnpm typecheck` (all five stages) passes.
- billing-web vitest: 23 files, 280 tests pass, including "re-quotes a
stale quote and pays against the replacement" and "keeps Confirm closed
on the stale quote when its refresh fails".
- account-core vitest: 68 files, 1234 tests pass, including the 400 →
`QUOTE_STALE` / 503 → `REQUEST_FAILED` table.
- eslint, oxlint, and oxfmt clean on the changed files.

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

backport Backporting a PR onto a release candidate risk:xhigh PR risk grade (advisory shadow check; grader-owned)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants