Skip to content

feat(billing): role-aware run-lock for cancelled/inactive team plans (FE-978)#12786

Merged
dante01yoon merged 2 commits into
mainfrom
jaewon/fe-978-team-plan-cancel-inactive-states-run-locked-members-retained
Jun 17, 2026
Merged

feat(billing): role-aware run-lock for cancelled/inactive team plans (FE-978)#12786
dante01yoon merged 2 commits into
mainfrom
jaewon/fe-978-team-plan-cancel-inactive-states-run-locked-members-retained

Conversation

@dante01yoon

@dante01yoon dante01yoon commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

Cancelled / inactive team plans keep members but lock runs; the run button and the subscription-required dialog are now role-aware — owners are routed to the pricing/subscribe flow, members (who cannot subscribe) see "contact your workspace owner to resubscribe".

Changes

  • What: SubscribeToRun.vue becomes a role-aware locked run button (owner → "Subscribe to Run"; member → neutral locked "Run" + contact-owner tooltip; both open the subscription dialog). SubscriptionRequiredDialogContentWorkspace.vue branches on role (member → read-only contact-owner panel, no pricing/subscribe affordance; owner → existing pricing/preview; member view suppressed for out_of_credits so the active-but-low-credits path is unchanged). subscription.inactive.* i18n keys.
  • Breaking: none.

Review Focus

  • Role source = useWorkspaceUI().permissions.value.canManageSubscription (owner / personal = true, member = false) — the same accessor SubscriptionPanelContentWorkspace.vue uses.
  • No BE work: the run-gate already exists server-side (InactiveSubscriptionError; is_active checked before funds). The lock is gated on is_active, the same field the orchestrator uses, so FE/BE stay consistent; leftover-credits-while-inactive remains blocked by design.
  • Complements fix(billing): route subscription/sign-in/credit preconditions to modal, out of error panel (FE-878) #12785 (FE-878 precondition→modal routing); disjoint file sets. Design: DES-197, Figma 3253-18670 / 3253-18671 / 3246-13962.
  • Tests: SubscribeToRun (4) / CloudRunButtonWrapper (3) / SubscriptionRequiredDialogContentWorkspace role cases — member sees contact-owner (no subscribe), owner sees pricing, run locks on !is_active and unlocks when active (22 total); full test:unit green.

Fixes FE-978

@dante01yoon dante01yoon requested a review from a team June 11, 2026 08:14
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jun 11, 2026
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 37835473-9566-40c0-8ee1-323ba458f5a8

📥 Commits

Reviewing files that changed from the base of the PR and between a7b284c and 841b12e.

📒 Files selected for processing (4)
  • src/locales/en/main.json
  • src/platform/cloud/subscription/composables/useSubscriptionDialog.ts
  • src/platform/workspace/components/SubscriptionInactiveMemberDialog.test.ts
  • src/platform/workspace/components/SubscriptionInactiveMemberDialog.vue
✅ Files skipped from review due to trivial changes (1)
  • src/locales/en/main.json

📝 Walkthrough

Walkthrough

The PR adds member-aware subscription UI by introducing a new inactive subscription dialog for members, updating the SubscribeToRun button with permission-based labels and tooltips, routing subscription dialogs based on user permissions, and adding translation strings and comprehensive tests throughout.

Changes

Member-Aware Subscription UI

Layer / File(s) Summary
Subscription inactive translation strings
src/locales/en/main.json
New i18n entries under subscription.required.inactive provide UI text for members with inactive subscriptions, including title, description, CTA, and label variants.
SubscriptionInactiveMemberDialog component and tests
src/platform/workspace/components/SubscriptionInactiveMemberDialog.vue, src/platform/workspace/components/SubscriptionInactiveMemberDialog.test.ts
New dialog component renders member-specific inactive subscription messaging with title, description, and close/CTA buttons wired to onClose callback; tests verify text rendering, absence of subscribe affordance, and click handlers.
SubscribeToRun permission-aware button behavior
src/platform/cloud/subscription/components/SubscribeToRun.vue, src/platform/cloud/subscription/components/SubscribeToRun.test.ts
SubscribeToRun adds buttonTooltip and updates buttonLabel to show "Run" for members (non-subscribers) and full/compact "Subscribe to Run" for owners; tests verify role-based label rendering and dialog trigger for both owner and member roles.
useSubscriptionDialog member-specific routing
src/platform/cloud/subscription/composables/useSubscriptionDialog.ts
Dialog composable checks workspace permissions and conditionally shows SubscriptionInactiveMemberDialog instead of pricing table when member lacks subscription management permission and dialog reason is not out-of-credits.
CloudRunButtonWrapper subscription state integration test
src/components/actionbar/ComfyRunButton/CloudRunButtonWrapper.test.ts
Test suite verifies queue and subscribe-to-run child components render correctly based on isActiveSubscription state and react to subscription status changes.

