Repository navigation
[backport cloud/1.60] fix(billing): hide auto top-up while billing is paused (#23323) - #23340
Conversation
## Summary Per [DES-1240](https://linear.app/comfyorg/issue/DES-1240) (Not available row) and Alex's call in the #23278 review thread, auto top-up is hidden with no Turn on while a plan is paused. Cloud still offered Turn on for `auto_top_up_setup` frozen with `billing_paused`; Platform already offered no action. - **Why:** auto top-up can't charge while billing is paused. It comes back as it was once the payment goes through. - **Root cause:** `canSetUpAutoTopUp` only treated `payment_past_due` as paused. The account-ui card hid only `state: 'unavailable'`. - **How:** account-core adds `isAutoTopUpNotAvailable(setup)`. It returns true when setup is `unavailable`, or `frozen` for `payment_past_due` or `billing_paused`. - `canSetUpAutoTopUp` uses it, which covers the top-up dialog's Set up offer and the Add credits suggestion. - The account-ui `BillingAutoTopUpCard` hides on it, and so does the card-viewed event. - `TopUpAutoTopUpCard` reads `canSetUpAutoTopUp` instead of its inline copy. This is the same swap as #23278, so whichever PR lands second needs a trivial rebase. - Server facts: the rule renders the served setup state and reason. It does not combine them with role, plan or tier. - The 1.60 code under `legacy160` is unchanged. | | AS IS | TO BE | |---|---|---| | setup frozen, `billing_paused` | card shows Off · Turn on ↗; dialog offers Set up | card hidden; no Set up offer | | setup frozen, `payment_past_due` | card shown; no Set up offer | card hidden; no Set up offer | ```mermaid graph LR A[#23278 platformAutoTopUpPath] -. touches same lines of TopUpAutoTopUpCard .- B[this PR] ``` ## Verification - `vitest`: account-core `autoTopUpCard` and `addCredits` (230 passed); account-ui `BillingAutoTopUpCard` (19 passed); app `TopUpAutoTopUpCard`, `useAutoTopUpCardSection`, `useAutoTopUpSetupOffer` (71 passed). - Mutation check: I dropped `billing_paused` from the rule and re-ran. The new card case and the new `TopUpAutoTopUpCard` case both failed, then passed once I restored it. - Not checked against a live backend in the paused state. (cherry picked from commit 4d07c59) # Conflicts: # packages/account-core/src/core/billing/billingTab/autoTopUpCard.test.ts # packages/account-core/src/core/billing/billingTab/autoTopUpCard.ts # packages/account-core/src/core/billing/index.ts # packages/account-ui/src/billing/tab/BillingAutoTopUpCard.test.ts # packages/account-ui/src/billing/tab/BillingAutoTopUpCard.vue # src/platform/billing/composables/useAutoTopUpCardSection.ts
|
Important Review skippedIgnore keyword(s) in the title. ⛔ Ignored keywords: 2
Please check the settings in the CodeRabbit UI or the
|
🎭 Playwright: ✅ 3239 passed, 0 failed📊 Browser Reports
🎨 Storybook: ✅ Built — View Storybook🧩 Custom Nodes Ecosystem Matrix: 🟡 Withheld — could not measure
Findings and check detailsExecutes the frontend JS of every registry pack that ships any, against this change, in both renderers. The eight The matrix runs on same-repository version-bump PRs with relevant changes, main-branch pushes, and manual dispatches. This candidate does not qualify, so every expensive stage was skipped. Full docs: scripts/registry-census/README.md 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
🌾 Fallow: ✅ PassedFindings and check detailsFallow 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. Full docs: ADR-DEVEX-LINT-0015 Reproduce locally# the base the gate compared against
npx fallow audit --root . --quiet --format json \
--changed-since ab9d3abfb2494e9e80bfab4f225b1d1a22ea9bbb
🏛️ Architecture: ✅ PassedFindings and check detailsWarnings (394)
Full docs: Frontend domain catalog Reproduce locallypnpm architecture:check |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## cloud/1.60 #23340 +/- ##
===============================================
+ Coverage 59.33% 87.55% +28.22%
===============================================
Files 2356 3029 +673
Lines 103544 164540 +60996
Branches 0 41952 +41952
===============================================
+ Hits 61434 144067 +82633
+ Misses 42110 19542 -22568
- Partials 0 931 +931
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 2674 files with indirect coverage changes 🚀 New features to boost your workflow:
|
🔧 Auto-fixes AppliedThis PR has been automatically updated to fix linting and formatting issues.
Changes made:
|
Manual backport of #23323 (merged as 4d07c59) to
cloud/1.60. The bot's cherry-pick failed with conflicts.Why
Per DES-1240 and Alex's call in the #23278 review, auto top-up is "not available" while a plan is paused: no Turn on, no Set up. On cloud/1.60, the top-up dialog still offered Set up and the Billing tab card still showed Off · Turn on when
auto_top_up_setupisfrozenforbilling_paused. The Billing tab card also stayed visible forpayment_past_due.Root cause
TopUpAutoTopUpCard.vueonly treatedfrozen+payment_past_dueas paused.BillingAutoTopUpCard.vue(and its card-viewed event) hid only onstate: 'unavailable'.How (adapted)
isAutoTopUpNotAvailable(setup)goes into the existingpackages/account-core/src/core/billing/capabilities.tsand is exported from@comfyorg/account-core/billing. True forunavailable, orfrozenforpayment_past_due/billing_paused. Same rule and body as main.TopUpAutoTopUpCard.vueuses it in its inlinecanSetUp.src/platform/billing/components/billingTab/BillingAutoTopUpCard.vuehides on it, and so does its card-viewed event.Conflict notes
account-core/.../billingTab/autoTopUpCard.ts(+ test)capabilities.ts, and its table test intocapabilities.test.tsaccount-core/.../billing/index.tsaccount-ui/.../BillingAutoTopUpCard.vue(+ test)src/platform/billing/components/billingTab/BillingAutoTopUpCard.vueuseAutoTopUpCardSection.tsTopUpAutoTopUpCard.vuecanSetUpAutoTopUpis not on cloud/1.60canSetUp; replaced its paused check with the helperTopUpAutoTopUpCard.test.tsbilling_pausedpayment_past_dueTest evidence
vitest(app):TopUpAutoTopUpCard.test.ts+billingTab/BillingAutoTopUpCard.test.ts: 61 passed.vitest(account-core):capabilities.test.ts: 59 passed, including the newisAutoTopUpNotAvailabletable..vuefiles reverted to cloud/1.60, 3 tests fail (shows the prompt: false while setup is frozen for billing_paused,renders nothing when setup is frozen for billing_paused,renders nothing when setup is frozen for payment_past_due). They pass with the fix.pnpm typecheck,pnpm typecheck:account-core, oxlint + eslint on changed files, and account-corelint: clean.Same commit as the core/1.60 backport: #23339 (cherry-picked cleanly onto cloud/1.60; the same tests, red check, typecheck and lint were re-run here).