Repository navigation
[backport cloud/1.51] fix(billing): let unsubscribed workspaces add credits on Local - #15829
Merged
Merged
Conversation
## Summary An unsubscribed workspace on Local had no way to add credits: the subscribe CTA is hidden on Local (#15601) but the Add credits button never appeared, because both entry points were gated on `canAccessSubscriptionFeatures` (QA finding #11 from the 1.51 workspace-switcher test plan). ## Changes - **What**: Gate the Add credits button in `CurrentUserPopoverWorkspace` and `CreditsTile` on the billing policy table (`topUpAccess === 'allowed'`) instead of `canAccessSubscriptionFeatures`. `showTopUpCreditsDialog` already enforces this same policy, so the buttons and the dialog now agree. The popover's free-tier upsell is likewise driven by `showsSubscribeUpsellUI`, which also stops the Cloud-only upgrade upsell from rendering on a Local free tier. - **Team workspaces**: the Plan & Credits panel forced the never-subscribed team prompt (`Subscribe now` + zero-state tile) on every distribution, so a never-subscribed team workspace on Local also had no top-up path. That prompt is now Cloud-only; the ended-team inactive treatment is unchanged everywhere so billing, invoices, and reactivation stay reachable. ## Review Focus - Cloud behavior is unchanged by construction: on Cloud, `topUpAccess === 'allowed'` only in states where `canAccessSubscriptionFeatures` is already true, and `CloudWithoutActiveSubscription`/`CloudAndFree` keep their previous surfaces (subscribe action / upgrade upsell). - On Local every policy state allows top-up, so the button now renders for unsubscribed workspaces; owner permission gating (`permissions.canTopUp`) is unchanged. - The bug only reproduces on the workspace billing rail (`billing_rail: 'stripe'`): the legacy rail exempts Local from the subscription gate, which is why the existing legacy-rail e2e passes on main. This PR adds `localCreditsWorkspaceRail.spec.ts` (own fixture, no shared-file changes, so no conflict with #15797) covering the failing rail end to end. Needs backport to `core/1.51` after merge — this is a sign-off blocker for the 1.51 QA round. ## Screenshots Local build, workspace billing rail, no active subscription (`is_active: false`), owner. | Surface | AS IS (main) | TO BE (this PR) | | --- | --- | --- | | Profile popover |  |  | | Settings > Plan & Credits |  |  | AS IS: no Add credits button in either surface (and no Subscribe button on Local) — a dead end. TO BE: Add credits is available and opens the top-up dialog.
comfy-pr-bot
enabled auto-merge (squash)
August 24, 2026 21:13
Contributor
🎨 Storybook: ✅ Built — View Storybook🎭 Playwright: ✅ 1827 passed, 0 failed · 2 flaky📊 Browser Reports
|
dante01yoon
approved these changes
Aug 24, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## cloud/1.51 #15829 +/- ##
=============================================
Coverage ? 81.58%
=============================================
Files ? 1884
Lines ? 117764
Branches ? 36793
=============================================
Hits ? 96072
Misses ? 21220
Partials ? 472
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #15799 to
cloud/1.51Automatically created by backport workflow.