Repository navigation
[backport core/1.55] FE-2642 show server refusal reason (#19185) - #19305
Conversation
…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 ```
|
Important Review skippedIgnore keyword(s) in the title. ⛔ Ignored keywords (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: Comfy-Org/ComfyUI_frontend/.coderabbit.yaml Review profile: ASSERTIVE Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
🌾 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 069c9407b98ad56e97e24fd8f7588dc762c91e7b
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 📦 Bundle Size
|
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## core/1.55 #19305 +/- ##
=============================================
+ Coverage 84.64% 84.65% +0.01%
=============================================
Files 2301 2335 +34
Lines 132229 132942 +713
Branches 35416 35593 +177
=============================================
+ Hits 111920 112545 +625
- Misses 19985 20028 +43
- Partials 324 369 +45
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 28 files with indirect coverage changes 🚀 New features to boost your workflow:
|
…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>
…ribe quote the way the app does (#19481) ## 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 `core/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 #19305). #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 `core/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, 1235 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>
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).