Sequence Diagram(s)

sequenceDiagram
  participant User as User (Member)
  participant Button as SubscribeToRun Button
  participant Dialog as Subscription Dialog
  participant InactiveDialog as SubscriptionInactiveMemberDialog
  participant WorkspaceUI as Workspace Permissions
  User->>Button: view button
  Button->>WorkspaceUI: check canManageSubscription
  WorkspaceUI-->>Button: false (member)
  Button-->>User: display Run label
  User->>Button: click button
  Button->>Dialog: showSubscriptionDialog()
  Dialog->>WorkspaceUI: check canManageSubscription
  WorkspaceUI-->>Dialog: false
  Dialog->>InactiveDialog: async load and show
  InactiveDialog-->>User: display inactive message with CTA
  User->>InactiveDialog: click close or CTA
  InactiveDialog->>Dialog: onClose()
  Dialog->>Dialog: hide()
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

size:L

Suggested reviewers

  • DrJKL
  • pythongosssss

Poem

🐰 Members see simpler buttons now,
No pricing tables for their brow,
A custom dialog, calm and clear,
When subscriptions disappear,
Permissions guide the UI flow.


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
End-To-End Regression Coverage For Fixes ❓ Inconclusive PR title is “feat(…)” (no fix signal) but commit subjects and full changed-file list (incl. browser_tests) aren’t provided, so conditions can’t be fully evaluated. Need PR commit subjects (to check for fix/fixed/fixes/hotfix) and complete changed-file list or proof no browser_tests/ files were changed.
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main feature: adding role-aware run-locking for inactive team plans, including the ticket reference (FE-978).
Description check ✅ Passed The PR description is comprehensive and follows the template structure with Summary, Changes, and Review Focus sections, covering all key aspects of the feature.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Adr Compliance For Entity/Litegraph Changes ✅ Passed No changed files in this PR are under src/lib/litegraph/, src/ecs/, or graph entity-related paths per provided file list; ADR 0003/0008 patterns not applicable.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jaewon/fe-978-team-plan-cancel-inactive-states-run-locked-members-retained

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

🎨 Storybook: ✅ Built — View Storybook

Details

⏰ Completed at: 06/13/2026, 04:39:05 AM UTC

Links

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

🎭 Playwright: ✅ 1668 passed, 0 failed · 2 flaky

