Repository navigation
feat: show scheduled plan change banner - #14642
dante01yoon wants to merge 11 commits into
Conversation
📄 Knowledge reviewDosu skipped reviewing this PR because your organization has used its |
🎨 Storybook: ✅ Built — View Storybook🎭 Playwright: ✅ 1828 passed, 0 failed · 3 flaky📊 Browser Reports
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughBilling banner derivation now recognizes scheduled plan changes. The banner resolves and formats the destination plan, effective date, and automatic charge. The banner renders within the plan credits panel. Tests cover eligibility, priority, incomplete data, placement, and unresolved destinations. ChangesScheduled plan-change banner
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Subscription
participant useBillingBanner
participant BillingStatusBanner
participant PlanCreditsPanelContent
Subscription->>useBillingBanner: scheduledPlanSlug and changeAt
useBillingBanner->>BillingStatusBanner: planChange banner
BillingStatusBanner->>BillingStatusBanner: resolve plan and format date and charge
PlanCreditsPanelContent->>BillingStatusBanner: render banner in plan section
BillingStatusBanner-->>PlanCreditsPanelContent: scheduled plan-change message
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/platform/workspace/components/dialogs/settings/BillingStatusBanner.test.ts`:
- Around line 344-379: Add a test alongside the scheduled-change cases using a
resolvable scheduledPlanSlug and changeAt set to "invalid-date"; render through
renderBanner and assert that no element with role "status" is present, covering
malformed API timestamps.
In `@src/platform/workspace/components/dialogs/settings/BillingStatusBanner.vue`:
- Around line 108-115: Update the date formatting call in the planChangeDate
computed property to pass timeZone: 'UTC' to d(), ensuring the scheduled change
date is rendered from its UTC value regardless of the user's local timezone.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: ec6dd986-a3d6-42f7-bc9e-51354d6b6816
📒 Files selected for processing (5)
src/locales/en/main.jsonsrc/platform/workspace/components/dialogs/settings/BillingStatusBanner.test.tssrc/platform/workspace/components/dialogs/settings/BillingStatusBanner.vuesrc/platform/workspace/composables/deriveBillingBanner.test.tssrc/platform/workspace/composables/useBillingBanner.ts
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #14642 +/- ##
==========================================
+ Coverage 79.18% 79.82% +0.63%
==========================================
Files 2210 1881 -329
Lines 112308 126238 +13930
Branches 34297 38654 +4357
==========================================
+ Hits 88930 100766 +11836
- Misses 22912 24831 +1919
- Partials 466 641 +175
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 882 files with indirect coverage changes 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@src/platform/workspace/components/dialogs/settings/WorkspaceSettingsPanelContent.test.ts`:
- Around line 28-30: Update the PlanCreditsPanelContent stub and related
assertions in WorkspaceSettingsPanelContent tests to use the banner’s
accessibility contract: add role="status" to the billing banner markup, replace
getByTestId('billing-banner') with getByRole('status'), and replace
queryByTestId('billing-banner') with queryByRole('status').
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: f5f69681-972c-4bd2-8541-251abe24b574
📒 Files selected for processing (4)
src/platform/workspace/components/dialogs/settings/PlanCreditsPanelContent.test.tssrc/platform/workspace/components/dialogs/settings/PlanCreditsPanelContent.vuesrc/platform/workspace/components/dialogs/settings/WorkspaceSettingsPanelContent.test.tssrc/platform/workspace/components/dialogs/settings/WorkspaceSettingsPanelContent.vue
💤 Files with no reviewable changes (1)
- src/platform/workspace/components/dialogs/settings/WorkspaceSettingsPanelContent.vue
|
Small spacing nit on the Plan tab — the banner sits noticeably closer to the tabs above it than to the content below. Measured on this branch: The
Happy for this to be a follow-up rather than a blocker on this PR. |
|
Correction on the above — I measured this on the Workspace panel ( The instance that is in scope here is |
huang47
left a comment
There was a problem hiding this comment.
Requesting changes for the blocking Team-plan billing mismatch below. The personal-plan flow, UTC date handling, placement, and banner priority otherwise align with FE-1501.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/platform/workspace/components/dialogs/settings/BillingStatusBanner.vue (1)
131-143: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winGuard the unresolved scheduled plan price.
seat_summaryis typed onPlan, but runtime API data can still omit fields. If the resolved scheduled Team plan has noseat_summary, line 133 throws before the''fallback; usescheduledPlan.value?.seat_summary?.total_cost_centsand keep the full chain fortotal_credits_centstoo.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/platform/workspace/components/dialogs/settings/BillingStatusBanner.vue` around lines 131 - 143, Update the scheduledPlanCharge computed property to safely access the Team plan’s nested seat_summary fields using optional chaining, including total_cost_cents and the corresponding total_credits_cents access. Preserve the existing empty-string fallback when either value is unavailable.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/platform/workspace/components/dialogs/settings/BillingStatusBanner.vue`:
- Around line 131-143: Update the scheduledPlanCharge computed property to
safely access the Team plan’s nested seat_summary fields using optional
chaining, including total_cost_cents and the corresponding total_credits_cents
access. Preserve the existing empty-string fallback when either value is
unavailable.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: b575eb2e-5415-44f2-b00d-2ffa6afda408
📒 Files selected for processing (2)
src/platform/workspace/components/dialogs/settings/BillingStatusBanner.test.tssrc/platform/workspace/components/dialogs/settings/BillingStatusBanner.vue
|
Addressed the outside-diff review in 3cc2c87: Team plan totals now use optional chaining through |
huang47
left a comment
There was a problem hiding this comment.
Requesting changes on the pinned head for three billing/resilience blockers: the production contract does not emit the fields that make the banner reachable; Team per-credit changes can advertise the active credit stop instead of the scheduled destination amount; and the module-global plan catalog can leak a prior workspace amount across switches. Current-head route-mocked evidence: #14642 (comment). No material performance regression was found; focused and broader billing tests passed, and the live performance/binary-size checks pass.
| hasFunds: subscription.value?.hasFunds ?? null, | ||
| isCancelled: subscription.value?.isCancelled ?? false, | ||
| endDate: subscription.value?.endDate ?? null, | ||
| scheduledPlanSlug: subscription.value?.scheduledPlanSlug ?? null, |
There was a problem hiding this comment.
Can we avoid wiring these fields until they exist in the generated ingest contract? Merged PR #15281 (same author) documents that scheduled_plan_slug / change_at were frontend-only inventions the server never defined or emitted, and removes their mapping. This branch is now dirty against main, so rebasing it would either drop this feature or reintroduce known contract drift; the route-mocked evidence only proves rendering (current-head evidence). I think this PR should close as superseded, or wait for a backend-owned scheduled-change contract.
| } | ||
|
|
||
| const stop = teamCreditStops.value?.stops.find( | ||
| ({ id }) => id === currentTeamCreditStop.value?.id |
There was a problem hiding this comment.
If this feature is revived, can the scheduled-change contract provide the destination Team credit stop or an authoritative next-period amount? This code resolves team_per_credit_* against currentTeamCreditStop, but a same-cadence commitment decrease keeps the same slug and active source stop until renewal. A USD 1,400 to USD 700 scheduled change can therefore advertise the current USD 1,295 charge instead of the destination USD 665. The current-head capture confirms this amount is presented as a definite automatic charge (evidence); the route mock does not cover a destination-stop change.
| const scheduledPlanAmountCents = computed(() => { | ||
| if (!isScheduledPerCreditTeamPlan.value) { | ||
| return isScheduledTeamPlan.value | ||
| ? scheduledPlan.value?.seat_summary?.total_cost_cents |
There was a problem hiding this comment.
Can the plan catalog be tied to the active workspace before this value is rendered as money? useBillingPlans keeps plans, teamCreditStops, and fetchPromise at module scope. During a workspace switch, the new status can combine with the previous workspace seat_summary; an in-flight request is reused for the new adapter, and a failed refresh preserves the old total. The capture shows that this value is presented directly as the next automatic charge (current-head evidence). Please clear or key the catalog and in-flight request by workspace, and add a two-workspace failure/race regression.
dante01yoon
left a comment
There was a problem hiding this comment.
Blocking review findings (GitHub does not allow the PR author to submit REQUEST_CHANGES on their own PR): the banner is unreachable from the production contract, and the frontend-derived amount can be wrong for both scheduled Team commitment changes and workspace switches. Route-mocked UI evidence does not establish production correctness.
| hasFunds: subscription.value?.hasFunds ?? null, | ||
| isCancelled: subscription.value?.isCancelled ?? false, | ||
| endDate: subscription.value?.endDate ?? null, | ||
| scheduledPlanSlug: subscription.value?.scheduledPlanSlug ?? null, |
There was a problem hiding this comment.
issue: These fields are not part of the generated ingest contract and the backend does not emit them. Merged PR #15281 explicitly removed the frontend-only scheduled_plan_slug / change_at mapping for that reason. This makes the new banner unreachable in production unless this branch reintroduces API-contract drift. Please implement the backend/OpenAPI contract first, regenerate ingest types, and then consume those generated fields here; otherwise this PR should close as superseded.
| } | ||
|
|
||
| const stop = teamCreditStops.value?.stops.find( | ||
| ({ id }) => id === currentTeamCreditStop.value?.id |
There was a problem hiding this comment.
issue: This prices a scheduled per-credit Team change from currentTeamCreditStop, which describes the active commitment rather than the scheduled destination. A same-cadence decrease keeps the same team_per_credit_* slug, so a $1,400 → $700 change can advertise the current stop's charge instead of the next charge. The server contract needs to provide the destination stop or authoritative next-period amount; the frontend cannot derive it deterministically from current state.
| const scheduledPlanAmountCents = computed(() => { | ||
| if (!isScheduledPerCreditTeamPlan.value) { | ||
| return isScheduledTeamPlan.value | ||
| ? scheduledPlan.value?.seat_summary?.total_cost_cents |
There was a problem hiding this comment.
issue: This definite automatic-charge amount comes from the module-global useBillingPlans catalog, which is not keyed or cleared by workspace. During a switch, new subscription status can combine with the previous workspace's seat_summary; an in-flight request is also reused across adapters, and a failed refresh preserves stale totals. Please scope/clear the catalog and request state by workspace and add a two-workspace race/failure regression before rendering this as billing authority.
## Summary Show the authoritative scheduled plan transition returned by `GET /api/billing/status` in the workspace billing panel and status banner. This supersedes Comfy-Org#14642 without carrying forward its client-invented billing fields or projected charge calculation. Depends on Comfy-Org/cloud#7977 and the generated `@comfyorg/ingest-types` sync after that backend PR merges. ## Changes - **What**: Map `scheduled_change` into billing state and render the destination plan and effective date. - **Behavior**: Keep urgent/actionable notices ahead of the informational plan-change banner; cancellation suppresses the change banner. - **Contract**: Import `ScheduledPlanChange` from generated ingest types; no frontend reconstruction of server billing state or future price. ## Review Focus - Banner priority: paused → payment failed → out of credits → ending → scheduled change. - Unknown destination slugs remain hidden instead of showing incomplete copy. - Both the panel and banner share plan-label and date formatting. ## Verification - 100 targeted tests pass across banner derivation, banner rendering, and subscription panel behavior. - `pnpm lint` passes. - `pnpm knip --cache` passes. - `pnpm typecheck` passes against types generated locally from cloud#7977. Until the backend types sync lands on frontend `main`, CI on this PR will report the two expected missing-contract errors. ## Screenshots AS IS: no banner appears because the current frontend contract has no scheduled transition. TO BE: capture pending after cloud#7977 is available in the preview environment. --------- Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: skishore23 <178779+skishore23@users.noreply.github.com> Co-authored-by: comfydesigner <alextov@comfy.org>
|
Closing as superseded by #16439, which merged on 2026-09-08 and implements this feature against the server-owned contract. After merging current The three blocking findings are resolved in #16439 rather than here:
Three changes on this branch are not on
|
Show the authoritative scheduled plan transition returned by `GET /api/billing/status` in the workspace billing panel and status banner. This supersedes #14642 without carrying forward its client-invented billing fields or projected charge calculation. Depends on Comfy-Org/cloud#7977 and the generated `@comfyorg/ingest-types` sync after that backend PR merges. - **What**: Map `scheduled_change` into billing state and render the destination plan and effective date. - **Behavior**: Keep urgent/actionable notices ahead of the informational plan-change banner; cancellation suppresses the change banner. - **Contract**: Import `ScheduledPlanChange` from generated ingest types; no frontend reconstruction of server billing state or future price. - Banner priority: paused → payment failed → out of credits → ending → scheduled change. - Unknown destination slugs remain hidden instead of showing incomplete copy. - Both the panel and banner share plan-label and date formatting. - 100 targeted tests pass across banner derivation, banner rendering, and subscription panel behavior. - `pnpm lint` passes. - `pnpm knip --cache` passes. - `pnpm typecheck` passes against types generated locally from cloud#7977. Until the backend types sync lands on frontend `main`, CI on this PR will report the two expected missing-contract errors. AS IS: no banner appears because the current frontend contract has no scheduled transition. TO BE: capture pending after cloud#7977 is available in the preview environment. --------- Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: skishore23 <178779+skishore23@users.noreply.github.com> Co-authored-by: comfydesigner <alextov@comfy.org>
Show the authoritative scheduled plan transition returned by `GET /api/billing/status` in the workspace billing panel and status banner. This supersedes #14642 without carrying forward its client-invented billing fields or projected charge calculation. Depends on Comfy-Org/cloud#7977 and the generated `@comfyorg/ingest-types` sync after that backend PR merges. - **What**: Map `scheduled_change` into billing state and render the destination plan and effective date. - **Behavior**: Keep urgent/actionable notices ahead of the informational plan-change banner; cancellation suppresses the change banner. - **Contract**: Import `ScheduledPlanChange` from generated ingest types; no frontend reconstruction of server billing state or future price. - Banner priority: paused → payment failed → out of credits → ending → scheduled change. - Unknown destination slugs remain hidden instead of showing incomplete copy. - Both the panel and banner share plan-label and date formatting. - 100 targeted tests pass across banner derivation, banner rendering, and subscription panel behavior. - `pnpm lint` passes. - `pnpm knip --cache` passes. - `pnpm typecheck` passes against types generated locally from cloud#7977. Until the backend types sync lands on frontend `main`, CI on this PR will report the two expected missing-contract errors. AS IS: no banner appears because the current frontend contract has no scheduled transition. TO BE: capture pending after cloud#7977 is available in the preview environment. --------- Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: skishore23 <178779+skishore23@users.noreply.github.com> Co-authored-by: comfydesigner <alextov@comfy.org>
Show the authoritative scheduled plan transition returned by `GET /api/billing/status` in the workspace billing panel and status banner. This supersedes #14642 without carrying forward its client-invented billing fields or projected charge calculation. Depends on Comfy-Org/cloud#7977 and the generated `@comfyorg/ingest-types` sync after that backend PR merges. - **What**: Map `scheduled_change` into billing state and render the destination plan and effective date. - **Behavior**: Keep urgent/actionable notices ahead of the informational plan-change banner; cancellation suppresses the change banner. - **Contract**: Import `ScheduledPlanChange` from generated ingest types; no frontend reconstruction of server billing state or future price. - Banner priority: paused → payment failed → out of credits → ending → scheduled change. - Unknown destination slugs remain hidden instead of showing incomplete copy. - Both the panel and banner share plan-label and date formatting. - 100 targeted tests pass across banner derivation, banner rendering, and subscription panel behavior. - `pnpm lint` passes. - `pnpm knip --cache` passes. - `pnpm typecheck` passes against types generated locally from cloud#7977. Until the backend types sync lands on frontend `main`, CI on this PR will report the two expected missing-contract errors. AS IS: no banner appears because the current frontend contract has no scheduled transition. TO BE: capture pending after cloud#7977 is available in the preview environment. --------- Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: skishore23 <178779+skishore23@users.noreply.github.com> Co-authored-by: comfydesigner <alextov@comfy.org>
Show the authoritative scheduled plan transition returned by `GET /api/billing/status` in the workspace billing panel and status banner. This supersedes #14642 without carrying forward its client-invented billing fields or projected charge calculation. Depends on Comfy-Org/cloud#7977 and the generated `@comfyorg/ingest-types` sync after that backend PR merges. - **What**: Map `scheduled_change` into billing state and render the destination plan and effective date. - **Behavior**: Keep urgent/actionable notices ahead of the informational plan-change banner; cancellation suppresses the change banner. - **Contract**: Import `ScheduledPlanChange` from generated ingest types; no frontend reconstruction of server billing state or future price. - Banner priority: paused → payment failed → out of credits → ending → scheduled change. - Unknown destination slugs remain hidden instead of showing incomplete copy. - Both the panel and banner share plan-label and date formatting. - 100 targeted tests pass across banner derivation, banner rendering, and subscription panel behavior. - `pnpm lint` passes. - `pnpm knip --cache` passes. - `pnpm typecheck` passes against types generated locally from cloud#7977. Until the backend types sync lands on frontend `main`, CI on this PR will report the two expected missing-contract errors. AS IS: no banner appears because the current frontend contract has no scheduled transition. TO BE: capture pending after cloud#7977 is available in the preview environment. --------- Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: skishore23 <178779+skishore23@users.noreply.github.com> Co-authored-by: comfydesigner <alextov@comfy.org>



Summary
Shows an advance billing notice when an active subscription has a scheduled plan change, so billing managers can see the destination plan, effective date, and next automatic charge before it takes effect.
Changes
planChangeto the existing billing banner priority model and renders the updated Figma notice for personal and team plans.Review Focus
paused > payment failed > out of credits > ending > plan change.Linear: FE-1501
Screenshots
AS IS
Scheduled changes only appear as secondary text within the current plan card.
TO BE
Validation
pnpm test:unit src/platform/workspace/composables/deriveBillingBanner.test.ts src/platform/workspace/composables/useBillingBanner.test.ts src/platform/workspace/components/dialogs/settings/BillingStatusBanner.test.ts(36 tests)pnpm test:unit src/platform/workspace/components/dialogs/settings/PlanCreditsPanelContent.test.ts src/platform/workspace/components/dialogs/settings/WorkspaceSettingsPanelContent.test.ts src/platform/workspace/components/dialogs/settings/BillingStatusBanner.test.ts(19 tests)NODE_OPTIONS=--max-old-space-size=4096 pnpm typecheckoxfmt,oxlint, ESLint, Stylelint, typecheck)