Repository navigation
[backport cloud/1.52] fix(billing): restore Resubscribe on the legacy rail and centralize the policy - #16091
Conversation
|
Important Review skippedIgnore keyword(s) in the title. ⛔ Ignored keywords (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
🎭 Playwright: ✅ 1984 passed, 0 failed · 2 flaky📊 Browser Reports
🎨 Storybook: ✅ Built — View Storybook📦 Bundle Size
⚡ Performance Report
Absolute values
Raw data{
"timestamp": "2026-08-27T15:22:24.168Z",
"gitSha": "f5615f4bda0637a98d5562d7c16f1a9b4defd27b",
"branch": "backport-15967-to-cloud-1.52",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 2041.9180000000097,
"styleRecalcs": 9,
"styleRecalcDurationMs": 6.812,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 494.8859999999999,
"heapDeltaBytes": 16359700,
"heapUsedBytes": 78777848,
"domNodes": -280,
"jsHeapTotalBytes": 4710400,
"scriptDurationMs": 6.245000000000002,
"eventListeners": -151,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-idle",
"durationMs": 2053.6870000000818,
"styleRecalcs": 9,
"styleRecalcDurationMs": 7.767999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 478.271,
"heapDeltaBytes": 18164864,
"heapUsedBytes": 80668596,
"domNodes": -281,
"jsHeapTotalBytes": 5234688,
"scriptDurationMs": 6.379,
"eventListeners": -151,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1845.2100000000087,
"styleRecalcs": 75,
"styleRecalcDurationMs": 32.449,
"layouts": 12,
"layoutDurationMs": 3.2960000000000003,
"taskDurationMs": 841.2040000000001,
"heapDeltaBytes": 6670240,
"heapUsedBytes": 68374284,
"domNodes": -284,
"jsHeapTotalBytes": 6021120,
"scriptDurationMs": 109.881,
"eventListeners": -181,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1842.9429999999911,
"styleRecalcs": 73,
"styleRecalcDurationMs": 36.269000000000005,
"layouts": 12,
"layoutDurationMs": 3.3169999999999997,
"taskDurationMs": 834.915,
"heapDeltaBytes": -5202652,
"heapUsedBytes": 57001296,
"domNodes": -283,
"jsHeapTotalBytes": 5234688,
"scriptDurationMs": 107.753,
"eventListeners": -151,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1671.8650000000252,
"styleRecalcs": 33,
"styleRecalcDurationMs": 16.519,
"layouts": 6,
"layoutDurationMs": 0.5549999999999999,
"taskDurationMs": 342.589,
"heapDeltaBytes": 3653604,
"heapUsedBytes": 66539748,
"domNodes": 79,
"jsHeapTotalBytes": 4980736,
"scriptDurationMs": 8.722000000000003,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1710.4100000000244,
"styleRecalcs": 30,
"styleRecalcDurationMs": 17.119,
"layouts": 6,
"layoutDurationMs": 0.7810000000000001,
"taskDurationMs": 348.73600000000005,
"heapDeltaBytes": 3363784,
"heapUsedBytes": 65865936,
"domNodes": 77,
"jsHeapTotalBytes": 4980736,
"scriptDurationMs": 8.673,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "dom-widget-clipping",
"durationMs": 682.3249999999916,
"styleRecalcs": 8,
"styleRecalcDurationMs": 5.228,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 387.23199999999997,
"heapDeltaBytes": 11038616,
"heapUsedBytes": 73200156,
"domNodes": 12,
"jsHeapTotalBytes": 5505024,
"scriptDurationMs": 61.358,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "dom-widget-clipping",
"durationMs": 562.4899999999116,
"styleRecalcs": 11,
"styleRecalcDurationMs": 6.978999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 348.11800000000005,
"heapDeltaBytes": 10853376,
"heapUsedBytes": 73756940,
"domNodes": 18,
"jsHeapTotalBytes": 5505024,
"scriptDurationMs": 54.667,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "large-graph-idle",
"durationMs": 2039.8189999999659,
"styleRecalcs": 8,
"styleRecalcDurationMs": 7.470999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 595.9929999999999,
"heapDeltaBytes": -5732380,
"heapUsedBytes": 71418660,
"domNodes": -283,
"jsHeapTotalBytes": -532480,
"scriptDurationMs": 14.457,
"eventListeners": -149,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-idle",
"durationMs": 2035.0760000000037,
"styleRecalcs": 7,
"styleRecalcDurationMs": 5.571000000000003,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 586.4830000000001,
"heapDeltaBytes": -6590724,
"heapUsedBytes": 70755372,
"domNodes": -283,
"jsHeapTotalBytes": -1318912,
"scriptDurationMs": 13.694999999999995,
"eventListeners": -151,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-pan",
"durationMs": 2117.8659999999923,
"styleRecalcs": 68,
"styleRecalcDurationMs": 12.931999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1174.7259999999999,
"heapDeltaBytes": -14536204,
"heapUsedBytes": 63673656,
"domNodes": -285,
"jsHeapTotalBytes": 1826816,
"scriptDurationMs": 330.52500000000003,
"eventListeners": -151,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-pan",
"durationMs": 2207.4870000000146,
"styleRecalcs": 70,
"styleRecalcDurationMs": 15.038000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1184.284,
"heapDeltaBytes": -13540828,
"heapUsedBytes": 64626928,
"domNodes": -282,
"jsHeapTotalBytes": 2613248,
"scriptDurationMs": 338.412,
"eventListeners": -151,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-zoom",
"durationMs": 3113.7339999999654,
"styleRecalcs": 66,
"styleRecalcDurationMs": 15.008000000000001,
"layouts": 60,
"layoutDurationMs": 7.07,
"taskDurationMs": 1307.984,
"heapDeltaBytes": -9280492,
"heapUsedBytes": 70302228,
"domNodes": 14,
"jsHeapTotalBytes": 6066176,
"scriptDurationMs": 387.281,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-zoom",
"durationMs": 3153.28999999997,
"styleRecalcs": 65,
"styleRecalcDurationMs": 14.318000000000001,
"layouts": 60,
"layoutDurationMs": 7.443,
"taskDurationMs": 1349.9759999999999,
"heapDeltaBytes": -14037336,
"heapUsedBytes": 65315452,
"domNodes": -288,
"jsHeapTotalBytes": 4972544,
"scriptDurationMs": 379.065,
"eventListeners": -153,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "legacy-node-drag",
"durationMs": 2165.555999999981,
"styleRecalcs": 46,
"styleRecalcDurationMs": 9.672,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1386.4080000000001,
"heapDeltaBytes": -17184744,
"heapUsedBytes": 70066076,
"domNodes": 12,
"jsHeapTotalBytes": 9211904,
"scriptDurationMs": 441.695,
"eventListeners": 186,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "legacy-node-drag",
"durationMs": 2156.558000000018,
"styleRecalcs": 45,
"styleRecalcDurationMs": 8.979000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1384.952,
"heapDeltaBytes": 10579668,
"heapUsedBytes": 90577860,
"domNodes": 10,
"jsHeapTotalBytes": 7532544,
"scriptDurationMs": 459.252,
"eventListeners": 186,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "minimap-idle",
"durationMs": 2013.091999999972,
"styleRecalcs": 8,
"styleRecalcDurationMs": 6.1930000000000005,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 593.74,
"heapDeltaBytes": -12739740,
"heapUsedBytes": 65445940,
"domNodes": -284,
"jsHeapTotalBytes": 3137536,
"scriptDurationMs": 15.78,
"eventListeners": -179,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "minimap-idle",
"durationMs": 2045.2910000000202,
"styleRecalcs": 8,
"styleRecalcDurationMs": 7.307000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 595.031,
"heapDeltaBytes": -11972492,
"heapUsedBytes": 71494140,
"domNodes": -283,
"jsHeapTotalBytes": 3137536,
"scriptDurationMs": 14.438000000000002,
"eventListeners": -179,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 607.6150000000098,
"styleRecalcs": 48,
"styleRecalcDurationMs": 12.008,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 391.745,
"heapDeltaBytes": 11863804,
"heapUsedBytes": 74592292,
"domNodes": 22,
"jsHeapTotalBytes": 4980736,
"scriptDurationMs": 125.02,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 574.5900000000574,
"styleRecalcs": 47,
"styleRecalcDurationMs": 14.328000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 400.25500000000005,
"heapDeltaBytes": 11837364,
"heapUsedBytes": 74753016,
"domNodes": 20,
"jsHeapTotalBytes": 4980736,
"scriptDurationMs": 124.716,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "subgraph-idle",
"durationMs": 2004.7379999999748,
"styleRecalcs": 9,
"styleRecalcDurationMs": 6.968999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 488.58200000000005,
"heapDeltaBytes": 18292276,
"heapUsedBytes": 80970524,
"domNodes": -281,
"jsHeapTotalBytes": 4972544,
"scriptDurationMs": 5.835000000000002,
"eventListeners": -151,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-idle",
"durationMs": 2022.991999999931,
"styleRecalcs": 9,
"styleRecalcDurationMs": 7.921999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 477.264,
"heapDeltaBytes": -3412928,
"heapUsedBytes": 59977384,
"domNodes": -280,
"jsHeapTotalBytes": 4448256,
"scriptDurationMs": 5.89,
"eventListeners": -181,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1709.5460000000458,
"styleRecalcs": 75,
"styleRecalcDurationMs": 32.89,
"layouts": 16,
"layoutDurationMs": 4.034,
"taskDurationMs": 768.709,
"heapDeltaBytes": 3539580,
"heapUsedBytes": 66549868,
"domNodes": -280,
"jsHeapTotalBytes": 6021120,
"scriptDurationMs": 81.63199999999999,
"eventListeners": -183,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1708.5409999999683,
"styleRecalcs": 76,
"styleRecalcDurationMs": 33.084,
"layouts": 16,
"layoutDurationMs": 4.253,
"taskDurationMs": 770.3050000000001,
"heapDeltaBytes": 17851504,
"heapUsedBytes": 80755400,
"domNodes": -280,
"jsHeapTotalBytes": 4710400,
"scriptDurationMs": 81.922,
"eventListeners": -151,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "subgraph-transition-enter",
"durationMs": 1434.7549999999956,
"styleRecalcs": 19,
"styleRecalcDurationMs": 31.137999999999998,
"layouts": 14,
"layoutDurationMs": 14.331999999999997,
"taskDurationMs": 925.154,
"heapDeltaBytes": -6130260,
"heapUsedBytes": 85914732,
"domNodes": 13673,
"jsHeapTotalBytes": 11796480,
"scriptDurationMs": 15.403,
"eventListeners": 2373,
"totalBlockingTimeMs": 138,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 8173.694000000012,
"styleRecalcs": 250,
"styleRecalcDurationMs": 36.913000000000004,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 3961.983,
"heapDeltaBytes": 2504428,
"heapUsedBytes": 79663548,
"domNodes": -272,
"jsHeapTotalBytes": -831488,
"scriptDurationMs": 985.7259999999999,
"eventListeners": -131,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 8147.182000000043,
"styleRecalcs": 249,
"styleRecalcDurationMs": 35.367999999999995,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 4018.5339999999997,
"heapDeltaBytes": 1667952,
"heapUsedBytes": 78690720,
"domNodes": -276,
"jsHeapTotalBytes": -307200,
"scriptDurationMs": 1033.693,
"eventListeners": -131,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-idle",
"durationMs": 16724.027999999977,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 16001.489999999996,
"heapDeltaBytes": -51267232,
"heapUsedBytes": 181205428,
"domNodes": -8312,
"jsHeapTotalBytes": -18755584,
"scriptDurationMs": 103.793,
"eventListeners": -16389,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-idle",
"durationMs": 16726.427000000058,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 15810.899,
"heapDeltaBytes": -34639264,
"heapUsedBytes": 181414908,
"domNodes": -8312,
"jsHeapTotalBytes": -13656064,
"scriptDurationMs": 104.51500000000001,
"eventListeners": -16393,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "vue-large-graph-pan",
"durationMs": 20022.087,
"styleRecalcs": 168,
"styleRecalcDurationMs": 16.656000000000006,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 19639.674999999996,
"heapDeltaBytes": -25243288,
"heapUsedBytes": 186965184,
"domNodes": -8312,
"jsHeapTotalBytes": -14790656,
"scriptDurationMs": 396.23500000000007,
"eventListeners": -16389,
"totalBlockingTimeMs": 40,
"frameDurationMs": 17.773333333333238,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-pan",
"durationMs": 20317.387000000053,
"styleRecalcs": 172,
"styleRecalcDurationMs": 17.214000000000006,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 19821.431999999997,
"heapDeltaBytes": -49891668,
"heapUsedBytes": 181945364,
"domNodes": -8312,
"jsHeapTotalBytes": -22290432,
"scriptDurationMs": 400.372,
"eventListeners": -16387,
"totalBlockingTimeMs": 36,
"frameDurationMs": 17.223333333333358,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "workflow-execution",
"durationMs": 120.60599999995247,
"styleRecalcs": 8,
"styleRecalcDurationMs": 16.727,
"layouts": 2,
"layoutDurationMs": 1.1849999999999998,
"taskDurationMs": 81.26400000000001,
"heapDeltaBytes": 3252044,
"heapUsedBytes": 65442764,
"domNodes": 137,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 6.065000000000001,
"eventListeners": 49,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "workflow-execution",
"durationMs": 107.7020000000175,
"styleRecalcs": 8,
"styleRecalcDurationMs": 17.465999999999998,
"layouts": 2,
"layoutDurationMs": 1.027,
"taskDurationMs": 75.63300000000001,
"heapDeltaBytes": 2947704,
"heapUsedBytes": 65359128,
"domNodes": 127,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 4.772000000000002,
"eventListeners": 27,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
}
]
} |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## cloud/1.52 #16091 +/- ##
=============================================
Coverage ? 81.99%
=============================================
Files ? 1910
Lines ? 109941
Branches ? 31189
=============================================
Hits ? 90146
Misses ? 19452
Partials ? 343
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
690adfb to
61e68e6
Compare
…he policy (#15967) ### The bug The cancelled-plan **Resubscribe** action was gated on the server-resolved `can_reactivate`. `legacy_stripe` workspaces have no capability projection row, so it resolves `false` for them and the button disappears for customers who should have it. `CurrentUserPopoverWorkspace` was the third and last site with this problem — the follow-up promised on the #15675 review thread, which deliberately left this file out of scope. ### The refactor (added in review) Fixing the third site would have made a third verbatim copy of the same expression, so per review feedback the policy is now centralized instead of duplicated in views. `useWorkspaceUI` — which already owns `permissions` — exposes one derived value: ```ts // legacy_stripe workspaces have no capability projection row, so the // server-resolved can_reactivate is false for them and cannot gate the // action; that rail stays on the membership check. const canReactivatePlan = computed(() => isCloud && shouldUseWorkspaceBilling.value ? canReactivate.value : permissions.value.canManageSubscriptionLifecycle ) ``` `SubscriptionPanelContentWorkspace`, `BillingStatusBanner` and `CurrentUserPopoverWorkspace` all consume it; their local copies and now-unused `useBillingRouting` / `isCloud` imports are gone. So the third site is fixed **and** the pre-existing duplication is removed. No import cycle — neither `useBillingRouting` nor `useBillingCapabilities` imports `useWorkspaceUI`. ### Deliberately not folded in `useWorkspaceMenuItems` has a similar-looking expression for **cancel**, but it carries an extra free-tier guard (`can_cancel` stays true for an active FREE plan). Same shape, different policy — left alone. ### Verification - Policy tests live in `useWorkspaceUI.test.ts` now, where the policy does: consolidated rail (uses the capability), legacy rail, and off-Cloud (both fall back to membership). Verified they actually bite by stubbing the policy out — **2 failed**. - The off-Cloud case is new: `isCloud` is `false` by default under vitest and the composable test wasn't mocking it, so that branch had never been exercised. - Component tests keep their behavioural cases and drive the shared value. - On this head: `pnpm typecheck` clean; **127 passing** across the four affected files; full suite `1317/1318` files green — the only failures are 12 pre-existing `check-binary-size` cases that fail independently of this change. (cherry picked from commit 0c89141)
abc766d to
2586e76
Compare
…nt-derived one (Comfy-Org#16967) ## Summary The pricing table decided *which* server capability governs each plan card from client-side state, then read it with a `?? false` default — so a workspace the server was permitting to subscribe rendered every card disabled. This gates on the server capability set directly. Labels are unchanged. ## Root cause `GET /v1/billing/capabilities` answers a **workspace-scoped** question — seven booleans, with `resolved_for` carrying only `{user_id, workspace_id}`. The pricing table needs a **card-scoped** answer: "can this workspace move to Creator-Yearly right now?" Nothing in the response can produce that, so the component synthesized it. `canUsePersonalPlanAction` picked the governing capability from `hasActivePaidPlan(tier)`, `isCurrentPlan()`, `isCancelled` and `isEnded`; `isTeamButtonDisabled` did the same job with a different expression off `isTeamSubscribed`. That selection is policy, and it fails in two ways: **1. The client picks the wrong capability.** A legacy-rail workspace holds a paid tier with no local subscription row. `hasActivePaidPlan` is therefore true, so the table reads `can_change_seats` — false, because `ResolveBillingCapabilities`'s `!HasSubscription` branch clears it — and greys the card. That same branch leaves `can_subscribe_self_serve` **true**, which is what the server actually returns for these workspaces. The field that is true is never consulted. **2. "Not yet known" renders as "denied."** `useBillingCapabilities` models five read states (`idle | pending | denied | unavailable | resolved`), collapses them to `null`, and `canSubscribeSelfServe`/`canChangeSeats` collapse that to `false`. A slow or failed read disables every plan button for anyone, including new signups. `canTopUp` three lines above deliberately falls open for owners, and `canOpenPricingSurface` falls open to membership — so we let people into a modal whose every button is dead by design. The capability set is documented as *"Effective billing UI **guidance**"*, not an authorization boundary; every checkout endpoint resolves policy again on the write. Treating guidance as a hard gate is what turns a server "probably not" into a customer who cannot buy. Both symptoms are invisible in monitoring: a disabled button emits nothing, and the endpoint returns HTTP 200 with the capability false. That is how 560 workspaces accumulated from 2026-02-10 without paging anyone. ``` BEFORE AFTER ┌───────────────────────────────────────┐ ┌───────────────────────────────────────┐ │ card ──> hasActivePaidPlan? ──┬─ yes ─→│ │ card ──> offersTransition? (shape) │ │ │ │ │ │ │ │ │ can_change_seats └──> lifecycleActionPermitted │ └─ no ──→│ │ = subscribe │ │ can_subscribe_self_serve ‖ change_seats │ │ │ │ ‖ reactivate │ │ null/pending/failed ──> ?? false │ │ unresolved ──> true (server decides) │ └───────────────────────────────────────┘ └───────────────────────────────────────┘ ``` ## Why this is better, not just different Three properties hold after this change that did not hold before. **The client can no longer invent a denial the server never made.** Two separate client decisions could each produce a dead button on their own: choosing which capability applies, and defaulting an absent answer to `false`. Both are gone. A CTA now goes dead on permission grounds only when a resolved server response permits no lifecycle write. **The failure mode moves from silent lockout to loud rejection.** A wrongly disabled button emits nothing — no error, no telemetry, no page — which is exactly how this went unnoticed for seven months. A wrongly enabled button produces a failed checkout call that is visible in Datadog and answered by the server. Since the capability set is explicitly guidance and the write re-checks policy, trading the first failure mode for the second is the right direction for a billing surface. **Divergence has one place to go wrong instead of two.** Personal and team carried two hand-written gate expressions over the same capabilities, already disagreeing on how each classified "current plan". They now derive from one base — the personal catalog is that base plus the single write only it can receive — so a capability change cannot fix one surface and silently miss the other. ## Changes - **What**: Per-card capability selection is replaced by one gate per catalog, neither of which reads client subscription state. `lifecycleActionPermitted` (team catalog) asks whether the server permits any write that can reach it: `can_subscribe_self_serve || can_change_seats || can_reactivate`. `personalPlanActionPermitted` (personal catalog) adds `can_downgrade_to_personal`, the one further write that reaches a personal card. Which capabilities belong to a catalog is a static property of the surface, not a judgement about the customer. An unresolved snapshot (`!snapshotAuthoritative`) keeps the CTA live and lets the checkout endpoint enforce — the same trade `canOpenPricingSurface` and `canTopUp` already make. Non-Cloud still routes to workspace permissions. - **What**: `canDowngradeToPersonal` gains the same unresolved-snapshot fallback. It also gates the plan-scope toggle, so under `?? false` a team-plan workspace lost every personal card *and the personal tab with it* before the server had answered — a whole catalog removed silently, not a greyed button. - **What**: `offersTransition` keeps the one genuinely client-side check — an active current plan has no transition to offer. See Review Focus for why no server field replaces it today. - **What**: Fixes the team CTA treating an ended subscription's still-reported credit stop as the current plan. `isTeamCurrentPlanSelected` was previously shadowed by the `!isTeamSubscribed` early return; composing the two flat conditions exposed it. - **Breaking**: none. Cohort outcomes, in the terms of INC-128: | | server returns | before | after | |---|---|---|---| | legacy rail (9,868) | `subscribe: true`, `change_seats: false` | disabled | **enabled** | | stranded checkout row (560) | all lifecycle capabilities false | disabled | disabled | | unresolved / failed read | no answer | disabled | **enabled**, server enforces | | team plan, unresolved read | no answer | personal tab **removed** | tab kept, CTAs live | | team plan, downgrade permitted only | `downgrade: true`, rest false | personal cards disabled | **enabled** (team CTA stays disabled) | It does not flip a single resolved denial into an allow. ## Review Focus **This must not merge before Comfy-Org#8399 is deployed.** Cause 1 of INC-128 is "a declined checkout leaves a `scheduled` row that wedges the customer." Failing open means more attempted checkouts, and any that decline before Comfy-Org#8399 lands create new stranded rows on the path already producing 6–15/day. **Open question, for whoever owns the checkout path (Wei Hai).** If a workspace with `can_subscribe_self_serve: false` calls the checkout-create endpoint directly, does the server reject it, or is the capability the only gate? `useWorkspaceUI.ts:209` asserts *"every checkout endpoint enforces its own policy"* and `canOpenPricingSurface` already relies on it, but I have not verified it in `cloud` and would rather not ship on the comment alone. **One gate is deliberately loosened.** Resubscribe was gated on `canReactivatePlan` (the derived value with the legacy-rail membership fallback from Comfy-Org#16091); it is now gated on the union. A cancelled subscriber with `can_reactivate: false` but `can_subscribe_self_serve: true` can now click it. That is intentional under "the write is the authorization boundary", and it is the change that depends most on the answer above. `disables Resubscribe when the server permits no lifecycle write` covers the closed direction. **Why `offersTransition` stays client-side.** `GET /api/billing/plans` already returns `availability: {available, reason}` per plan, and `reason: same_plan` looks like a drop-in replacement. It is not. `currentPlanSlug` there comes from `GetBillingStatus().PlanSlug`, which is populated for `ended` and `canceled` subscriptions too, so the server marks both **unavailable**. Adopting it would stop an ended plan being buyable again and would disable Resubscribe — two new instances of the exact failure this PR removes. The client already corrects for both (`isCurrentPlan` returns false when `isEnded`; `offersTransition` allows a cancelled current plan). Making `same_plan` subscription-status-aware is the server-side prerequisite, and it belongs next to `Comfy-Org/cloud#6275`, which is already about making `available` agree with the write path. An earlier revision of this description claimed a stranded `scheduled` row could reach `isCurrentPlan` via `/api/billing/status`. That was wrong and is removed: `GetBillingStatus` reads only `ws.ActiveSubscriptionID` and then explicitly skips `scheduled` (`common/repository/billing/workspace.go`), so the 560 cohort's leftover row cannot surface as a plan slug. The asymmetry with `GetCapabilitySubscription`, which deliberately *does* fall back to a scheduled row, is what makes Cause 1 a capability-side problem only. **Explicitly out of scope.** Labels and the subscribe/resubscribe emit still derive from `isCurrentPlan` / `hasActivePaidPlan`. A wrong label is cosmetic and the server revalidates the action; a wrong gate locks someone out. Deciding labels from capabilities is tracked as [FE-2038](https://linear.app/comfyorg/issue/FE-2038/decide-pricing-button-labels-through-capabilities-api), pending Alex's read on whether the current fields cover every UX string. `availability`'s other reasons (`exceeds_max_seats`, and `annual_to_monthly_unsupported` from `cloud#6275`) are additive rather than corrective — they close false positives, not the false negatives this PR is about — so they are deferred too. `Comfy-Org/cloud#8417` adds `denied_reasons`, which is what would let a disabled CTA say *why*. That is the missing half: this stops the wrong buttons being disabled, but a legitimately disabled one still carries no explanation. ## Tests `pnpm vitest run src/platform/workspace src/platform/cloud/subscription src/composables/billing` — 99 files, 1854 tests, 1852 passing. The two failures are in `useFreeTierQuota.test.ts`, which fails identically on `origin/main` and shares no imports with the changed files. `pnpm typecheck`, `pnpm lint` (0 errors), `pnpm knip` clean. Seven regression tests added in `UnifiedPricingTable.test.ts` — one per row of the cohort table, plus the invariants worth pinning: - `keeps a paid plan actionable when only change-seats is withheld` — the legacy-rail case - `keeps the CTA live while the capability snapshot is unresolved` - `keeps personal plans reachable on a team plan while the snapshot is unresolved` - `blocks the CTA when a resolved snapshot permits no lifecycle write` — proves this is not a blanket fail-open - `withholds personal plans when a resolved snapshot denies the downgrade` — the resolved-denial counterpart - `does not let the downgrade capability alone enable the team CTA` - `keeps personal cards actionable when only the downgrade is permitted` — the same capability on the surface it does govern - `keeps the team CTA live while the capability snapshot is unresolved` — the same row, on the other surface The last two guard a cross-repo invariant rather than a reachable bug: `ResolveBillingCapabilities` sets `CanDowngradeToPersonal = IsOriginalOwner && CanSubscribeSelfServe`, and every branch that clears subscribe clears downgrade first, so a true downgrade currently implies a true subscribe. Both directions of the catalog split are pinned so neither silently depends on that holding. `browser_tests/tests/dialogs/pricingTableCapabilityGating.spec.ts` (`@cloud`) drives the real dialog against capability responses shaped like the cohorts, which the unit tests cannot do — they render the table directly, so they prove the expression but not that a customer reaches a live button. **Verified red on the pre-change component**: the legacy-rail, unresolved-read and failed-read cases all fail there. The closed direction is deliberately unit-only, and the spec says why. Every entry point to the catalog — the `?pricing=` deep link, the settings panel link, the user popover — is itself gated on `canOpenPricingSurface`, which resolves to `can_subscribe_self_serve`. A resolved refusal therefore *withholds the dialog* rather than opening it with dead cards; the e2e asserts that as the negative control. It also means the dialog-with-every-button-dead state this incident reported is only reachable through an unresolved read, which is the route this PR fixes. An earlier revision of this section claimed e2e was impossible because `browser_tests` could not construct the account shapes. That was wrong: `setupCloudApp` takes the capability response directly, including a never-resolving promise for the pending case. ## Screenshots AS IS / TO BE captures from the real app to follow in a comment — capture takes a while and I did not want to hold the PR.
Backport of #15967 to
cloud/1.52.Merge order — this PR is stacked
Base is deliberately
backport-15675-to-cloud-1.52, notcloud/1.52. GitHub retargets this PR tocloud/1.52once its parent merges.cloud/1.52→ #15799 → #15803 → #15804 → #15675 → #15967 → #16043 → #16046 → #16067Every commit in this chain cherry-picks cleanly; there are no hand-resolved conflicts anywhere in the stack.
Verification
Run at the tip of the full stack: 93 unit test files, 1745 tests, 0 failures (
src/platform/workspace,src/platform/cloud/subscription,src/composables/useCoreCommands.test.ts,src/components/actionbar).