📊 Browser Reports
  • chromium: View Report (✅ 1647 / ❌ 0 / ⚠️ 2 / ⏭️ 5)
  • chromium-2x: View Report (✅ 2 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • chromium-0.5x: View Report (✅ 1 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • mobile-chrome: View Report (✅ 18 / ❌ 0 / ⚠️ 0 / ⏭️ 0)

@coderabbitai coderabbitai Bot 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.

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/cloud/subscription/components/SubscribeToRun.test.ts`:
- Around line 68-69: The test stubs the tooltip directive as a no-op so the new
role-aware tooltip branch (buttonTooltip) in SubscribeToRun is untested; update
the test in SubscribeToRun.test.ts to replace directives: { tooltip: () => {} }
with a spy/mocked implementation that records calls and then add assertions that
the component triggers the tooltip with the expected text for a member versus an
owner (i.e., exercise the buttonTooltip branch), referencing the SubscribeToRun
component and its buttonTooltip behavior to verify the correct tooltip payload
is passed when rendering under different roles.
🪄 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: CHILL

Plan: Pro

Run ID: c5dce754-3779-47dd-9f92-b68379809600

📥 Commits

Reviewing files that changed from the base of the PR and between 603914e and a7b284c.

📒 Files selected for processing (6)
  • src/components/actionbar/ComfyRunButton/CloudRunButtonWrapper.test.ts
  • src/locales/en/main.json
  • src/platform/cloud/subscription/components/SubscribeToRun.test.ts
  • src/platform/cloud/subscription/components/SubscribeToRun.vue
  • src/platform/workspace/components/SubscriptionRequiredDialogContentWorkspace.test.ts
  • src/platform/workspace/components/SubscriptionRequiredDialogContentWorkspace.vue

Comment thread src/platform/cloud/subscription/components/SubscribeToRun.test.ts
@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 79.31034% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
.../subscription/composables/useSubscriptionDialog.ts 33.33% 6 Missing ⚠️
@@             Coverage Diff             @@
##             main   #12786       +/-   ##
===========================================
- Coverage   76.25%   61.67%   -14.59%     
===========================================
  Files        1565     1458      -107     
  Lines      103375    75274    -28101     
  Branches    31150    21256     -9894     
===========================================
- Hits        78831    46423    -32408     
- Misses      23700    28497     +4797     
+ Partials      844      354      -490     
Flag Coverage Δ
e2e ?
unit 61.67% <79.31%> (+0.06%) ⬆️

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

Files with missing lines Coverage Δ
...m/cloud/subscription/components/SubscribeToRun.vue 95.23% <100.00%> (+90.89%) ⬆️
...ce/components/SubscriptionInactiveMemberDialog.vue 100.00% <100.00%> (ø)
.../subscription/composables/useSubscriptionDialog.ts 68.33% <33.33%> (-4.75%) ⬇️

... and 1180 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.

…978)

Members of a cancelled/inactive team workspace now see a small Modal/Small
card matching Figma 3253-19473 (title + close, muted body, right-aligned
"Ok, got it"), routed before the pricing-table fork in useSubscriptionDialog
so it works regardless of the pricing dialog variant. Copy aligned to Figma
("subscription is inactive" / "reactivate" / "Ok, got it"). Removes the prior
big-dialog member block from SubscriptionRequiredDialogContentWorkspace.vue,
which is now owner-only.
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Jun 13, 2026

@jtydhr88 jtydhr88 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good to me, but I don't test it on real cloud env, so please verify it on preview-cpu cloud test env

@jtydhr88 jtydhr88 assigned dante01yoon and unassigned jtydhr88 Jun 15, 2026
@dante01yoon

Copy link
Copy Markdown
Collaborator Author

@coderabbitai approve

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Comments resolved and changes approved.

@dante01yoon dante01yoon added this pull request to the merge queue Jun 17, 2026
Merged via the queue into main with commit 5a846db Jun 17, 2026
60 checks passed
@dante01yoon dante01yoon deleted the jaewon/fe-978-team-plan-cancel-inactive-states-run-locked-members-retained branch June 17, 2026 02:08
dante01yoon added a commit that referenced this pull request Jun 19, 2026
…12830)

Stacked on the permission infra #12829. Gates owner **Cancel** (plan
menu) + **Resubscribe** (panel button + workspace popover re-activate
path) on `canManageSubscriptionLifecycle` (original owner only), per the
billing-permission matrix (FE SSOT). Promoted owners keep manage-payment
/ upgrade / top-up; members get none.

**Original-owner signal (repointed).** Rebased onto the updated #12829
(`a51183ae`), so the gate now resolves from the member-list
`is_original_owner` field that the cloud cutover (Comfy-Org/cloud #4359)
ships: the store getter `isCurrentUserOriginalOwner` matches the current
user's member self-row by email, and `useWorkspaceUI` eagerly
`fetchMembers()` so billing surfaces have the roster loaded. This
replaces the earlier `is_creator`-on-`/api/workspaces` assumption — BE
standardized on a per-member `is_original_owner` instead. No
`is_creator` remains.

**Merge-gated** on cutover cloud#4359 reaching cloud main: until `GET
/api/workspace/members` returns `is_original_owner` in prod, the gate
fails closed (lifecycle actions hidden for every owner). Fail-closed =
no regression pre-deploy, but do not merge until the field is live.

**Follow-up (non-blocking).** Exposing `is_original_owner`
(current-user-relative, sibling of `role`) on `/api/workspaces` — Hunter
pre-approved 2026-06-17 — would let us read it directly and drop the
eager member fetch. Tracked on #12829 / FE-770.

Part of FE-978 (member run-lock modal shipped separately in #12786).
pull Bot pushed a commit to Mu-L/ComfyUI_frontend that referenced this pull request Jun 19, 2026
…l, out of error panel (FE-878) (Comfy-Org#12785)

## Summary

Account preconditions (sign-in / subscription / credits) on running a
workflow now open their modal directly and stay out of the error panel +
error count — previously `subscription_required` fell through to a red
"1 ERROR — Subscription required to queue workflows" banner. This covers
**both** paths: the `execution_error` websocket event and the `POST
/prompt` 402 queue paywall (`{ type: "PAYMENT_REQUIRED", message:
"Subscription required to queue workflows" }`), which is the exact
payload reported in Comfy-Org#12840.

## Changes

- **What**: `execution_error` is classified by a pure
`accountPreconditionRouting` resolver (precedence sign-in > subscription
> credits) and routed to the existing modal via
`useAccountPreconditionDialog`; `executionStore` returns early for
preconditions so they never populate `lastExecutionError` /
`lastPromptError` / `lastNodeErrors` → fully excluded from the panel and
`totalErrorCount`. Runtime credit error at a node → credits modal (out
of panel; can name the node).
- **Queue paywall**: the `queuePrompt` catch resolves the same
precondition from the `POST /prompt` 402 response and opens the modal,
short-circuiting before `lastPromptError`, so the queue paywall stays
out of the panel too. The runtime matcher learns the `"Subscription
required to queue workflows"` message.
- **Breaking**: none.

## Before / After

Free-tier queue paywall (`POST /prompt` → 402) on a cloud build:

**Before** — raw `Subscription required to queue workflows` surfaced in
the error panel (no actionable upgrade):

<img width="1600" height="873" alt="before-error-panel"
src="https://github.com/user-attachments/assets/1b76b742-16bf-47e3-9245-17e35f8f1e70"
/>

**After** — clean subscription modal opens; nothing in the error panel
or error count:

<img width="1600" height="873" alt="after-subscription-modal"
src="https://github.com/user-attachments/assets/13d238cb-20bf-4795-a530-5abcf9968dc7"
/>

## Review Focus

- **Routing-only — the run button is intentionally untouched.** The
original AC#3 ("no Subscribe-to-Run button") is superseded by the FE-978
run-lock decision (pre-emptive role-aware lock, Figma 3253-18671).
Complements Comfy-Org#12786 (FE-978 run-lock); disjoint file sets.
- Tests: `accountPreconditionRouting` / `useAccountPreconditionDialog` /
`executionStore` — each precondition routes to its modal and is excluded
from the panel/count; precedence resolves on co-occurrence. Plus
Playwright `browser_tests/tests/subscriptionPaywallError.spec.ts` — the
queue paywall (402) stays out of the error panel, with a control
asserting ordinary queue errors still surface. typecheck / oxlint /
eslint / stylelint / oxfmt / knip clean.

Fixes FE-878
Fixes Comfy-Org#12840
@dante01yoon dante01yoon added the cloud/1.46 Backport PRs for cloud 1.46 label Jun 19, 2026
@dante01yoon dante01yoon added the needs-backport Fix/change that needs to be cherry-picked to the current feature freeze branch label Jun 19, 2026
@comfy-pr-bot

Copy link
Copy Markdown
Member

@dante01yoon Successfully backported to #13006

@github-actions github-actions Bot removed the needs-backport Fix/change that needs to be cherry-picked to the current feature freeze branch label Jun 19, 2026
christian-byrne pushed a commit that referenced this pull request Jun 19, 2026
…d/inactive team plans (FE-978) (#13006)

Backport of #12786 to `cloud/1.46`

Automatically created by backport workflow.

Co-authored-by: Dante <bunggl@naver.com>
DrJKL pushed a commit to silveroxides/ComfyUI_frontend that referenced this pull request Jun 20, 2026
…on (FE-770) (Comfy-Org#12829)

## What

Adds a creator-only `canManageSubscriptionLifecycle` permission (cancel
/ reactivate / downgrade) to `useWorkspaceUI`:

- Any workspace **owner** keeps `canManageSubscription` (manage payment
/ top-up / change-commit).
- Only the **original owner (creator)** also gets
`canManageSubscriptionLifecycle`.
- **Personal** workspaces (single-member) always get it; **members**
never do.

Driven by an `is_creator` flag on the workspace from `/api/workspaces`,
plumbed through the shared type and the auth/session Zod schema.

## Safe to merge ahead of BE / no regression

- **Pure infra — nothing reads the permission yet.** Consumers land
separately: Comfy-Org#12786 (cancel/reactivate), Comfy-Org#12789 (downgrade). No code on
`main` references `canManageSubscriptionLifecycle` or `is_creator`.
- **Additive & fails closed.** `is_creator` is optional; when absent the
permission is `false`. Existing permission values are unchanged, so
existing consumers (`SubscribeToRun`,
`SubscriptionPanelContentWorkspace`, `CurrentUserPopoverWorkspace`, …)
behave identically.

## BE contract (confirmed with Hunter, 2026-06-17)

- `is_creator` = current-user-relative boolean on `/api/workspaces`; the
creator is tracked explicitly (not by creation date).
- Intentionally **temporary** — removed once member-removal
auto-provisions a personal workspace.
- The FE-770 members-panel creator-**row** lock additionally needs the
creator **id** (`created_by_user_id`) — separate, still-open ask.

## Follow-up (separate PR, once BE ships)

`is_creator` + `WorkspaceWithRoleSchema` are hand-rolled only because
the cloud ingest OpenAPI doesn't expose the field yet.
`@comfyorg/ingest-types` already generates `WorkspaceWithRole` +
`zWorkspaceWithRole`. Once BE adds `is_creator` to
`services/ingest/openapi.yaml`, regenerate and swap the hand-rolled
interface + schema for the generated ones (TODOs marked in
`workspaceApi.ts` / `workspaceAuthStore.ts`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cloud/1.46 Backport PRs for cloud 1.46 size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants