Repository navigation
feat(account-ui): unstyled CheckoutSteps over the payment projection (FE-2215) - #17663
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe change adds an unstyled ChangesCheckout steps component
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Feature Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant Host
participant CheckoutSteps
participant User
Host->>CheckoutSteps: Provide projection, copy, classes, and slots
CheckoutSteps->>User: Render payment state and available actions
User->>CheckoutSteps: Activate an action
CheckoutSteps->>Host: Emit the corresponding event
Merge Risk: ⚪ Minimal · up to The component’s guarded action behavior, slot accessibility naming, and covered rendering paths do not show a remaining merge-blocking risk. Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error)
✅ Passed checks (6 passed)
Full details: End-To-End Regression Coverage For FixesExplanation The PR includes bug-fix signals in the commit subjects:
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
🌐 Website E2ETip All tests passed.
🎨 Storybook: ✅ Built — View Storybook🎭 Playwright: ❌ 2013 passed, 1 failed · 2 flaky❌ Failed Tests📊 Browser Reports
📦 Bundle: 10 MB gzip ⚪ 0 BDetailsSummary
Category Glance App Entry Points — 3.73 kB (baseline 3.73 kB) • ⚪ 0 BMain entry bundles and manifests Status: 1 unchanged Graph Workspace — 1.44 MB (baseline 1.44 MB) • ⚪ 0 BGraph editor runtime, canvas, workflow orchestration Status: 3 unchanged Views & Navigation — 132 kB (baseline 132 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces Status: 18 unchanged Panels & Settings — 622 kB (baseline 622 kB) • ⚪ 0 BConfiguration panels, inspectors, and settings screens Status: 27 unchanged User & Accounts — 32.3 kB (baseline 32.3 kB) • ⚪ 0 BAuthentication, profile, and account management bundles Status: 11 unchanged Editors & Dialogs — 126 kB (baseline 126 kB) • ⚪ 0 BModals, dialogs, drawers, and in-app editors Status: 8 unchanged UI Components — 123 kB (baseline 123 kB) • ⚪ 0 BReusable component library chunks Status: 16 unchanged Data & Services — 3.73 MB (baseline 3.73 MB) • ⚪ 0 BStores, services, APIs, and repositories Status: 16 unchanged Utilities & Hooks — 560 kB (baseline 560 kB) • ⚪ 0 BHelpers, composables, and utility bundles Status: 37 unchanged Vendor & Third-Party — 18.2 MB (baseline 18.2 MB) • ⚪ 0 BExternal libraries and shared vendor chunks Status: 18 unchanged Other — 17.5 MB (baseline 17.5 MB) • ⚪ 0 BBundles that do not match a named category Status: 296 unchanged ⚡ Performance Report
Show regressions
All metrics
Historical variance (last 15 runs)
Trend (last 15 commits on main)
Raw data{
"timestamp": "2026-09-15T20:47:04.710Z",
"gitSha": "15193d204ee0713ceeae7046d43d5f787c7ddec1",
"branch": "jaewon/fe-2215-phase-4-checkout-steps",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 1990.0030000000015,
"styleRecalcs": 8,
"styleRecalcDurationMs": 7.366,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 458.70300000000003,
"heapDeltaBytes": 5068316,
"heapUsedBytes": 67259444,
"domNodes": -262,
"jsHeapTotalBytes": 4448256,
"scriptDurationMs": 8.239999999999997,
"eventListeners": -154,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "canvas-idle",
"durationMs": 1991.783000000055,
"styleRecalcs": 8,
"styleRecalcDurationMs": 6.817000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 350.185,
"heapDeltaBytes": -4699820,
"heapUsedBytes": 57469640,
"domNodes": -265,
"jsHeapTotalBytes": 4448256,
"scriptDurationMs": 7.765999999999998,
"eventListeners": -154,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1983.5160000000087,
"styleRecalcs": 79,
"styleRecalcDurationMs": 31.088000000000005,
"layouts": 14,
"layoutDurationMs": 4.948,
"taskDurationMs": 967.4909999999999,
"heapDeltaBytes": 6809588,
"heapUsedBytes": 68752524,
"domNodes": -260,
"jsHeapTotalBytes": 6021120,
"scriptDurationMs": 185.52300000000002,
"eventListeners": -188,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1885.9820000000127,
"styleRecalcs": 77,
"styleRecalcDurationMs": 28.470999999999997,
"layouts": 14,
"layoutDurationMs": 4.8549999999999995,
"taskDurationMs": 855.5719999999999,
"heapDeltaBytes": -2466080,
"heapUsedBytes": 59884696,
"domNodes": -265,
"jsHeapTotalBytes": 6283264,
"scriptDurationMs": 169.201,
"eventListeners": -186,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1724.7229999999831,
"styleRecalcs": 30,
"styleRecalcDurationMs": 14.806,
"layouts": 6,
"layoutDurationMs": 1.2059999999999997,
"taskDurationMs": 327.162,
"heapDeltaBytes": 1994284,
"heapUsedBytes": 63587432,
"domNodes": 74,
"jsHeapTotalBytes": 4980736,
"scriptDurationMs": 9.326999999999998,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1686.3939999999502,
"styleRecalcs": 32,
"styleRecalcDurationMs": 15.411000000000001,
"layouts": 6,
"layoutDurationMs": 1.1499999999999997,
"taskDurationMs": 327.558,
"heapDeltaBytes": 2161088,
"heapUsedBytes": 64392652,
"domNodes": 77,
"jsHeapTotalBytes": 4718592,
"scriptDurationMs": 10.21,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "dom-widget-clipping",
"durationMs": 628.2810000000154,
"styleRecalcs": 10,
"styleRecalcDurationMs": 6.654,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 439.6019999999999,
"heapDeltaBytes": 17953768,
"heapUsedBytes": 80070728,
"domNodes": 16,
"jsHeapTotalBytes": 5767168,
"scriptDurationMs": 169.548,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "dom-widget-clipping",
"durationMs": 647.3819999999932,
"styleRecalcs": 11,
"styleRecalcDurationMs": 7.445999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 441.648,
"heapDeltaBytes": 17874644,
"heapUsedBytes": 80087164,
"domNodes": 18,
"jsHeapTotalBytes": 4980736,
"scriptDurationMs": 165.746,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-idle",
"durationMs": 2034.5700000000306,
"styleRecalcs": 5,
"styleRecalcDurationMs": 4.764999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 563.3829999999999,
"heapDeltaBytes": 3757808,
"heapUsedBytes": 83385920,
"domNodes": -247,
"jsHeapTotalBytes": -794624,
"scriptDurationMs": 31.308000000000003,
"eventListeners": -154,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-idle",
"durationMs": 2039.4560000000865,
"styleRecalcs": 7,
"styleRecalcDurationMs": 6.065000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 561.315,
"heapDeltaBytes": 2763516,
"heapUsedBytes": 82732668,
"domNodes": -243,
"jsHeapTotalBytes": -1056768,
"scriptDurationMs": 29.08899999999999,
"eventListeners": -152,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-pan",
"durationMs": 2242.711999999983,
"styleRecalcs": 62,
"styleRecalcDurationMs": 7.643999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1612.437,
"heapDeltaBytes": 13591088,
"heapUsedBytes": 78705716,
"domNodes": 0,
"jsHeapTotalBytes": 487424,
"scriptDurationMs": 856.519,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "large-graph-pan",
"durationMs": 2294.614999999908,
"styleRecalcs": 66,
"styleRecalcDurationMs": 13.495,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1650.421,
"heapDeltaBytes": -1844548,
"heapUsedBytes": 78993540,
"domNodes": -256,
"jsHeapTotalBytes": 1265664,
"scriptDurationMs": 858.0419999999999,
"eventListeners": -182,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-zoom",
"durationMs": 3499.990999999966,
"styleRecalcs": 61,
"styleRecalcDurationMs": 10.030000000000001,
"layouts": 60,
"layoutDurationMs": 12.618,
"taskDurationMs": 1652.6480000000001,
"heapDeltaBytes": 8426000,
"heapUsedBytes": 74175332,
"domNodes": -9,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 789.775,
"eventListeners": 10,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.80000000000109
},
{
"name": "large-graph-zoom",
"durationMs": 3468.9690000000155,
"styleRecalcs": 64,
"styleRecalcDurationMs": 17.77,
"layouts": 60,
"layoutDurationMs": 12.448,
"taskDurationMs": 1573.9779999999998,
"heapDeltaBytes": -8484264,
"heapUsedBytes": 74032776,
"domNodes": -255,
"jsHeapTotalBytes": -794624,
"scriptDurationMs": 789.834,
"eventListeners": -180,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "legacy-node-drag",
"durationMs": 3092.601000000002,
"styleRecalcs": 40,
"styleRecalcDurationMs": 4.687999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1917.8699999999997,
"heapDeltaBytes": 19643364,
"heapUsedBytes": 85977428,
"domNodes": 0,
"jsHeapTotalBytes": 1204224,
"scriptDurationMs": 979.042,
"eventListeners": 188,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666636,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "legacy-node-drag",
"durationMs": 3114.3039999999473,
"styleRecalcs": 42,
"styleRecalcDurationMs": 6.234,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1910.17,
"heapDeltaBytes": 17496596,
"heapUsedBytes": 83208860,
"domNodes": 4,
"jsHeapTotalBytes": 942080,
"scriptDurationMs": 983.978,
"eventListeners": 188,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "minimap-idle",
"durationMs": 2043.4769999999958,
"styleRecalcs": 7,
"styleRecalcDurationMs": 6.908000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 591.599,
"heapDeltaBytes": -6733536,
"heapUsedBytes": 80362688,
"domNodes": -253,
"jsHeapTotalBytes": -233472,
"scriptDurationMs": 28.92199999999999,
"eventListeners": -184,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "minimap-idle",
"durationMs": 2004.9299999999448,
"styleRecalcs": 4,
"styleRecalcDurationMs": 6.138000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 531.182,
"heapDeltaBytes": 19340076,
"heapUsedBytes": 83724144,
"domNodes": -251,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 33.344,
"eventListeners": -152,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 562.6930000000243,
"styleRecalcs": 47,
"styleRecalcDurationMs": 10.046,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 402.7579999999999,
"heapDeltaBytes": 13299904,
"heapUsedBytes": 76517756,
"domNodes": 20,
"jsHeapTotalBytes": 6029312,
"scriptDurationMs": 143.82500000000002,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 554.3410000000222,
"styleRecalcs": 48,
"styleRecalcDurationMs": 11.045,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 361.345,
"heapDeltaBytes": 13792708,
"heapUsedBytes": 76486096,
"domNodes": 22,
"jsHeapTotalBytes": 5242880,
"scriptDurationMs": 145.55800000000002,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-idle",
"durationMs": 2003.8240000000087,
"styleRecalcs": 10,
"styleRecalcDurationMs": 8.133999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 354.1209999999999,
"heapDeltaBytes": 12316496,
"heapUsedBytes": 75577044,
"domNodes": -275,
"jsHeapTotalBytes": 5234688,
"scriptDurationMs": 6.453,
"eventListeners": -200,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-idle",
"durationMs": 2008.0229999999801,
"styleRecalcs": 10,
"styleRecalcDurationMs": 9.709,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 452.09799999999996,
"heapDeltaBytes": 6397016,
"heapUsedBytes": 69484716,
"domNodes": -277,
"jsHeapTotalBytes": 4972544,
"scriptDurationMs": 6.547000000000001,
"eventListeners": -200,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1689.2929999999637,
"styleRecalcs": 78,
"styleRecalcDurationMs": 25.453999999999997,
"layouts": 18,
"layoutDurationMs": 4.838,
"taskDurationMs": 769.1729999999999,
"heapDeltaBytes": -1537832,
"heapUsedBytes": 62077552,
"domNodes": -276,
"jsHeapTotalBytes": 5234688,
"scriptDurationMs": 110.82300000000001,
"eventListeners": -232,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1704.9620000000232,
"styleRecalcs": 77,
"styleRecalcDurationMs": 25.189,
"layouts": 18,
"layoutDurationMs": 4.865,
"taskDurationMs": 751.513,
"heapDeltaBytes": -3585432,
"heapUsedBytes": 59984992,
"domNodes": -274,
"jsHeapTotalBytes": 5234688,
"scriptDurationMs": 103.819,
"eventListeners": -232,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-transition-enter",
"durationMs": 1384.4020000000228,
"styleRecalcs": 18,
"styleRecalcDurationMs": 28.989000000000008,
"layouts": 5,
"layoutDurationMs": 13.072000000000001,
"taskDurationMs": 890.266,
"heapDeltaBytes": 19327636,
"heapUsedBytes": 101488764,
"domNodes": 13587,
"jsHeapTotalBytes": 11272192,
"scriptDurationMs": 30.615000000000002,
"eventListeners": 2387,
"totalBlockingTimeMs": 147,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 8424.005000000023,
"styleRecalcs": 248,
"styleRecalcDurationMs": 35.11,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 5803.402,
"heapDeltaBytes": -11737248,
"heapUsedBytes": 67469792,
"domNodes": -219,
"jsHeapTotalBytes": 5496832,
"scriptDurationMs": 2845.0360000000005,
"eventListeners": -168,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 8350.098000000002,
"styleRecalcs": 249,
"styleRecalcDurationMs": 35.797,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 5754.409,
"heapDeltaBytes": -12602436,
"heapUsedBytes": 67126760,
"domNodes": -243,
"jsHeapTotalBytes": 4448256,
"scriptDurationMs": 2810.749,
"eventListeners": -138,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.80000000000109
},
{
"name": "vue-large-graph-idle",
"durationMs": 16841.949999999997,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 16155.247000000003,
"heapDeltaBytes": -40361680,
"heapUsedBytes": 161323964,
"domNodes": -6546,
"jsHeapTotalBytes": 1253376,
"scriptDurationMs": 247.47800000000004,
"eventListeners": -7478,
"totalBlockingTimeMs": 0,
"frameDurationMs": 18.330000000000048,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-idle",
"durationMs": 16534.539999999994,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 15788.108,
"heapDeltaBytes": -23046592,
"heapUsedBytes": 172865356,
"domNodes": -6542,
"jsHeapTotalBytes": -897024,
"scriptDurationMs": 264.618,
"eventListeners": -7478,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-pan",
"durationMs": 20216.156999999952,
"styleRecalcs": 162,
"styleRecalcDurationMs": 16.276999999999987,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 19937.087,
"heapDeltaBytes": -13219816,
"heapUsedBytes": 187657320,
"domNodes": -6542,
"jsHeapTotalBytes": 397312,
"scriptDurationMs": 882.0409999999999,
"eventListeners": -7474,
"totalBlockingTimeMs": 32,
"frameDurationMs": 17.776666666666763,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-pan",
"durationMs": 20642.98199999996,
"styleRecalcs": 172,
"styleRecalcDurationMs": 17.436000000000007,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 20365.119,
"heapDeltaBytes": -6748804,
"heapUsedBytes": 187716576,
"domNodes": -6546,
"jsHeapTotalBytes": 1970176,
"scriptDurationMs": 899.609,
"eventListeners": -7472,
"totalBlockingTimeMs": 59,
"frameDurationMs": 17.77333333333336,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-node-resize-workload",
"durationMs": 6038.242000000082,
"styleRecalcs": 20,
"styleRecalcDurationMs": 79.09800000000003,
"layouts": 20,
"layoutDurationMs": 22.184999999999995,
"taskDurationMs": 5929.736999999999,
"heapDeltaBytes": -9330944,
"heapUsedBytes": 193304836,
"domNodes": -6542,
"jsHeapTotalBytes": 16666624,
"scriptDurationMs": 110.97900000000001,
"eventListeners": -7474,
"totalBlockingTimeMs": 342,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-node-resize-workload",
"durationMs": 6108.271999999943,
"styleRecalcs": 20,
"styleRecalcDurationMs": 91.09099999999998,
"layouts": 20,
"layoutDurationMs": 23.241999999999997,
"taskDurationMs": 6039.6320000000005,
"heapDeltaBytes": -49103712,
"heapUsedBytes": 171882056,
"domNodes": -6542,
"jsHeapTotalBytes": 3514368,
"scriptDurationMs": 136.72099999999998,
"eventListeners": -7474,
"totalBlockingTimeMs": 346,
"frameDurationMs": 17.776666666666703,
"p95FrameDurationMs": 16.80000000000109
},
{
"name": "vue-zoom-out-idle",
"durationMs": 6297.685999999999,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 5754.9,
"heapDeltaBytes": -2022500,
"heapUsedBytes": 198386700,
"domNodes": 0,
"jsHeapTotalBytes": -14942208,
"scriptDurationMs": 100.323,
"eventListeners": -10,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.223333333333358,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-zoom-out-idle",
"durationMs": 8343.633000000067,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 8010.219000000001,
"heapDeltaBytes": 6375344,
"heapUsedBytes": 184048204,
"domNodes": 0,
"jsHeapTotalBytes": 3145728,
"scriptDurationMs": 126.2080000000001,
"eventListeners": -12,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.779999999999927,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "workflow-execution",
"durationMs": 124.49100000003455,
"styleRecalcs": 9,
"styleRecalcDurationMs": 19.719,
"layouts": 3,
"layoutDurationMs": 1.7429999999999999,
"taskDurationMs": 97.334,
"heapDeltaBytes": 3157376,
"heapUsedBytes": 64869360,
"domNodes": 133,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 7.975999999999999,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "workflow-execution",
"durationMs": 465.8449999999448,
"styleRecalcs": 13,
"styleRecalcDurationMs": 24.192000000000004,
"layouts": 3,
"layoutDurationMs": 0.9390000000000002,
"taskDurationMs": 114.26900000000003,
"heapDeltaBytes": 4877268,
"heapUsedBytes": 67125164,
"domNodes": 119,
"jsHeapTotalBytes": 524288,
"scriptDurationMs": 11.661999999999999,
"eventListeners": 83,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
}
]
}🔬 E2E Coverage
Top 10 files by uncovered lines
|
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #17663 +/- ##
=======================================
Coverage 82.52% 82.52%
=======================================
Files 2811 2812 +1
Lines 140871 140906 +35
Branches 35961 35971 +10
=======================================
+ Hits 116258 116289 +31
- Misses 23410 23414 +4
Partials 1203 1203
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 13 files with indirect coverage changes 🚀 New features to boost your workflow:
|
12c696a to
242ec25
Compare
aabb5da to
2303e95
Compare
…FE-2214) (#17689) ## Why FE-2214's done-when says all three current top-up hosts can integrate the top-up command. #17657 covers ComfyUI_frontend's route (`POST /api/billing/topup`, an operation to poll). Workshop (`apps/website`) and Platform ship on the other route, `POST /api/billing/topup/checkout`: a provider-hosted Checkout session with no `billing_op_id`, credits landing through a webhook. That route could not be decoded with generated schemas until the ingest-types regen #17396 merged; it now carries `CreateTopupCheckoutRequest` / `CreateTopupCheckoutResponse`, so this is the 3A-2 follow-up recorded on FE-2214. Stacked on #17657 (FE-2214 top-up command); merge after it. ## How `createTopupCommand` gains a second method on the same surface, `createHostedTopupCheckout({ amountCents, returnUrl, signal? })`: - input is validated by the generated `zCreateTopupCheckoutRequest`; `INVALID_AMOUNT` / `INVALID_RETURN_URL` are returned before anything is sent - the same capability gate as the in-app command (`ACCESS_DENIED` carrying the server's denial), then the pre-purchase balance is read - one idempotency key per attempt, in the body and on the request; a 404 maps to `NOT_AVAILABLE` so a host keeps its legacy path while `topup_checkout_enabled` is off - `checkout_url` must be https (`validateActionUrl`, the same rule every lifecycle continuation obeys), otherwise `MALFORMED_RESPONSE`; `session_id` passes through when present - nothing is adopted on the lifecycle and no operation id is invented (FE-2214 invariant): the result is `{ url, sessionId?, baselineMicros? }`. The host executes its `OpenUrlMode` on `url` (Workshop pre-opens a tab, Platform redirects) and on return arms the existing `createBalanceWatch` with `baselineMicros`, which is how the test proves completion `readTopupEligibility` (from the fallow split on #17657) now returns the two failures it can actually produce, which is what lets the hosted result union exclude `NO_PAYMENT_METHOD`. ## AS-IS / TO-BE AS-IS: `TopupCommand` exposes `createTopupCheckout` only; Workshop keeps its own `createTopUpCheckout` fetch with a hand-written `zTopUpCheckout` schema, and Platform its own. TO-BE: `TopupCommand` exposes `createHostedTopupCheckout` over the generated contract; a host adapter is a thin wrapper (validate → gate → POST → open → balance watch). No UI in this PR, so no screenshots; the consumer cutover for Workshop is a separate slice. ## Testing Eight new tests under `createHostedTopupCheckout` in `topup.test.ts`: success shape, request body and idempotency key, and no lifecycle operation; `can_top_up` false without a POST; amount and return-URL rejection without a request; 404 → `NOT_AVAILABLE`; missing or non-https URL → `MALFORMED_RESPONSE`; optional session id and baseline omitted when unknown; baseline handed to a balance watch that reconciles on return; no server or provider text on the failure path. Billing core suite 187 passing; oxlint, eslint, oxfmt, `vue-tsc` clean. ## Stack (2026-09-15) Merge top-down. After a parent is squash-merged, rebase each child with `git rebase --onto origin/main <parent tip>` and force-push; GitHub retargets the base. Solid edges are code dependencies, dashed edges are sequencing. ```mermaid flowchart TD P12["Phase 1 + 2 merged<br/>#17436 · #17442 · ingest-types regen #17396"] --> C["FE-2227 Phase 3 core<br/>#17655 · base main"] C --> P0["PR 0 coded error bodies + 3DS driver<br/>#17656"] P0 --> A["FE-2214 top-up command<br/>#17657"] A --> A2["FE-2214 3A-2 hosted top-up checkout<br/>this PR"] P0 --> B1["FE-2223 B1 subscription commands<br/>#17658"] B1 --> B2["FE-2223 B2 eight-state projection<br/>#17659"] A --> I["Integration, do not merge<br/>#17660"] B2 --> I I --> V1["FE-2215 @comfyorg/account-ui composables<br/>#17662"] V1 --> V2["FE-2215 CheckoutSteps<br/>#17663"] I --> SES["core: narrowed BillingSession type<br/>#17664"] SES --> AD1["FE-2216 slice 1 top-up behind a flag<br/>#17665"] A2 -.-> WS["Workshop adapter over createHostedTopupCheckout<br/>later slice"] AD1 -.-> AD2["FE-2216 slice 2 subscription<br/>needs previewSubscribe (FE-2331)"] AD1 --> E["FE-2217 Phase 6 evidence"] BW["billing-web #17370 → #17574"] --> H["FE-2218 Phase 7 separate origin"] AD1 --> H H --> H8["FE-2331 Phase 8 hosted surfaces"] ``` Design: [Billing SDK implementation plan (V2)](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8). Linear: FE-2214.
…river (FE-2227) (#17656) ## Why Stacked on #17655 (FE-2227); merge after it. The two Phase 3 command PRs — top-up ([FE-2214](https://linear.app/comfyorg/issue/FE-2214)) and subscription ([FE-2223](https://linear.app/comfyorg/issue/FE-2223)) — both need to act on the server's coded error (`NO_PAYMENT_METHOD`, `ALREADY_CANCELED`, …) and both need to drive an embedded 3DS challenge through the lifecycle. FE-2223 may not depend on FE-2214, so the shared pieces land here, on the core, and each command PR stacks on this one. ## How - `BillingFailure.serverCode` (additive, optional): `readValidatedBillingResponse` decodes a non-2xx body with the generated `zErrorResponse` and carries only its `code`. The `message` is read by the schema and dropped in `billingErrorBody.ts`, so server text still cannot travel into the SDK. The codes are `z.string()` in the generated contract, so each command owns a closed allowlist of the codes it acts on. - `driveEmbeddedChallenge(lifecycle, operationId, port)`: `reportChallengeStarted` → `port.handleNextAction(clientSecret)` → `reportChallengeSettled`. The port is Stripe's `handleNextAction` shape; no provider SDK is imported in core, the host injects the object. The unmoved-intent denylist (`requires_payment_method | requires_action | canceled` → failed) is ported from `billingOperationStore.runPaymentIntentAction` on this repo's `main` (`src/platform/workspace/stores/billingOperationStore.ts:51-55`, `:555`; landed in `a39b1ce9fa3`, 2026-09-03 — it is not in `cf-main`), and fails toward the server: an unknown status reports completed and the next poll corrects it. ## AS-IS / TO-BE AS-IS: a command sees only `REQUEST_FAILED` + `httpStatus` for a 4xx and cannot tell "no payment method" from "declined"; each command PR would re-implement the 3DS drive over `reportChallenge*`. TO-BE: `result.serverCode === 'NO_PAYMENT_METHOD'` is one comparison; the challenge drive is one call. No UI surface, so no screenshots. ## Testing `packages/account` 473/473. Named tests: coded error carried without its message; non-contract error body yields no code; moved intent → completed; error / unmoved intent / throw → failed; nothing driven without a required embedded challenge. ## Stack (2026-09-14) Merge top-down. After a parent is squash-merged, rebase each child with `git rebase --onto origin/main <parent tip>` and force-push; GitHub retargets the base. Solid edges are code dependencies, dashed edges are sequencing. ```mermaid flowchart TD P12["Phase 1 + 2 merged<br/>#17436 · #17442"] --> C["FE-2227 Phase 3 core<br/>#17655 · base main"] C --> P0["PR 0 coded error bodies + 3DS driver<br/>#17656"] P0 --> A["FE-2214 top-up command<br/>#17657"] P0 --> B1["FE-2223 B1 subscription commands<br/>#17658"] B1 --> B2["FE-2223 B2 eight-state projection<br/>#17659"] A --> I["Integration, do not merge<br/>#17660"] B2 --> I I --> V1["FE-2215 @comfyorg/account-ui composables<br/>#17662"] V1 --> V2["FE-2215 CheckoutSteps<br/>#17663"] I --> SES["core: narrowed BillingSession type<br/>#17664"] SES --> AD1["FE-2216 slice 1 top-up behind a flag<br/>#17665"] AD1 -.-> AD2["FE-2216 slice 2 subscription<br/>needs previewSubscribe + plan-change decision"] AD1 --> E["FE-2217 Phase 6 evidence"] S["FE-2211 salvage tag d059104<br/>before 2026-09-30"] -.-> E BW["billing-web #17370 → #17574"] --> H["FE-2218 Phase 7 separate origin"] AD1 --> H V2 -.-> H AD1 -.-> SPLIT["account-core / account-ui rename PR"] SPLIT -.-> H ```
…FE-2214) (#17689) ## Why FE-2214's done-when says all three current top-up hosts can integrate the top-up command. #17657 covers ComfyUI_frontend's route (`POST /api/billing/topup`, an operation to poll). Workshop (`apps/website`) and Platform ship on the other route, `POST /api/billing/topup/checkout`: a provider-hosted Checkout session with no `billing_op_id`, credits landing through a webhook. That route could not be decoded with generated schemas until the ingest-types regen #17396 merged; it now carries `CreateTopupCheckoutRequest` / `CreateTopupCheckoutResponse`, so this is the 3A-2 follow-up recorded on FE-2214. Stacked on #17657 (FE-2214 top-up command); merge after it. ## How `createTopupCommand` gains a second method on the same surface, `createHostedTopupCheckout({ amountCents, returnUrl, signal? })`: - input is validated by the generated `zCreateTopupCheckoutRequest`; `INVALID_AMOUNT` / `INVALID_RETURN_URL` are returned before anything is sent - the same capability gate as the in-app command (`ACCESS_DENIED` carrying the server's denial), then the pre-purchase balance is read - one idempotency key per attempt, in the body and on the request; a 404 maps to `NOT_AVAILABLE` so a host keeps its legacy path while `topup_checkout_enabled` is off - `checkout_url` must be https (`validateActionUrl`, the same rule every lifecycle continuation obeys), otherwise `MALFORMED_RESPONSE`; `session_id` passes through when present - nothing is adopted on the lifecycle and no operation id is invented (FE-2214 invariant): the result is `{ url, sessionId?, baselineMicros? }`. The host executes its `OpenUrlMode` on `url` (Workshop pre-opens a tab, Platform redirects) and on return arms the existing `createBalanceWatch` with `baselineMicros`, which is how the test proves completion `readTopupEligibility` (from the fallow split on #17657) now returns the two failures it can actually produce, which is what lets the hosted result union exclude `NO_PAYMENT_METHOD`. ## AS-IS / TO-BE AS-IS: `TopupCommand` exposes `createTopupCheckout` only; Workshop keeps its own `createTopUpCheckout` fetch with a hand-written `zTopUpCheckout` schema, and Platform its own. TO-BE: `TopupCommand` exposes `createHostedTopupCheckout` over the generated contract; a host adapter is a thin wrapper (validate → gate → POST → open → balance watch). No UI in this PR, so no screenshots; the consumer cutover for Workshop is a separate slice. ## Testing Eight new tests under `createHostedTopupCheckout` in `topup.test.ts`: success shape, request body and idempotency key, and no lifecycle operation; `can_top_up` false without a POST; amount and return-URL rejection without a request; 404 → `NOT_AVAILABLE`; missing or non-https URL → `MALFORMED_RESPONSE`; optional session id and baseline omitted when unknown; baseline handed to a balance watch that reconciles on return; no server or provider text on the failure path. Billing core suite 187 passing; oxlint, eslint, oxfmt, `vue-tsc` clean. ## Stack (2026-09-15) Merge top-down. After a parent is squash-merged, rebase each child with `git rebase --onto origin/main <parent tip>` and force-push; GitHub retargets the base. Solid edges are code dependencies, dashed edges are sequencing. ```mermaid flowchart TD P12["Phase 1 + 2 merged<br/>#17436 · #17442 · ingest-types regen #17396"] --> C["FE-2227 Phase 3 core<br/>#17655 · base main"] C --> P0["PR 0 coded error bodies + 3DS driver<br/>#17656"] P0 --> A["FE-2214 top-up command<br/>#17657"] A --> A2["FE-2214 3A-2 hosted top-up checkout<br/>this PR"] P0 --> B1["FE-2223 B1 subscription commands<br/>#17658"] B1 --> B2["FE-2223 B2 eight-state projection<br/>#17659"] A --> I["Integration, do not merge<br/>#17660"] B2 --> I I --> V1["FE-2215 @comfyorg/account-ui composables<br/>#17662"] V1 --> V2["FE-2215 CheckoutSteps<br/>#17663"] I --> SES["core: narrowed BillingSession type<br/>#17664"] SES --> AD1["FE-2216 slice 1 top-up behind a flag<br/>#17665"] A2 -.-> WS["Workshop adapter over createHostedTopupCheckout<br/>later slice"] AD1 -.-> AD2["FE-2216 slice 2 subscription<br/>needs previewSubscribe (FE-2331)"] AD1 --> E["FE-2217 Phase 6 evidence"] BW["billing-web #17370 → #17574"] --> H["FE-2218 Phase 7 separate origin"] AD1 --> H H --> H8["FE-2331 Phase 8 hosted surfaces"] ``` Design: [Billing SDK implementation plan (V2)](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8). Linear: FE-2214.
242ec25 to
de6515e
Compare
2303e95 to
9b2241c
Compare
) ## Why Stacked on B1 (`jaewon/fe-2223-phase-3b-subscription-commands-and-eight-state-payment`, #17658) → PR 0 (`jaewon/fe-2227-core-error-codes-and-challenge-driver`, #17656) → #17655 (FE-2227); independent of FE-2214; merge after all parents. Phase 3B, part 2 of 2: the eight public payment states as a pure projection of one lifecycle operation, plus the copy keys behind them. Split out of B1 to keep each PR under the source budget. - Linear: https://linear.app/comfyorg/issue/FE-2223 ## How New `packages/account/src/core/billing/paymentProjection.ts` and `paymentCopy.ts` (+ tests), export lines appended to `index.ts`. No other core file is touched. `projectPaymentStep(operation | undefined, hostStep: 'select' | 'preview' | 'canceled')` → `{ step, reasonKey?, recoveryAction?, operationId?, noChargeConfirmed }` over the eight states `select | preview | verifying | canceled | declined | processing_error | payment_received_hold | success`. - No operation → the host's step. Pending: parked on the customer (`challenge` or `actionUrl`) → `verifying`; a retryable decline (`declineReason`, or this tab's failed challenge → `authentication_failed`) → `declined`; otherwise `preview`. `succeeded` → `success`; `failed` → `declined`, except `processing_error` / `generic` → `processing_error`; `timed_out` → `processing_error` (`generic`); `superseded` → `select`. - Reason keys are the generated `decline_reason` enum plus `checkout_expired` and `generic`; copy keys are `billing.reason.<key>`. No raw text can become a key. - `paymentCopy.ts` ports the PoC `copy.ts` semantics: `DEFAULT_PAYMENT_COPY`, `createPaymentCopy(overrides)` where the safety line `billing.safety.nothing_was_charged` is not host-overridable, and `paymentCopyKeys(projection)` which names the safety key only for `canceled` with `noChargeConfirmed`. - `noChargeConfirmed` is always `false`: the generated contract has no field that lets a terminal backend result guarantee no current or later charge (one short comment in code says so). Relates to the BE cancel endpoint work (BE-10064). Tests: every projection row (24 via `it.for`, including the host-cancel precedence rows and a sweep asserting `noChargeConfirmed` is never true and `payment_received_hold` is never produced) and the copy gate (3, including the PoC TP-12 port). ## Review focus Two decisions the plan left open, made here: 1. Lifecycle `reconciliation_needed` projects to `processing_error` (`generic`) with `operationId` surfaced, not to `payment_received_hold`. The contract cannot tell "paid, entitlement pending" from "needs a human"; the id is what support acts on. `payment_received_hold` stays in the public union and copy table but has no producing row until the backend distinguishes the two. 2. `canceled` is reached only through the host: `hostStep` accepts `'canceled'` for a cancel the host observed (closed page, dismissed challenge). A server verdict (`succeeded`, `failed`, `reconciliation_needed`) outranks it — a customer who backs out after the charge went through still sees the result — while pending, `timed_out`, and `superseded` yield to it. Ticket vs generated contract: - `checkout_expired` has no producing row: `BillingOpStatusResponse.status` has no `expired` value. The key and its copy are kept for the host and for the backend adding one. - `noChargeConfirmed` has no source field, so it is a `boolean` that is always `false` (a literal `false` type makes the copy gate dead by type and fails `no-unnecessary-condition`). ## AS-IS / TO-BE No UI surface, no screenshots. AS-IS: the PoC reducer derived these states from an invented operation status set (`expired`, `canceled`, `payment_received_hold`) and matched raw `error_message` text for reasons. TO-BE: a pure projection over the real `BillingOperationState`; hosts render `step`/`reasonKey`/`operationId` and localize by copy key. ## Stack (2026-09-14) Merge top-down. After a parent is squash-merged, rebase each child with `git rebase --onto origin/main <parent tip>` and force-push; GitHub retargets the base. Solid edges are code dependencies, dashed edges are sequencing. ```mermaid flowchart TD P12["Phase 1 + 2 merged<br/>#17436 · #17442"] --> C["FE-2227 Phase 3 core<br/>#17655 · base main"] C --> P0["PR 0 coded error bodies + 3DS driver<br/>#17656"] P0 --> A["FE-2214 top-up command<br/>#17657"] P0 --> B1["FE-2223 B1 subscription commands<br/>#17658"] B1 --> B2["FE-2223 B2 eight-state projection<br/>#17659"] A --> I["Integration, do not merge<br/>#17660"] B2 --> I I --> V1["FE-2215 @comfyorg/account-ui composables<br/>#17662"] V1 --> V2["FE-2215 CheckoutSteps<br/>#17663"] I --> SES["core: narrowed BillingSession type<br/>#17664"] SES --> AD1["FE-2216 slice 1 top-up behind a flag<br/>#17665"] AD1 -.-> AD2["FE-2216 slice 2 subscription<br/>needs previewSubscribe + plan-change decision"] AD1 --> E["FE-2217 Phase 6 evidence"] S["FE-2211 salvage tag d059104<br/>before 2026-09-30"] -.-> E BW["billing-web #17370 → #17574"] --> H["FE-2218 Phase 7 separate origin"] AD1 --> H V2 -.-> H AD1 -.-> SPLIT["account-core / account-ui rename PR"] SPLIT -.-> H ```
…(FE-2223) (#17658) ## Why ```mermaid flowchart TD P12["Phase 1 + 2 merged<br/>#17436 · #17442"] --> C["FE-2227 Phase 3 core<br/>#17655 · base main"] C --> P0["PR 0 coded error bodies + 3DS driver<br/>#17656"] P0 --> A["FE-2214 top-up command<br/>#17657"] P0 --> B1["FE-2223 B1 subscription commands<br/>#17658"] B1 --> B2["FE-2223 B2 eight-state projection<br/>#17659"] A --> I["Integration, do not merge<br/>#17660"] B2 --> I I --> V1["FE-2215 @comfyorg/account-ui composables<br/>#17662"] V1 --> V2["FE-2215 CheckoutSteps<br/>#17663"] I --> SES["core: narrowed BillingSession type<br/>#17664"] SES --> AD1["FE-2216 slice 1 top-up behind a flag<br/>#17665"] AD1 -.-> AD2["FE-2216 slice 2 subscription<br/>needs previewSubscribe + plan-change decision"] AD1 --> E["FE-2217 Phase 6 evidence"] S["FE-2211 salvage tag d059104<br/>before 2026-09-30"] -.-> E BW["billing-web #17370 → #17574"] --> H["FE-2218 Phase 7 separate origin"] AD1 --> H V2 -.-> H AD1 -.-> SPLIT["account-core / account-ui rename PR"] SPLIT -.-> H ``` Stacked on PR 0 (`jaewon/fe-2227-core-error-codes-and-challenge-driver`, #17656) → #17655 (FE-2227); independent of FE-2214; merge after both parents. Phase 3B, part 1 of 2: the subscription commands ported onto the SDK-owned billing operation lifecycle. Part 2 (the eight-state payment projection and copy) is stacked on this PR so each stays under the source budget. - Linear: https://linear.app/comfyorg/issue/FE-2223 ## How New `packages/account/src/core/billing/subscriptionCommands.ts` (+ test), export lines appended to `index.ts`. No other core file is touched. `createBillingCommands({ transport, lifecycle, statusReader, capabilities, credits, idempotencyKey? })` returns `subscribe`, `resubscribe`, `cancelSubscription`, `openPaymentPortal`. - Every command encodes against the generated contract (`zSubscribeRequest/Response`, `zResubscribeResponse`, `zCancelSubscriptionResponse2` = the generated union of `zCancelSubscriptionResponse | zCancelSubscriptionAcceptedResponse`, `zPaymentPortalResponse`), reads through `readValidatedBillingResponse`, and issues through `lifecycle.begin` — single-flight, the status gate, backend-pending adoption, polling, routing, pointer, recovery, and telemetry all stay in core. The command then awaits `lifecycle.settled(id)` and returns the terminal state. - Eligibility comes from the Phase 2 status snapshot's server fields only (`is_active`, `subscription_tier`, `subscription_status`): FREE → subscribe issues; PRO active → subscribe is a no-op success with no request; PRO canceled → subscribe routes to the resubscribe endpoint. - Saved payment method: `saved_payment_method_id` XOR `confirmation_token`, empty strings dropped, both present → `CONFLICTING_PAYMENT_METHOD` before any request (before the status read too); a request the generated schema refuses (e.g. an id without the `pm_` prefix) → `INVALID_REQUEST`, also before any request. - Response mapping: `subscribed` and resubscribe `active` still adopt the id so the first poll settles it and invalidation/telemetry are uniform; `needs_payment_method` hands `payment_method_url` to the lifecycle as the hosted `actionUrl` (missing → `MISSING_PAYMENT_METHOD_URL`); `pending_payment` / `pending` / both cancel shapes → observed to a terminal state. 3DS is driven by the host through the existing `driveEmbeddedChallenge` while the command awaits settlement (tested end to end through the real lifecycle). - Server codes (via `BillingFailure.serverCode`): `REACTIVATION_CONFIRMATION_REQUIRED` → coded result for the host to re-preview and resend with `confirm_reactivation`; `ALREADY_CANCELED` / `NOT_SCHEDULED_FOR_CANCELLATION` from a 4xx → already-in-requested-state success after a status re-read (a 5xx echoing the code stays a failure, as in `useWorkspaceBilling.isAlreadyInRequestedState`); `NO_ACTIVE_SUBSCRIPTION` → coded error. Command-level codes live in `SubscriptionCommandCode`; `BillingErrorCode` is untouched. - Every succeeded outcome (settled operation or already-in-state) invalidates the capabilities read and re-reads credits and status (so `cancel_at` is available after a cancel). A failed credits read never turns a success into a failure. - `idempotency_key` goes in every subscribe/resubscribe/cancel body and as `idempotencyKey` on the `BillingRequest` (the transport's 401 replay gate), one key per attempt. The portal request carries neither (the contract has no key; a portal session is not a mutation). - `openPaymentPortal` returns `{ url }` after `validateActionUrl` (https only); the SDK never opens it and does not refresh anything on it. - Raw server / provider text (`message`, `error_message`) never reaches a result; asserted in the decline, 5xx, coded-error, and resubscribe (`message` field) tests. Tests (32, one per ticket row): the {FREE, PRO active, PRO canceled} × {subscribe, resubscribe, cancel, portal} matrix including subscribe→resubscribe routing; saved payment method (4); 3DS through `driveEmbeddedChallenge`, hosted page, missing page; declines and reactivation; both cancel response shapes and the 5xx echo; transport failure, malformed 2xx, 5xx, failed eligibility read; reconciliation; and reload/resume, poll timeout, and workspace supersession through the real lifecycle with fake timers. ## Review focus - Subscribe reads status once for eligibility and `lifecycle.begin` reads it again for its own pending gate: two `GET /billing/status` per subscribe. Avoiding it would need a core change (letting `begin` accept a status), which this PR deliberately does not make. - Per the eligibility doc, a PRO-active subscribe is a no-op regardless of `plan_slug`; a plan change on an active subscription (the app's `checkoutType: 'change'`) is therefore not reachable through this command yet. Flagged, not silently decided. - A `needs_payment_method` without a URL is refused without adopting the id; the backend still reports it as pending, so the next `begin`/`recover` adopts it rather than reissuing. Ticket vs generated contract: - The ticket's resubscribe "`active` → sync success without an id" is unreachable: `zResubscribeResponse.billing_op_id` is required, so the id is adopted uniformly. - `zPaymentPortalRequest` has no `idempotency_key`; the portal POST is sent without one. ## AS-IS / TO-BE No UI surface, no screenshots. AS-IS: subscription commands live in the cloud app (`workspaceApi`, `useSubscriptionCheckout`, `useWorkspaceBilling`) with their own polling, pending-checkout storage, and error-string handling. TO-BE: `@comfyorg/account/billing` exports `createBillingCommands`; hosts issue commands and render the lifecycle state, never own the machine, and never see server text. ## Stack (2026-09-14) Merge top-down. After a parent is squash-merged, rebase each child with `git rebase --onto origin/main <parent tip>` and force-push; GitHub retargets the base. Solid edges are code dependencies, dashed edges are sequencing. ```mermaid flowchart TD P12["Phase 1 + 2 merged<br/>#17436 · #17442"] --> C["FE-2227 Phase 3 core<br/>#17655 · base main"] C --> P0["PR 0 coded error bodies + 3DS driver<br/>#17656"] P0 --> A["FE-2214 top-up command<br/>#17657"] P0 --> B1["FE-2223 B1 subscription commands<br/>#17658"] B1 --> B2["FE-2223 B2 eight-state projection<br/>#17659"] A --> I["Integration, do not merge<br/>#17660"] B2 --> I I --> V1["FE-2215 @comfyorg/account-ui composables<br/>#17662"] V1 --> V2["FE-2215 CheckoutSteps<br/>#17663"] I --> SES["core: narrowed BillingSession type<br/>#17664"] SES --> AD1["FE-2216 slice 1 top-up behind a flag<br/>#17665"] AD1 -.-> AD2["FE-2216 slice 2 subscription<br/>needs previewSubscribe + plan-change decision"] AD1 --> E["FE-2217 Phase 6 evidence"] S["FE-2211 salvage tag d059104<br/>before 2026-09-30"] -.-> E BW["billing-web #17370 → #17574"] --> H["FE-2218 Phase 7 separate origin"] AD1 --> H V2 -.-> H AD1 -.-> SPLIT["account-core / account-ui rename PR"] SPLIT -.-> H ```
…FE-2214) (#17689) FE-2214's done-when says all three current top-up hosts can integrate the top-up command. #17657 covers ComfyUI_frontend's route (`POST /api/billing/topup`, an operation to poll). Workshop (`apps/website`) and Platform ship on the other route, `POST /api/billing/topup/checkout`: a provider-hosted Checkout session with no `billing_op_id`, credits landing through a webhook. That route could not be decoded with generated schemas until the ingest-types regen #17396 merged; it now carries `CreateTopupCheckoutRequest` / `CreateTopupCheckoutResponse`, so this is the 3A-2 follow-up recorded on FE-2214. Stacked on #17657 (FE-2214 top-up command); merge after it. `createTopupCommand` gains a second method on the same surface, `createHostedTopupCheckout({ amountCents, returnUrl, signal? })`: - input is validated by the generated `zCreateTopupCheckoutRequest`; `INVALID_AMOUNT` / `INVALID_RETURN_URL` are returned before anything is sent - the same capability gate as the in-app command (`ACCESS_DENIED` carrying the server's denial), then the pre-purchase balance is read - one idempotency key per attempt, in the body and on the request; a 404 maps to `NOT_AVAILABLE` so a host keeps its legacy path while `topup_checkout_enabled` is off - `checkout_url` must be https (`validateActionUrl`, the same rule every lifecycle continuation obeys), otherwise `MALFORMED_RESPONSE`; `session_id` passes through when present - nothing is adopted on the lifecycle and no operation id is invented (FE-2214 invariant): the result is `{ url, sessionId?, baselineMicros? }`. The host executes its `OpenUrlMode` on `url` (Workshop pre-opens a tab, Platform redirects) and on return arms the existing `createBalanceWatch` with `baselineMicros`, which is how the test proves completion `readTopupEligibility` (from the fallow split on #17657) now returns the two failures it can actually produce, which is what lets the hosted result union exclude `NO_PAYMENT_METHOD`. AS-IS: `TopupCommand` exposes `createTopupCheckout` only; Workshop keeps its own `createTopUpCheckout` fetch with a hand-written `zTopUpCheckout` schema, and Platform its own. TO-BE: `TopupCommand` exposes `createHostedTopupCheckout` over the generated contract; a host adapter is a thin wrapper (validate → gate → POST → open → balance watch). No UI in this PR, so no screenshots; the consumer cutover for Workshop is a separate slice. Eight new tests under `createHostedTopupCheckout` in `topup.test.ts`: success shape, request body and idempotency key, and no lifecycle operation; `can_top_up` false without a POST; amount and return-URL rejection without a request; 404 → `NOT_AVAILABLE`; missing or non-https URL → `MALFORMED_RESPONSE`; optional session id and baseline omitted when unknown; baseline handed to a balance watch that reconciles on return; no server or provider text on the failure path. Billing core suite 187 passing; oxlint, eslint, oxfmt, `vue-tsc` clean. Merge top-down. After a parent is squash-merged, rebase each child with `git rebase --onto origin/main <parent tip>` and force-push; GitHub retargets the base. Solid edges are code dependencies, dashed edges are sequencing. ```mermaid flowchart TD P12["Phase 1 + 2 merged<br/>#17436 · #17442 · ingest-types regen #17396"] --> C["FE-2227 Phase 3 core<br/>#17655 · base main"] C --> P0["PR 0 coded error bodies + 3DS driver<br/>#17656"] P0 --> A["FE-2214 top-up command<br/>#17657"] A --> A2["FE-2214 3A-2 hosted top-up checkout<br/>this PR"] P0 --> B1["FE-2223 B1 subscription commands<br/>#17658"] B1 --> B2["FE-2223 B2 eight-state projection<br/>#17659"] A --> I["Integration, do not merge<br/>#17660"] B2 --> I I --> V1["FE-2215 @comfyorg/account-ui composables<br/>#17662"] V1 --> V2["FE-2215 CheckoutSteps<br/>#17663"] I --> SES["core: narrowed BillingSession type<br/>#17664"] SES --> AD1["FE-2216 slice 1 top-up behind a flag<br/>#17665"] A2 -.-> WS["Workshop adapter over createHostedTopupCheckout<br/>later slice"] AD1 -.-> AD2["FE-2216 slice 2 subscription<br/>needs previewSubscribe (FE-2331)"] AD1 --> E["FE-2217 Phase 6 evidence"] BW["billing-web #17370 → #17574"] --> H["FE-2218 Phase 7 separate origin"] AD1 --> H H --> H8["FE-2331 Phase 8 hosted surfaces"] ``` Design: [Billing SDK implementation plan (V2)](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8). Linear: FE-2214.
de6515e to
f9a1c37
Compare
9b2241c to
bb3aaa9
Compare
…4) (#17657) ## Why Stacked on PR 0 (`jaewon/fe-2227-core-error-codes-and-challenge-driver`, #17656) → #17655 (FE-2227); merge after both. Phase 3A of the billing SDK: the top-up command mapped onto the shared operation lifecycle, covering both routes cloud exposes today. Only request/response mapping lives here — the status-read gate, single-flight, polling, routing, the pointer, failure meaning, and telemetry all come from the lifecycle in #17655/#17656 and are not duplicated. - Linear: https://linear.app/comfyorg/issue/FE-2214 ## How `packages/account/src/core/billing/topup.ts` — `createTopupCommand({ transport, lifecycle, capabilities, credits, idempotencyKey? })` returning two commands on one surface: **`createTopupCheckout({ amountCents, signal? })`** — the in-app route ComfyUI_frontend uses (`POST /billing/topup`, an operation to observe): 1. `capabilities.read()` → `can_top_up === false` ⇒ `{ status: 'error', code: 'ACCESS_DENIED', denial? }` without a POST. The server flag is the only gate; nothing is derived. 2. Amount validated with `zCreateTopupRequest`; the plain input object is what travels (the schema coerces to bigint, which the transport cannot serialize). 3. One fresh key per POST attempt, in the body (`idempotency_key`) and as `idempotencyKey` on the `BillingRequest`. Supplying that key is what makes the POST replayable at the transport's 401 gate (`replayable = method === 'GET' || idempotencyKey !== undefined`): the single 401 replay is safe *because* the same key travels in both places for the backend to deduplicate on. Backend dedup is load-bearing on this route, not incidental. A fresh key is minted per attempt, so two user-initiated top-ups never collide. 4. POST through `lifecycle.begin('topup', issue)`; the response is decoded with `zCreateTopupResponse` and its `billing_op_id` adopted regardless of `status`, so the first poll settles synchronous results and carries the coded decline. 5. Command-level `TopupResult` union: `ok` (terminal `succeeded` state embedded + `creditsReconciled`), `declined` (terminal `failed` state embedded: `declineReason`, `recoveryAction`, `retryable`), `unsettled` (`timed_out` / `reconciliation_needed` embedded), plus `error` codes — the core `BillingErrorCode`s untouched, and `NOT_AVAILABLE` (404 on the POST), `NO_PAYMENT_METHOD` (`serverCode`, with `recoveryAction: 'replace_payment_method'`), `INVALID_AMOUNT` (below the generated minimum; nothing sent). A `superseded` operation passes through as `SUPERSEDED`. 6. On `succeeded`: `capabilities.invalidate()` and a credits re-read; `creditsReconciled` compares it with the read taken before the POST. **`createHostedTopupCheckout({ amountCents, returnUrl, signal? })`** — the hosted route Workshop (`apps/website`) and Platform ship on (`POST /billing/topup/checkout`, a provider-hosted Checkout session with no operation; credits land through a webhook). Decodable since the ingest-types regen #17396 merged: 1. Input validated by the generated `zCreateTopupCheckoutRequest`; `INVALID_AMOUNT` / `INVALID_RETURN_URL` before anything is sent. 2. The same capability gate, then the pre-purchase balance is read. 3. One idempotency key per attempt, in the body and on the request; 404 → `NOT_AVAILABLE` so a host keeps its legacy path while `topup_checkout_enabled` is off. 4. `checkout_url` must be https (`validateActionUrl`, the rule every lifecycle continuation obeys), otherwise `MALFORMED_RESPONSE`; `session_id` passes through when present. 5. Nothing is adopted on the lifecycle and no operation id is invented: the result is `{ url, sessionId?, baselineMicros? }`. The host executes its `OpenUrlMode` on `url` (Workshop pre-opens a tab, Platform redirects) and on return arms `createBalanceWatch` with `baselineMicros`. `packages/account/src/core/billing/balanceWatch.ts` — `createBalanceWatch({ credits, baselineMicros? })`, the framework-free port of `src/composables/billing/topupBalanceRefresh.ts` (gaps `[0, 2, 5, 10, 20]s`, 15-minute lifetime, 5 scheduled runs, a single read per wake past the cap). No document listeners: the host calls `wake()` from its own focus/visibility signals. This is the completion path for the hosted command and the explicit fallback when no `billing_op_id` can be observed on the in-app one; the SDK never invents one. Raw server / Stripe text never reaches a result (asserted in the tests). Contract findings (generated contract wins; for FE-2211's TDD-correction list): - The ticket's `returnUrl` and "no `billing_op_id`" rows describe the hosted route, not `zCreateTopupRequest` (which has only `amount_cents`, `checkout_attempt_id`, `idempotency_key`). They are served by `createHostedTopupCheckout`. - `zCreateTopupResponse.billing_op_id` is required, so the in-app command's balance-watch fallback is tested against a `MALFORMED_RESPONSE` on the POST, not an invented id. - The plan's `credits.read({ forceRefresh })` does not exist: `CreditsReader.read` always requests, so it is called plainly. - `amount_cents` is `z.coerce.bigint()` on both request schemas; validated with `safeParse`, sent as the number. - `ErrorResponse.code` is `z.string()`, not an enum, so `NO_PAYMENT_METHOD` is an SDK-owned allowlist entry. Tests (`topup.test.ts`, `balanceWatch.test.ts`), one per ticket row for the in-app command: `can_top_up` false, saved payment method, needs 3DS (driven through PR 0's `driveEmbeddedChallenge`), no payment method, declined, unexpected error, payment received with credits pending, 404 → `NOT_AVAILABLE` (and a 404 while polling left to the lifecycle), fresh idempotency key per attempt, in the body and on the request, generated-schema rejection, invalidation on success, scope supersession passthrough, no-`billing_op_id` balance-watch fallback. For the hosted command: success shape with request body, idempotency key, and no lifecycle operation; `can_top_up` false without a POST; amount and return-URL rejection without a request; 404 → `NOT_AVAILABLE`; missing or non-https URL → `MALFORMED_RESPONSE`; optional session id and baseline omitted when unknown; baseline handed to a balance watch that reconciles on return; no server text on the failure path. Reload/resume, routing, timeout, and duplicate-poll coverage stays in the core suite. ## AS-IS / TO-BE No UI surface, no screenshots. - AS-IS: the SDK exposes the lifecycle but no command issues a top-up on it; the cloud app's `workspaceApi.createTopup` + `topupBalanceRefresh`, Workshop's `createTopUpCheckout` fetch with a hand-written schema, and Platform's own call remain the only paths. - TO-BE: `@comfyorg/account/billing` exports `createTopupCommand` (in-app and hosted top-up over the generated contract) and `createBalanceWatch`; each host adapter is a thin wrapper that reads a coded, text-free result. Consumer cutovers are separate slices (ComfyUI_frontend: #17665; Workshop and Platform: later). ## Stack (2026-09-15) Merge top-down. After a parent is squash-merged, rebase each child with `git rebase --onto origin/main <parent tip>` and force-push; GitHub retargets the base. Solid edges are code dependencies, dashed edges are sequencing. The hosted command (formerly #17689) is squashed into this PR. ```mermaid flowchart TD P12["Phase 1 + 2 merged<br/>#17436 · #17442 · ingest-types regen #17396"] --> C["FE-2227 Phase 3 core<br/>#17655 · base main"] C --> P0["PR 0 coded error bodies + 3DS driver<br/>#17656"] P0 --> A["FE-2214 top-up commands, in-app + hosted<br/>#17657"] P0 --> B1["FE-2223 B1 subscription commands<br/>#17658"] B1 --> B2["FE-2223 B2 eight-state projection<br/>#17659"] A --> I["Integration, do not merge<br/>#17660"] B2 --> I I --> V1["FE-2215 @comfyorg/account-ui composables<br/>#17662"] V1 --> V2["FE-2215 CheckoutSteps<br/>#17663"] I --> SES["core: narrowed BillingSession type<br/>#17664"] SES --> AD1["FE-2216 slice 1 top-up behind a flag<br/>#17665"] A -.-> WS["Workshop adapter over createHostedTopupCheckout<br/>consumer slice"] AD1 -.-> AD2["FE-2216 slice 2 subscription<br/>needs previewSubscribe (FE-2331)"] AD1 --> E["FE-2217 Phase 6 evidence"] BW["billing-web #17370 → #17574"] --> H["FE-2218 Phase 7 separate origin"] AD1 --> H V2 -.-> H H --> H8["FE-2331 Phase 8 hosted surfaces"] ```
f9a1c37 to
d08dca9
Compare
3fc1d48 to
1838891
Compare
|
Rebased onto the new #17662 tip (370ddb3), which added No change to this PR's own content: 3fc1d48 -> 1838891, same five files, same 261 insertions. |
370ddb3 to
027ff84
Compare
f52b603 to
9f277b1
Compare
christian-byrne
left a comment
There was a problem hiding this comment.
source_url: #17663
type: github_pr_review
date_accessed: 2026-09-15
relevance: 4
note: Approval body for 17663 (unstyled CheckoutSteps, FE-2215).
Approving. No findings.
I came to this looking for one thing in particular. noChargeConfirmed is the invariant I chased on #17659 — the projection never sets it, deliberately, because the operation state cannot prove no money moved. This is the first component that could quietly bypass that by rendering the safety key directly instead of going through the gate.
It doesn't. keys = computed(() => paymentCopyKeys(projection)) and the template renders v-if="keys.safety", so the line exists only when the projection unlocked it.
The part I did not expect is better than the part I checked for:
it('shows the safety line only when the projection confirms it, and never a host version of it', …)
copy: { 'billing.safety.nothing_was_charged': 'Relax, no charge.' }
…
expect(screen.queryByText('Relax, no charge.')).toBeNull()A host can localize every other key and cannot substitute its own wording for this one. That is the right call and a subtle one: everything else on this surface is copy, but "nothing was charged" is a claim about the user's money, and a host paraphrasing it — "you're all set", "no worries" — would be asserting something softer or wronger than the SDK is willing to assert. Locking the one sentence that must be exact, while leaving the rest overridable, is a sharper distinction than "the SDK owns copy".
Also verified: no serverCode and no server text anywhere in the component, so the #17656 contract holds through to the last layer that could break it.
Read rather than ran — @vitejs/plugin-vue is not installed in my checkout's workspace tree for this new package, which is my environment rather than your branch. CI is green and is the verification run.
…own-origin session and v1 surfaces (#17799) Linear FE-2331. Stacked on #17798 (readers); carries #17797 (previewSubscribe, now on main) until #17798 lands. #17807 (billing-web own-origin session + sign-in) and #17809 (billing-web /v1 surfaces) were squash-merged into this branch, so this PR is the whole Phase 8 view layer: account-ui composables, the billing-web session/sign-in, and the subscription / payment-method surfaces. ## Why The plans catalog, the saved cards and the subscription quote are the three reads the hosted billing surfaces are built on, and the core now exposes all three. Nothing in the view layer could reach them: `BillingClient` carried only the balance, capability and status readers, so a host wanting a price had to call the core directly and invent its own loading, failure and cancellation handling per screen. ## How - `BillingClient` gains `plans` and `paymentMethods`; `disposeBillingClient` disposes both, so a sign-out or workspace switch cannot leave a catalog or a card list serving the previous scope. - `usePlans` and `usePaymentMethods` follow `useCredits`: seeded from the reader's snapshot, `immediate` by default, and a failed refresh keeps the last good value beside the failure rather than blanking the screen. `usePaymentMethods` also exposes `defaultMethod` and `invalidateAndRefresh`, for a host coming back from the payment portal where a card was added or removed. - `usePreviewSubscribe` is on-demand and single-flight: each `quote` aborts the one before it through an `AbortController`, and only the latest settles into `preview`/`failure`, so a slow price for a plan the user has moved off never lands on screen. - The app composition root builds both readers and adds them to `dispose()`, keeping the two scope-holder lists in step. Commands stay unwired here. ## AS-IS / TO-BE No UI change. These are headless composables; nothing renders them yet. ## Testing `usePlans`, `usePaymentMethods` and `usePreviewSubscribe` tests run against the real core over the shared billing harness. Both the abort guard and the payment-methods invalidation were verified to fail when removed. A table in `createBillingSdk.test.ts` asserts every reader stops serving the disposed scope. ## Where this sits in the plan Billing SDK track FE-2210 ([implementation plan V2](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8)). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app. | Phase | Item | Ticket | Status | | --- | --- | --- | --- | | 1-2 | Session core, transport, readers | FE-2211/2212/2213 | merged | | 3 | Operation lifecycle, commands, eight-state projection | FE-2227/2214/2223 | merged (#17655) | | 4 | `@comfyorg/account-ui` composables + `CheckoutSteps` | FE-2215 | merged (#17662, #17663) | | 5 slice 1 | Top-up through the SDK behind `billing_sdk_topup_enabled` | FE-2216 | merged (#17665) | | rollout C | `hosted_billing_destination` server flag read by the host | FE-2218 | merged (#17716) | | rollout C | `hostedDestination` port on the lifecycle, value on operation state | FE-2210/2218 | open (#17783) | | 7 prep | Scope-source port + credentialed transport (BFF / cookie hosts) | FE-2218 | merged (#17782) | | 7 prep | `@comfyorg/account` → `@comfyorg/account-core` rename | FE-2218 | local, opens after #17783 and #17794 | | 7 prep | `billing-contract` route builder + `return_to` registry | FE-2218 | merged (#17795) | | 3A-3 | Workshop adapter over `createHostedTopupCheckout` | FE-2214 | merged (#17793) | | 8 core | `previewSubscribe` command | FE-2331 | merged (#17797) | | 8 core | Plans + saved payment-methods readers | FE-2331 | open (#17798) | | 8 ui | account-ui composables (`usePlans`, `usePaymentMethods`, `usePreviewSubscribe`) | FE-2331 | **this PR** | | 7 | billing-web own-origin session, sign-in, SDK composition | FE-2218 | **this PR** (was #17807) | | 8 ui | billing-web `/v1` entry routing + subscription / payment-method surfaces | FE-2331 | **this PR** (was #17809) | | 7 | npm publish (`ingest-types`, `account-core`, `billing-contract`), Platform install, billing-web live top-up | FE-2218 | todo | | 6 | Contract tests + live E2E per flow × consumer | FE-2217 | todo | | 5 slice 2 | Subscription flows through the SDK | FE-2216 | todo (plan-change decision) | | follow-up | One `needsCustomerAttention` predicate (from the #17665 review) | FE-2216 | merged (#17792) | | follow-up | Opaque `BillingServerCode` (from the #17656 review) | FE-2227 | open (#17794) | | follow-up | `useCredits` clears on `SUPERSEDED` (from the #17799 review) | FE-2215 | open (#17824) | ```mermaid flowchart LR P3["Phase 3 core lifecycle (merged)"] P4["Phase 4 account-ui (merged)"] P5["Phase 5 slice 1 top-up flag (merged)"] FC["PR 17716 hosted_billing_destination flag (merged)"] HD["PR 17783 hostedDestination port"] SS["PR 17782 scope-source port + credentialed transport"] RN["account-core rename"] RB["billing-contract route builder + return_to"] WS["Workshop adapter"] P8PV["previewSubscribe command"] P8RD["plans + payment-methods readers"] P8["account-ui hosted composables"] BWS["billing-web session + sign-in"] BWV["billing-web /v1 surfaces"] PUB["npm publish account-core / billing-contract"] P7["Phase 7 host proof: Platform + billing-web live"] P6["Phase 6 evidence"] S2["Phase 5 slice 2 subscription"] FU9["customer-attention predicate"] FU11["opaque BillingServerCode"] FU12["useCredits clears on SUPERSEDED"] P3 --> HD FC --> HD HD --> RB P3 --> SS SS --> P7 RB --> P7 P3 --> RN RN --> PUB RB --> PUB PUB --> P7 P3 --> P8PV P3 --> P8RD P8PV --> P8 P8RD --> P8 P4 --> P8 P8 --> S2 P8 --> BWS BWS --> BWV RB --> BWV BWV --> P7 P5 --> P6 P5 --> WS P5 --> FU9 P3 --> FU11 P4 --> FU12 style P3 fill:#d4edda,stroke:#155724 style P4 fill:#d4edda,stroke:#155724 style P5 fill:#d4edda,stroke:#155724 style FC fill:#d4edda,stroke:#155724 style SS fill:#d4edda,stroke:#155724 style RB fill:#d4edda,stroke:#155724 style WS fill:#d4edda,stroke:#155724 style FU9 fill:#d4edda,stroke:#155724 style P8PV fill:#d4edda,stroke:#155724 style P8 stroke:#0366d6,stroke-width:4px style BWS stroke:#0366d6,stroke-width:4px style BWV stroke:#0366d6,stroke-width:4px ```
…own-origin session and v1 surfaces (#17799) Linear FE-2331. Stacked on #17798 (readers); carries #17797 (previewSubscribe, now on main) until #17798 lands. #17807 (billing-web own-origin session + sign-in) and #17809 (billing-web /v1 surfaces) were squash-merged into this branch, so this PR is the whole Phase 8 view layer: account-ui composables, the billing-web session/sign-in, and the subscription / payment-method surfaces. The plans catalog, the saved cards and the subscription quote are the three reads the hosted billing surfaces are built on, and the core now exposes all three. Nothing in the view layer could reach them: `BillingClient` carried only the balance, capability and status readers, so a host wanting a price had to call the core directly and invent its own loading, failure and cancellation handling per screen. - `BillingClient` gains `plans` and `paymentMethods`; `disposeBillingClient` disposes both, so a sign-out or workspace switch cannot leave a catalog or a card list serving the previous scope. - `usePlans` and `usePaymentMethods` follow `useCredits`: seeded from the reader's snapshot, `immediate` by default, and a failed refresh keeps the last good value beside the failure rather than blanking the screen. `usePaymentMethods` also exposes `defaultMethod` and `invalidateAndRefresh`, for a host coming back from the payment portal where a card was added or removed. - `usePreviewSubscribe` is on-demand and single-flight: each `quote` aborts the one before it through an `AbortController`, and only the latest settles into `preview`/`failure`, so a slow price for a plan the user has moved off never lands on screen. - The app composition root builds both readers and adds them to `dispose()`, keeping the two scope-holder lists in step. Commands stay unwired here. No UI change. These are headless composables; nothing renders them yet. `usePlans`, `usePaymentMethods` and `usePreviewSubscribe` tests run against the real core over the shared billing harness. Both the abort guard and the payment-methods invalidation were verified to fail when removed. A table in `createBillingSdk.test.ts` asserts every reader stops serving the disposed scope. Billing SDK track FE-2210 ([implementation plan V2](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8)). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app. | Phase | Item | Ticket | Status | | --- | --- | --- | --- | | 1-2 | Session core, transport, readers | FE-2211/2212/2213 | merged | | 3 | Operation lifecycle, commands, eight-state projection | FE-2227/2214/2223 | merged (#17655) | | 4 | `@comfyorg/account-ui` composables + `CheckoutSteps` | FE-2215 | merged (#17662, #17663) | | 5 slice 1 | Top-up through the SDK behind `billing_sdk_topup_enabled` | FE-2216 | merged (#17665) | | rollout C | `hosted_billing_destination` server flag read by the host | FE-2218 | merged (#17716) | | rollout C | `hostedDestination` port on the lifecycle, value on operation state | FE-2210/2218 | open (#17783) | | 7 prep | Scope-source port + credentialed transport (BFF / cookie hosts) | FE-2218 | merged (#17782) | | 7 prep | `@comfyorg/account` → `@comfyorg/account-core` rename | FE-2218 | local, opens after #17783 and #17794 | | 7 prep | `billing-contract` route builder + `return_to` registry | FE-2218 | merged (#17795) | | 3A-3 | Workshop adapter over `createHostedTopupCheckout` | FE-2214 | merged (#17793) | | 8 core | `previewSubscribe` command | FE-2331 | merged (#17797) | | 8 core | Plans + saved payment-methods readers | FE-2331 | open (#17798) | | 8 ui | account-ui composables (`usePlans`, `usePaymentMethods`, `usePreviewSubscribe`) | FE-2331 | **this PR** | | 7 | billing-web own-origin session, sign-in, SDK composition | FE-2218 | **this PR** (was #17807) | | 8 ui | billing-web `/v1` entry routing + subscription / payment-method surfaces | FE-2331 | **this PR** (was #17809) | | 7 | npm publish (`ingest-types`, `account-core`, `billing-contract`), Platform install, billing-web live top-up | FE-2218 | todo | | 6 | Contract tests + live E2E per flow × consumer | FE-2217 | todo | | 5 slice 2 | Subscription flows through the SDK | FE-2216 | todo (plan-change decision) | | follow-up | One `needsCustomerAttention` predicate (from the #17665 review) | FE-2216 | merged (#17792) | | follow-up | Opaque `BillingServerCode` (from the #17656 review) | FE-2227 | open (#17794) | | follow-up | `useCredits` clears on `SUPERSEDED` (from the #17799 review) | FE-2215 | open (#17824) | ```mermaid flowchart LR P3["Phase 3 core lifecycle (merged)"] P4["Phase 4 account-ui (merged)"] P5["Phase 5 slice 1 top-up flag (merged)"] FC["PR 17716 hosted_billing_destination flag (merged)"] HD["PR 17783 hostedDestination port"] SS["PR 17782 scope-source port + credentialed transport"] RN["account-core rename"] RB["billing-contract route builder + return_to"] WS["Workshop adapter"] P8PV["previewSubscribe command"] P8RD["plans + payment-methods readers"] P8["account-ui hosted composables"] BWS["billing-web session + sign-in"] BWV["billing-web /v1 surfaces"] PUB["npm publish account-core / billing-contract"] P7["Phase 7 host proof: Platform + billing-web live"] P6["Phase 6 evidence"] S2["Phase 5 slice 2 subscription"] FU9["customer-attention predicate"] FU11["opaque BillingServerCode"] FU12["useCredits clears on SUPERSEDED"] P3 --> HD FC --> HD HD --> RB P3 --> SS SS --> P7 RB --> P7 P3 --> RN RN --> PUB RB --> PUB PUB --> P7 P3 --> P8PV P3 --> P8RD P8PV --> P8 P8RD --> P8 P4 --> P8 P8 --> S2 P8 --> BWS BWS --> BWV RB --> BWV BWV --> P7 P5 --> P6 P5 --> WS P5 --> FU9 P3 --> FU11 P4 --> FU12 style P3 fill:#d4edda,stroke:#155724 style P4 fill:#d4edda,stroke:#155724 style P5 fill:#d4edda,stroke:#155724 style FC fill:#d4edda,stroke:#155724 style SS fill:#d4edda,stroke:#155724 style RB fill:#d4edda,stroke:#155724 style WS fill:#d4edda,stroke:#155724 style FU9 fill:#d4edda,stroke:#155724 style P8PV fill:#d4edda,stroke:#155724 style P8 stroke:#0366d6,stroke-width:4px style BWS stroke:#0366d6,stroke-width:4px style BWV stroke:#0366d6,stroke-width:4px ```
…e change as superseded (Comfy-Org#17828) Linear FE-2331. Follow-up from the Comfy-Org#17798 review. ## Why A billing read that fails is still an answer about the scope it was issued for. When the host switches workspace or disposes the reader while the request is in flight, the credits, status, and capabilities readers hand the caller back the original failure code — `REQUEST_FAILED`, `NOT_FOUND`, `CONFLICT` — instead of `SUPERSEDED`. A caller that distinguishes "this read no longer applies" from "this read failed" then retries, reports, or surfaces an error banner for a workspace the user already left. The same gap was fixed for `plans.ts` and `paymentMethods.ts` in Comfy-Org#17798; these three readers were written before that and kept the old shape. ## Root cause The lifecycle fence ran only on the success path: ```ts const result = await requestBalance(scope) if (result.status !== 'ok') { if (result.code === 'ACCESS_DENIED' && scopeTracker.isCurrent(context)) { snapshot = undefined } return result // <- returns before the fence } if (lifetime.disposed || !scopeTracker.isCurrent(context)) { return { status: 'error', code: 'SUPERSEDED' } } ``` Because the failure branch returned early, the failure never reached the fence. The `ACCESS_DENIED` snapshot drop compensated with its own `isCurrent` check, which is why the stale-scope case was handled for the cache but not for the returned result. ## How Move the fence to run immediately after the request settles, before `result.status` is inspected, in `credits.ts`, `status.ts`, and `capabilities.ts`. Any result — ok or error — that lands after a dispose or a scope change is now reported as `SUPERSEDED`. The denial drop keeps working for the current scope, and its now-redundant `isCurrent` guard is removed since the fence has already returned for a stale one. `capabilities.ts` is included because it carried the identical gap; `plans.ts` and `paymentMethods.ts` already have this shape from Comfy-Org#17798. ## AS-IS / TO-BE No UI change. This is SDK-internal error-code behavior on `packages/account`: | | AS-IS | TO-BE | | --- | --- | --- | | 500 lands after a workspace change | `{ code: 'REQUEST_FAILED', httpStatus: 500 }` | `{ code: 'SUPERSEDED' }` | | 500 lands after `dispose()` | `{ code: 'REQUEST_FAILED', httpStatus: 500 }` | `{ code: 'SUPERSEDED' }` | | 500 lands in the current scope | `{ code: 'REQUEST_FAILED', httpStatus: 500 }` | unchanged | | 403 lands in the current scope | drops the snapshot | unchanged | ## Testing - Added an `it.for` over two rows — the workspace changes, the reader is disposed — to each of `credits.test.ts`, `status.test.ts`, and `capabilities.test.ts`, gating a 500 behind the existing release-gate transport helper so the failure settles after the supersede. - All six new rows fail against the pre-fix source (`expected { status: 'error', code: 'REQUEST_FAILED', httpStatus: 500 } to deeply equal { status: 'error', code: 'SUPERSEDED' }`) and pass with the fence moved. - `packages/account` suite: 39 files, 634 tests passing. - `pnpm typecheck`, `pnpm lint`, `pnpm format:check`, `pnpm knip`, and `fallow audit --changed-since origin/main` all clean. ## Where this sits in the plan Billing SDK track FE-2210 ([implementation plan V2](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8)). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app. | Phase | Item | Ticket | Status | | --- | --- | --- | --- | | 1-2 | Session core, transport, readers | FE-2211/2212/2213 | merged | | 3 | Operation lifecycle, commands, eight-state projection | FE-2227/2214/2223 | merged (Comfy-Org#17655) | | 4 | `@comfyorg/account-ui` composables + `CheckoutSteps` | FE-2215 | merged (Comfy-Org#17662, Comfy-Org#17663) | | 5 slice 1 | Top-up through the SDK behind `billing_sdk_topup_enabled` | FE-2216 | merged (Comfy-Org#17665) | | rollout C | `hosted_billing_destination` server flag read by the host | FE-2218 | merged (Comfy-Org#17716) | | rollout C | `hostedDestination` port on the lifecycle, value on operation state | FE-2210/2218 | open (Comfy-Org#17783) | | 7 prep | Scope-source port + credentialed transport (BFF / cookie hosts) | FE-2218 | merged (Comfy-Org#17782) | | 7 prep | `@comfyorg/account` → `@comfyorg/account-core` rename | FE-2218 | local, opens after Comfy-Org#17783 and Comfy-Org#17794 | | 7 prep | `billing-contract` route builder + `return_to` registry | FE-2218 | merged (Comfy-Org#17795) | | 3A-3 | Workshop adapter over `createHostedTopupCheckout` | FE-2214 | merged (Comfy-Org#17793) | | 8 core | `previewSubscribe` command | FE-2331 | merged (Comfy-Org#17797) | | 8 core | Plans + saved payment-methods readers | FE-2331 | open (Comfy-Org#17798, whole Phase 8) | | 8 ui | account-ui composables (`usePlans`, `usePaymentMethods`, `usePreviewSubscribe`) | FE-2331 | in Comfy-Org#17798 | | 7 | billing-web own-origin session, sign-in, SDK composition | FE-2218 | in Comfy-Org#17798 | | 7 | billing-web unit tests in CI (`ci-billing-web-unit.yaml`) | FE-2218 | open (Comfy-Org#17827) | | 7 | ingest CORS + top-up return hosts for billing.comfy.org and its previews (Comfy-Org/cloud) | FE-2218 | open (cloud PR 9512) | | 8 ui | billing-web `/v1` entry routing + subscription / payment-method surfaces | FE-2331 | in Comfy-Org#17798 | | 7 | npm publish (`ingest-types`, `account-core`, `billing-contract`), Platform install, billing-web live top-up | FE-2218 | todo | | 6 | Contract tests + live E2E per flow × consumer | FE-2217 | todo | | 5 slice 2 | Subscription flows through the SDK | FE-2216 | todo (plan-change decision) | | follow-up | One `needsCustomerAttention` predicate (from the Comfy-Org#17665 review) | FE-2216 | merged (Comfy-Org#17792) | | follow-up | Opaque `BillingServerCode` (from the Comfy-Org#17656 review) | FE-2227 | open (Comfy-Org#17794) | | follow-up | `useCredits` clears on `SUPERSEDED` (from the Comfy-Org#17799 review) | FE-2215 | open (Comfy-Org#17824) | | follow-up | credits / status / capabilities readers fence a late failure as `SUPERSEDED` (from the Comfy-Org#17798 review) | FE-2331 | **this PR** | ```mermaid flowchart LR P3["Phase 3 core lifecycle (merged)"] P4["Phase 4 account-ui (merged)"] P5["Phase 5 slice 1 top-up flag (merged)"] FC["PR 17716 hosted_billing_destination flag (merged)"] HD["PR 17783 hostedDestination port"] SS["PR 17782 scope-source port + credentialed transport"] RN["account-core rename"] RB["billing-contract route builder + return_to"] WS["Workshop adapter"] P8PV["previewSubscribe command"] P8RD["plans + payment-methods readers"] P8["account-ui hosted composables"] BWS["billing-web session + sign-in"] BWV["billing-web /v1 surfaces"] CORS["cloud PR 9512 ingest CORS + return hosts"] PUB["npm publish account-core / billing-contract"] P7["Phase 7 host proof: Platform + billing-web live"] P6["Phase 6 evidence"] S2["Phase 5 slice 2 subscription"] FU9["customer-attention predicate"] FU11["opaque BillingServerCode"] FU12["useCredits clears on SUPERSEDED"] FU13["reader late-failure fence"] P3 --> HD FC --> HD HD --> RB P3 --> SS SS --> P7 RB --> P7 P3 --> RN RN --> PUB RB --> PUB PUB --> P7 P3 --> P8PV P3 --> P8RD P8PV --> P8 P8RD --> P8 P4 --> P8 P8 --> S2 P8 --> BWS BWS --> BWV RB --> BWV BWV --> P7 CORS --> P7 P5 --> P6 P5 --> WS P5 --> FU9 P3 --> FU11 P4 --> FU12 P3 --> FU13 style P3 fill:#d4edda,stroke:#155724 style P4 fill:#d4edda,stroke:#155724 style P5 fill:#d4edda,stroke:#155724 style FC fill:#d4edda,stroke:#155724 style SS fill:#d4edda,stroke:#155724 style RB fill:#d4edda,stroke:#155724 style WS fill:#d4edda,stroke:#155724 style FU9 fill:#d4edda,stroke:#155724 style P8PV fill:#d4edda,stroke:#155724 style FU13 stroke:#0366d6,stroke-width:4px ```
…g the previous scope's (Comfy-Org#17824) Linear FE-2215. Follow-up from the Comfy-Org#17799 review. ## Why The exposure this SDK track started from was a reader serving the previous account's balance. The core closed it: a read that settles after the host moved to another workspace is refused with `SUPERSEDED` rather than published. `useCredits` then reopened it in the view layer — it treated that refusal as an ordinary failure, kept `balance` untouched, and went on rendering the credits of the workspace the user had just left. ## Root cause `useCredits.refresh` had two branches: publish on `ok`, keep the previous balance and surface the failure on anything else. A scope change is neither. It is not something the user did, there is nothing to retry, and the value being kept belongs to an account that is no longer on screen. The three composables added in Comfy-Org#17799 already split that branch out; the five older ones never mentioned `SUPERSEDED`. ## How `useCredits` clears both `balance` and `failure` on a `SUPERSEDED` read, the same three lines as `usePaymentMethods`, and its docstring keeps the "a failed refresh keeps the previous balance" promise only for ordinary failures. The other four pre-existing composables are unchanged: - `useBillingOperation` — the lifecycle dispatches `superseded` to every operation on a scope change and republishes it, so the state this composable holds is already the truthful new one rather than a stale one. - `usePaymentAttempt` — its visible surface is `projection`, and `projectPaymentStep` maps a superseded operation back to `select`. - `useCheckout` / `useTopUp` — `result` is the outcome handed back to the caller of a command, carries no scope-bound data, and the step the shipped `CheckoutSteps` renders comes from the projection above. The test fixture's fake session can now move to another workspace, so the real credits reader produces `SUPERSEDED` the way the workspace switcher does. ## AS-IS / TO-BE No UI change. AS-IS: after a workspace switch, a host bound to `useCredits` keeps showing the previous workspace's balance until something else clears it. TO-BE: the balance goes undefined and the host renders its empty state until the read for the new workspace settles, with no error shown for a switch the user did not make. ## Testing `useCredits.test.ts` gains a row that moves the harness to another workspace mid-refresh and asserts the balance is dropped with no failure reported; it fails on pre-fix code. The existing row proving that an ordinary failed refresh keeps the previous balance stays. ## Where this sits in the plan Billing SDK track FE-2210 ([implementation plan V2](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8)). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app. | Phase | Item | Ticket | Status | | --- | --- | --- | --- | | 1-2 | Session core, transport, readers | FE-2211/2212/2213 | merged | | 3 | Operation lifecycle, commands, eight-state projection | FE-2227/2214/2223 | merged (Comfy-Org#17655) | | 4 | `@comfyorg/account-ui` composables + `CheckoutSteps` | FE-2215 | merged (Comfy-Org#17662, Comfy-Org#17663) | | 5 slice 1 | Top-up through the SDK behind `billing_sdk_topup_enabled` | FE-2216 | merged (Comfy-Org#17665) | | rollout C | `hosted_billing_destination` server flag read by the host | FE-2218 | merged (Comfy-Org#17716) | | rollout C | `hostedDestination` port on the lifecycle, value on operation state | FE-2210/2218 | open (Comfy-Org#17783) | | 7 prep | Scope-source port + credentialed transport (BFF / cookie hosts) | FE-2218 | merged (Comfy-Org#17782) | | 7 prep | `@comfyorg/account` → `@comfyorg/account-core` rename | FE-2218 | local, opens after Comfy-Org#17783 and Comfy-Org#17794 | | 7 prep | `billing-contract` route builder + `return_to` registry | FE-2218 | merged (Comfy-Org#17795) | | 3A-3 | Workshop adapter over `createHostedTopupCheckout` | FE-2214 | merged (Comfy-Org#17793) | | 8 core | `previewSubscribe` command | FE-2331 | merged (Comfy-Org#17797) | | 8 core | Plans + saved payment-methods readers | FE-2331 | open (Comfy-Org#17798) | | 8 ui | account-ui composables (`usePlans`, `usePaymentMethods`, `usePreviewSubscribe`) | FE-2331 | open (Comfy-Org#17799) | | 7 | billing-web own-origin session, sign-in, SDK composition | FE-2218 | open (Comfy-Org#17807) | | 8 ui | billing-web `/v1` entry routing + subscription / payment-method surfaces | FE-2331 | open (Comfy-Org#17809) | | 7 | npm publish (`ingest-types`, `account-core`, `billing-contract`), Platform install, billing-web live top-up | FE-2218 | todo | | 6 | Contract tests + live E2E per flow × consumer | FE-2217 | todo | | 5 slice 2 | Subscription flows through the SDK | FE-2216 | todo (plan-change decision) | | follow-up | One `needsCustomerAttention` predicate (from the Comfy-Org#17665 review) | FE-2216 | merged (Comfy-Org#17792) | | follow-up | Opaque `BillingServerCode` (from the Comfy-Org#17656 review) | FE-2227 | open (Comfy-Org#17794) | | follow-up | `useCredits` clears on `SUPERSEDED` (from the Comfy-Org#17799 review) | FE-2215 | **this PR** | ```mermaid flowchart LR P3["Phase 3 core lifecycle (merged)"] P4["Phase 4 account-ui (merged)"] P5["Phase 5 slice 1 top-up flag (merged)"] FC["PR 17716 hosted_billing_destination flag (merged)"] HD["PR 17783 hostedDestination port"] SS["PR 17782 scope-source port + credentialed transport"] RN["account-core rename"] RB["billing-contract route builder + return_to"] WS["Workshop adapter"] P8PV["previewSubscribe command"] P8RD["plans + payment-methods readers"] P8["account-ui hosted composables"] BWS["billing-web session + sign-in"] BWV["billing-web /v1 surfaces"] PUB["npm publish account-core / billing-contract"] P7["Phase 7 host proof: Platform + billing-web live"] P6["Phase 6 evidence"] S2["Phase 5 slice 2 subscription"] FU9["customer-attention predicate"] FU11["opaque BillingServerCode"] FU12["useCredits clears on SUPERSEDED"] P3 --> HD FC --> HD HD --> RB P3 --> SS SS --> P7 RB --> P7 P3 --> RN RN --> PUB RB --> PUB PUB --> P7 P3 --> P8PV P3 --> P8RD P8PV --> P8 P8RD --> P8 P4 --> P8 P8 --> S2 P8 --> BWS BWS --> BWV RB --> BWV BWV --> P7 P5 --> P6 P5 --> WS P5 --> FU9 P3 --> FU11 P4 --> FU12 style P3 fill:#d4edda,stroke:#155724 style P4 fill:#d4edda,stroke:#155724 style P5 fill:#d4edda,stroke:#155724 style FC fill:#d4edda,stroke:#155724 style FU12 stroke:#0366d6,stroke-width:4px ```
…g#17827) Linear FE-2218. ## Why `apps/billing-web` has a Vitest suite (`App.test.ts`, `EmbeddedCheckout.test.ts`, with ~10 more files landing in Comfy-Org#17798) that runs in zero CI steps today. `ci-tests-unit.yaml` runs the root Vitest suite and then loops over a fixed package list (`account account-ui billing-contract object-info-parser shared-frontend-utils design-system`) — `@comfyorg/billing-web` is not in that loop, and the workflow's `changes-filter` `should-run` gate excludes `apps/**` outright, so a billing-web-only PR skips the job entirely. `apps/website` has its own `ci-website-unit.yaml`; billing-web had no equivalent. A broken billing-web test could merge green. ## How New `.github/workflows/ci-billing-web-unit.yaml`, modelled on `ci-website-unit.yaml`: - Triggers on `push` to `main`, `pull_request` (`branches-ignore: [wip/*, draft/*, temp/*]`), and `merge_group`. No `paths:` filter on the triggers: a `paths:`-filtered workflow produces no check run at all when the paths do not match, so it can never be a required check, and it would leave the merge queue waiting. - Gating moves into the job graph instead. A `changes` job runs `./.github/actions/changes-filter`, and `billing-web-unit` is `needs: changes` with `if: app-billing-web-changes == 'true' || packages-changes == 'true'`. A new `app-billing-web-changes` output computed from `apps/billing-web/**` is added to that action, next to the existing `app-website-changes`; shared deps (`.nvmrc`, root `package.json`, `pnpm-lock.yaml`, `pnpm-workspace.yaml`) fold in automatically like every other `app-*` output, and the existing `packages-changes` already covers `packages/**` — including `account`, `account-ui`, and `billing-contract`. - A `billing-web-unit-gate` job (`needs: [changes, billing-web-unit]`, `if: always()`) emits the stable branch-protection context: it passes when the unit job succeeded, or when it was skipped *and* filtering itself succeeded and found no billing-web or package changes, and fails otherwise. Same success/skip logic as `website-unit-gate`, so a filter-step failure cannot be mistaken for "nothing to run". - Standard `ubuntu-latest` + `./.github/actions/setup-frontend` (pnpm, `.nvmrc` Node, lockfile-keyed pnpm store cache), plus the repo's usual `${{ github.workflow }}-${{ github.ref }}` cancel-in-progress concurrency and `contents: read`. - Runs `pnpm --filter @comfyorg/billing-web test:coverage` and uploads `apps/billing-web/coverage/lcov.info` to Codecov under flag `billing-web`, re-rooted with `network_prefix: apps/billing-web/` so paths cannot collide with root-app coverage. `fail_ci_if_error: ${{ github.event.pull_request.head.repo.fork != true }}`, matching the website workflow — forks have no token, so upload failures cannot block outside contributors. - `codecov.yml` declares the new flag with `paths: apps/billing-web/src/**` and `carryforward: false`, matching the `website-unit` entry, so patch coverage is attributed correctly and a missing upload is not papered over with stale data. No typecheck or build job here: `pnpm typecheck` (root) already fans out to `typecheck:billing-web`, `pnpm lint` already runs `pnpm --filter @comfyorg/billing-web lint`, and both run on every PR through the ungated `ci-lint-format.yaml`. `vite build` for billing-web is still uncovered by CI — out of scope for this PR. ## AS-IS / TO-BE No UI change. - AS-IS: `grep -rn "billing-web" .github/workflows/` returns nothing. The billing-web suite executes in no CI job on any event. - TO-BE: `CI: Billing Web Unit` reports on every PR and merge-queue candidate. A PR touching `apps/billing-web/**` or `packages/**` executes the suite with coverage and reports it to Codecov under the `billing-web` flag; any other PR skips the test job but still emits a passing `billing-web-unit-gate`, so the check can be marked required. ## Testing - `pnpm --filter @comfyorg/billing-web test:coverage` — 2 test files, 7 tests passed; 98.33% statements, 100% branches, 90% functions, 98.27% lines. `apps/billing-web/coverage/lcov.info` written at the path the workflow uploads. - `yamllint --config-file .yamllint .github/workflows/ci-billing-web-unit.yaml .github/actions/changes-filter/action.yaml codecov.yml` — clean (same linter and config as `ci-yaml-validation.yaml`). Workflow also parses and resolves to the expected `on` (`push`/`pull_request`/`merge_group`) and `jobs` (`changes`, `billing-web-unit`, `billing-web-unit-gate`) structure. - `diff` against `ci-website-unit.yaml` shows only name, path, and filter-output renames plus the narrower `push: branches: [main]` — the gate job's logic is byte-identical apart from those substitutions. - Action pinning matches `.pinact.yaml`: `actions/checkout@v7` is in `ignore_actions`, `codecov/codecov-action` is SHA-pinned to the same commit `ci-website-unit.yaml` uses. ## Where this sits in the plan Billing SDK track FE-2210 ([implementation plan V2](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8)). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app. | Phase | Item | Ticket | Status | | --- | --- | --- | --- | | 1-2 | Session core, transport, readers | FE-2211/2212/2213 | merged | | 3 | Operation lifecycle, commands, eight-state projection | FE-2227/2214/2223 | merged (Comfy-Org#17655) | | 4 | `@comfyorg/account-ui` composables + `CheckoutSteps` | FE-2215 | merged (Comfy-Org#17662, Comfy-Org#17663) | | 5 slice 1 | Top-up through the SDK behind `billing_sdk_topup_enabled` | FE-2216 | merged (Comfy-Org#17665) | | rollout C | `hosted_billing_destination` server flag read by the host | FE-2218 | merged (Comfy-Org#17716) | | rollout C | `hostedDestination` port on the lifecycle, value on operation state | FE-2210/2218 | open (Comfy-Org#17783) | | 7 prep | Scope-source port + credentialed transport (BFF / cookie hosts) | FE-2218 | merged (Comfy-Org#17782) | | 7 prep | `@comfyorg/account` → `@comfyorg/account-core` rename | FE-2218 | local, opens after Comfy-Org#17783 and Comfy-Org#17794 | | 7 prep | `billing-contract` route builder + `return_to` registry | FE-2218 | merged (Comfy-Org#17795) | | 3A-3 | Workshop adapter over `createHostedTopupCheckout` | FE-2214 | merged (Comfy-Org#17793) | | 8 core | `previewSubscribe` command | FE-2331 | merged (Comfy-Org#17797) | | 8 core | Plans + saved payment-methods readers | FE-2331 | open (Comfy-Org#17798, whole Phase 8) | | 8 ui | account-ui composables (`usePlans`, `usePaymentMethods`, `usePreviewSubscribe`) | FE-2331 | in Comfy-Org#17798 | | 7 | billing-web own-origin session, sign-in, SDK composition | FE-2218 | in Comfy-Org#17798 | | 7 | billing-web unit tests in CI (`ci-billing-web-unit.yaml`) | FE-2218 | **this PR** | | 7 | ingest CORS + top-up return hosts for billing.comfy.org and its previews (Comfy-Org/cloud) | FE-2218 | open (cloud PR 9512) | | 8 ui | billing-web `/v1` entry routing + subscription / payment-method surfaces | FE-2331 | in Comfy-Org#17798 | | 7 | npm publish (`ingest-types`, `account-core`, `billing-contract`), Platform install, billing-web live top-up | FE-2218 | todo | | 6 | Contract tests + live E2E per flow × consumer | FE-2217 | todo | | 5 slice 2 | Subscription flows through the SDK | FE-2216 | todo (plan-change decision) | | follow-up | One `needsCustomerAttention` predicate (from the Comfy-Org#17665 review) | FE-2216 | merged (Comfy-Org#17792) | | follow-up | Opaque `BillingServerCode` (from the Comfy-Org#17656 review) | FE-2227 | open (Comfy-Org#17794) | | follow-up | `useCredits` clears on `SUPERSEDED` (from the Comfy-Org#17799 review) | FE-2215 | open (Comfy-Org#17824) | ```mermaid flowchart LR P3["Phase 3 core lifecycle (merged)"] P4["Phase 4 account-ui (merged)"] P5["Phase 5 slice 1 top-up flag (merged)"] FC["PR 17716 hosted_billing_destination flag (merged)"] HD["PR 17783 hostedDestination port"] SS["PR 17782 scope-source port + credentialed transport"] RN["account-core rename"] RB["billing-contract route builder + return_to"] WS["Workshop adapter"] P8PV["previewSubscribe command"] P8RD["plans + payment-methods readers"] P8["account-ui hosted composables"] BWS["billing-web session + sign-in"] BWV["billing-web /v1 surfaces"] CORS["cloud PR 9512 ingest CORS + return hosts"] PUB["npm publish account-core / billing-contract"] P7["Phase 7 host proof: Platform + billing-web live"] P6["Phase 6 evidence"] S2["Phase 5 slice 2 subscription"] FU9["customer-attention predicate"] FU11["opaque BillingServerCode"] FU12["useCredits clears on SUPERSEDED"] P3 --> HD FC --> HD HD --> RB P3 --> SS SS --> P7 RB --> P7 P3 --> RN RN --> PUB RB --> PUB PUB --> P7 P3 --> P8PV P3 --> P8RD P8PV --> P8 P8RD --> P8 P4 --> P8 P8 --> S2 P8 --> BWS BWS --> BWV RB --> BWV BWV --> P7 CORS --> P7 P5 --> P6 P5 --> WS P5 --> FU9 P3 --> FU11 P4 --> FU12 style P3 fill:#d4edda,stroke:#155724 style P4 fill:#d4edda,stroke:#155724 style P5 fill:#d4edda,stroke:#155724 style FC fill:#d4edda,stroke:#155724 style SS fill:#d4edda,stroke:#155724 style RB fill:#d4edda,stroke:#155724 style WS fill:#d4edda,stroke:#155724 style FU9 fill:#d4edda,stroke:#155724 style P8PV fill:#d4edda,stroke:#155724 style BWS stroke:#0366d6,stroke-width:4px ```
…own-origin session and v1 surfaces (#17799) Linear FE-2331. Stacked on #17798 (readers); carries #17797 (previewSubscribe, now on main) until #17798 lands. #17807 (billing-web own-origin session + sign-in) and #17809 (billing-web /v1 surfaces) were squash-merged into this branch, so this PR is the whole Phase 8 view layer: account-ui composables, the billing-web session/sign-in, and the subscription / payment-method surfaces. The plans catalog, the saved cards and the subscription quote are the three reads the hosted billing surfaces are built on, and the core now exposes all three. Nothing in the view layer could reach them: `BillingClient` carried only the balance, capability and status readers, so a host wanting a price had to call the core directly and invent its own loading, failure and cancellation handling per screen. - `BillingClient` gains `plans` and `paymentMethods`; `disposeBillingClient` disposes both, so a sign-out or workspace switch cannot leave a catalog or a card list serving the previous scope. - `usePlans` and `usePaymentMethods` follow `useCredits`: seeded from the reader's snapshot, `immediate` by default, and a failed refresh keeps the last good value beside the failure rather than blanking the screen. `usePaymentMethods` also exposes `defaultMethod` and `invalidateAndRefresh`, for a host coming back from the payment portal where a card was added or removed. - `usePreviewSubscribe` is on-demand and single-flight: each `quote` aborts the one before it through an `AbortController`, and only the latest settles into `preview`/`failure`, so a slow price for a plan the user has moved off never lands on screen. - The app composition root builds both readers and adds them to `dispose()`, keeping the two scope-holder lists in step. Commands stay unwired here. No UI change. These are headless composables; nothing renders them yet. `usePlans`, `usePaymentMethods` and `usePreviewSubscribe` tests run against the real core over the shared billing harness. Both the abort guard and the payment-methods invalidation were verified to fail when removed. A table in `createBillingSdk.test.ts` asserts every reader stops serving the disposed scope. Billing SDK track FE-2210 ([implementation plan V2](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8)). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app. | Phase | Item | Ticket | Status | | --- | --- | --- | --- | | 1-2 | Session core, transport, readers | FE-2211/2212/2213 | merged | | 3 | Operation lifecycle, commands, eight-state projection | FE-2227/2214/2223 | merged (#17655) | | 4 | `@comfyorg/account-ui` composables + `CheckoutSteps` | FE-2215 | merged (#17662, #17663) | | 5 slice 1 | Top-up through the SDK behind `billing_sdk_topup_enabled` | FE-2216 | merged (#17665) | | rollout C | `hosted_billing_destination` server flag read by the host | FE-2218 | merged (#17716) | | rollout C | `hostedDestination` port on the lifecycle, value on operation state | FE-2210/2218 | open (#17783) | | 7 prep | Scope-source port + credentialed transport (BFF / cookie hosts) | FE-2218 | merged (#17782) | | 7 prep | `@comfyorg/account` → `@comfyorg/account-core` rename | FE-2218 | local, opens after #17783 and #17794 | | 7 prep | `billing-contract` route builder + `return_to` registry | FE-2218 | merged (#17795) | | 3A-3 | Workshop adapter over `createHostedTopupCheckout` | FE-2214 | merged (#17793) | | 8 core | `previewSubscribe` command | FE-2331 | merged (#17797) | | 8 core | Plans + saved payment-methods readers | FE-2331 | open (#17798) | | 8 ui | account-ui composables (`usePlans`, `usePaymentMethods`, `usePreviewSubscribe`) | FE-2331 | **this PR** | | 7 | billing-web own-origin session, sign-in, SDK composition | FE-2218 | **this PR** (was #17807) | | 8 ui | billing-web `/v1` entry routing + subscription / payment-method surfaces | FE-2331 | **this PR** (was #17809) | | 7 | npm publish (`ingest-types`, `account-core`, `billing-contract`), Platform install, billing-web live top-up | FE-2218 | todo | | 6 | Contract tests + live E2E per flow × consumer | FE-2217 | todo | | 5 slice 2 | Subscription flows through the SDK | FE-2216 | todo (plan-change decision) | | follow-up | One `needsCustomerAttention` predicate (from the #17665 review) | FE-2216 | merged (#17792) | | follow-up | Opaque `BillingServerCode` (from the #17656 review) | FE-2227 | open (#17794) | | follow-up | `useCredits` clears on `SUPERSEDED` (from the #17799 review) | FE-2215 | open (#17824) | ```mermaid flowchart LR P3["Phase 3 core lifecycle (merged)"] P4["Phase 4 account-ui (merged)"] P5["Phase 5 slice 1 top-up flag (merged)"] FC["PR 17716 hosted_billing_destination flag (merged)"] HD["PR 17783 hostedDestination port"] SS["PR 17782 scope-source port + credentialed transport"] RN["account-core rename"] RB["billing-contract route builder + return_to"] WS["Workshop adapter"] P8PV["previewSubscribe command"] P8RD["plans + payment-methods readers"] P8["account-ui hosted composables"] BWS["billing-web session + sign-in"] BWV["billing-web /v1 surfaces"] PUB["npm publish account-core / billing-contract"] P7["Phase 7 host proof: Platform + billing-web live"] P6["Phase 6 evidence"] S2["Phase 5 slice 2 subscription"] FU9["customer-attention predicate"] FU11["opaque BillingServerCode"] FU12["useCredits clears on SUPERSEDED"] P3 --> HD FC --> HD HD --> RB P3 --> SS SS --> P7 RB --> P7 P3 --> RN RN --> PUB RB --> PUB PUB --> P7 P3 --> P8PV P3 --> P8RD P8PV --> P8 P8RD --> P8 P4 --> P8 P8 --> S2 P8 --> BWS BWS --> BWV RB --> BWV BWV --> P7 P5 --> P6 P5 --> WS P5 --> FU9 P3 --> FU11 P4 --> FU12 style P3 fill:#d4edda,stroke:#155724 style P4 fill:#d4edda,stroke:#155724 style P5 fill:#d4edda,stroke:#155724 style FC fill:#d4edda,stroke:#155724 style SS fill:#d4edda,stroke:#155724 style RB fill:#d4edda,stroke:#155724 style WS fill:#d4edda,stroke:#155724 style FU9 fill:#d4edda,stroke:#155724 style P8PV fill:#d4edda,stroke:#155724 style P8 stroke:#0366d6,stroke-width:4px style BWS stroke:#0366d6,stroke-width:4px style BWV stroke:#0366d6,stroke-width:4px ```
…the SDK rail behind billing_sdk_subscription_enabled (#17853) Stacked on #17783 (base branch `jaewon/fe-2210-hosted-destination-port`); merge that first. ## Why Phase 5 slice 1 (#17665) moved top-up onto the Billing SDK behind `billing_sdk_topup_enabled`. The subscription actions the host already owns — cancel, resubscribe, and opening the payment portal — still call the workspace API directly and rely on the legacy poller for settlement and telemetry. This slice moves those three onto the SDK's commands behind their own server flag, `billing_sdk_subscription_enabled` (already on `/api/features` via Comfy-Org/cloud#9248, PostHog at 0%), so the eight-state lifecycle, idempotency, recovery and telemetry come from one implementation. Subscribe and plan change are slice 2b, stacked on this PR. ## How - **Rail switch.** `billingSdkSubscriptionRailEnabled` = `billing_sdk_subscription_enabled` AND `unified_cloud_auth`, exactly like the top-up rail. `useSubscriptionRail()` reads it once, synchronously, at the start of an action, so a flag flip mid-flow cannot issue on one rail and observe on the other. - **Three actions, one adapter.** `useWorkspaceBilling.cancelSubscription / resubscribe / manageSubscription` try the rail first; the store runs `sdk.commands.cancelSubscription()`, `resubscribe()`, `openPaymentPortal({ returnUrl })` and projects the result onto what the adapter already does with the legacy calls: settle, or throw a `WorkspaceApiError` (message is the host's, since the SDK never carries server text; `serverCode` lands in `.code`). A command that settles in any phase but `succeeded` is a failure, matching the poller. The refresh after success mirrors the poller's: cancel → status + balance + capabilities; resubscribe → `reconcileSubscriptionSuccess` + capabilities. - **Fallback.** A 404 (backend gate closed while the client flag is on) projects to `unavailable`: the adapter runs its legacy body for that action, and the store latches the route as unavailable for the tab so later actions go straight to legacy without another failed round trip. Every other failure — including `SUPERSEDED` — is thrown, never retried on legacy, so a late or superseded result cannot double-issue. - **Telemetry.** Lifecycle events are now reported for non-topup operations (top-up keeps its resumed-only filter because its dialog reports). `toBillingTelemetryEvent` already emits the poller's payload shape, so dashboards cannot tell the rails apart. - **No client-derived server state.** Eligibility and already-held answers come from the SDK and the server, as for top-up. `subscribe`, `previewSubscribe`, `useSubscriptionCheckout` and `useLegacyBilling` are untouched. ## AS-IS / TO-BE | State | AS-IS (flag off) | TO-BE (flag on) | | --- | --- | --- | | Cancel dialog at rest | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-cancel-dialog.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-cancel-dialog.png"> | | Cancel in flight | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-cancel-in-flight.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-cancel-in-flight.png"> | | Cancel settled (success toast) | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-cancel-settled.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-cancel-settled.png"> | | Cancel failed (error toast) | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-cancel-failed.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-cancel-failed.png"> | | User popover after cancel (cancelled state) | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-panel-after-cancel.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-panel-after-cancel.png"> | | Cancel request recorded | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-network.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-network.png"> | | Settings billing panel | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-billing-panel.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-billing-panel.png"> | | Resubscribe (Resume Pro) | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-resubscribe.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-resubscribe.png"> | | Resubscribe request recorded | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-resubscribe-network.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-resubscribe-network.png"> | | Payment-portal request recorded | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-portal-network.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-portal-network.png"> | - AS-IS (flag off): cancel / resubscribe / portal POST the workspace API directly; settlement and telemetry come from the legacy poller. - TO-BE (flag on): the same dialogs and toasts, the POSTs go through the SDK transport (`Idempotency-Key` on the request), settlement through the operation lifecycle; a 404 falls back to the legacy call. ## Testing | Gate | Result | | --- | --- | | `vitest run src/platform/workspace/billing src/composables/billing src/platform/workspace/composables src/platform/workspace/stores src/composables/useFeatureFlags` | 41 files, 1138 tests (12 new projection tests, 13 new adapter rail tests, +5 store tests) | | `pnpm typecheck`, `pnpm typecheck:browser`, `lint`, `format:check`, `knip` | exit 0 | | `fallow audit --changed-since origin/jaewon/fe-2210-hosted-destination-port` | no issues in 11 changed files, complexity 0, duplication 0 | | Playwright `browser_tests/tests/dialogs/cancelSubscriptionSdkRail.spec.ts` (cloud project) | **3 passed** against a served cloud dev build — `PLAYWRIGHT_TEST_URL=http://localhost:5173 pnpm exec playwright test --project=cloud browser_tests/tests/dialogs/cancelSubscriptionSdkRail.spec.ts --reporter=list`. Flag off → legacy request, flow unchanged; flag on → SDK request (`Idempotency-Key`), same dialog outcome; flag on + 404 → legacy fallback. | ## Where this sits in the plan Billing SDK track FE-2210 ([implementation plan V2](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8)). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app. | Phase | Item | Ticket | Status | | --- | --- | --- | --- | | 1-2 | Session core, transport, readers | FE-2211/2212/2213 | merged | | 3 | Operation lifecycle, commands, eight-state projection | FE-2227/2214/2223 | merged (#17655) | | 4 | `@comfyorg/account-ui` composables + `CheckoutSteps` | FE-2215 | merged (#17662, #17663) | | 5 slice 1 | Top-up through the SDK behind `billing_sdk_topup_enabled` | FE-2216 | merged (#17665) | | rollout C | `hosted_billing_destination` server flag read by the host | FE-2218 | merged (#17716) | | rollout C | `hostedDestination` port on the lifecycle, value on operation state | FE-2210/2218 | #17783 (review; parent of this PR) | | 7 prep | Scope-source port + credentialed transport (BFF / cookie hosts) | FE-2218 | merged (#17782) | | 7 prep | `@comfyorg/account` → `@comfyorg/account-core` rename | FE-2218 | #17851 (review) | | 7 prep | `billing-contract` route builder + `return_to` registry | FE-2218 | merged (#17795) | | 3A-3 | Workshop adapter over `createHostedTopupCheckout` | FE-2214 | merged (#17793) | | 8 core | `previewSubscribe` command | FE-2331 | merged (#17797) | | 8 core | Plans + saved payment-methods readers | FE-2331 | #17798 (queued) | | 8 ui | account-ui composables (`usePlans`, `usePaymentMethods`, `usePreviewSubscribe`) | FE-2331 | #17798 (queued) | | 7 | billing-web own-origin session, sign-in, SDK composition | FE-2218 | #17798 (queued) | | 7 | billing-web unit tests in CI (`ci-billing-web-unit.yaml`) | FE-2218 | merged (#17827); #17844 (queued) | | 7 | ingest CORS + top-up return hosts for billing.comfy.org and its previews (Comfy-Org/cloud) | FE-2218 | merged (Comfy-Org/cloud#9512) | | 8 ui | billing-web `/v1` entry routing + subscription / payment-method surfaces | FE-2331 | #17798 (queued) | | 7 | npm publish (`ingest-types`, `account-core`, `billing-contract`), Platform install, billing-web live top-up | FE-2218 | todo | | 6 | Contract tests per generated schema (package layer) | FE-2217 | #17829 (review) | | 6 | Live E2E per flow × consumer + evidence table | FE-2217 | todo (needs staging flags) | | 5 slice 2a | Cancel, resubscribe and payment portal through the SDK behind `billing_sdk_subscription_enabled` | FE-2216 | **this PR** | | 5 slice 2b | Subscribe / plan change through the SDK (`previewSubscribe` quote, then subscribe; the SDK stops short-circuiting an active plan) | FE-2216 | next, stacked on this PR | | follow-up | One `needsCustomerAttention` predicate (from the #17665 review) | FE-2216 | merged (#17792) | | follow-up | Opaque `BillingServerCode` (from the #17656 review) | FE-2227 | merged (#17794) | | follow-up | `useCredits` clears on `SUPERSEDED` (from the #17799 review) | FE-2215 | merged (#17824) | | follow-up | credits / status / capabilities readers fence a late failure as `SUPERSEDED` (from the #17798 review) | FE-2331 | merged (#17828) | ```mermaid flowchart LR P3["Phase 3 core lifecycle (merged)"] P4["Phase 4 account-ui (merged)"] P5["Phase 5 slice 1 top-up flag (merged)"] FC["PR 17716 hosted_billing_destination flag (merged)"] HD["PR 17783 hostedDestination port"] SS["PR 17782 scope-source port + credentialed transport"] RN["account-core rename"] RB["billing-contract route builder + return_to"] WS["Workshop adapter"] P8PV["previewSubscribe command"] P8RD["plans + payment-methods readers"] P8["account-ui hosted composables"] BWS["billing-web session + sign-in"] BWV["billing-web /v1 surfaces"] CORS["cloud PR 9512 ingest CORS + return hosts"] PUB["npm publish account-core / billing-contract"] P7["Phase 7 host proof: Platform + billing-web live"] P6C["Phase 6 contract tests"] P6["Phase 6 live evidence"] S2A["Phase 5 slice 2a cancel / resubscribe / portal rail"] S2B["Phase 5 slice 2b subscribe + plan change"] FU9["customer-attention predicate"] FU11["opaque BillingServerCode"] FU12["useCredits clears on SUPERSEDED"] FU13["reader late-failure fence"] P3 --> HD FC --> HD HD --> RB P3 --> SS SS --> P7 RB --> P7 P3 --> RN RN --> PUB RB --> PUB PUB --> P7 P3 --> P8PV P3 --> P8RD P8PV --> P8 P8RD --> P8 P4 --> P8 P8 --> S2B HD --> S2A S2A --> S2B P8 --> BWS BWS --> BWV RB --> BWV BWV --> P7 CORS --> P7 P5 --> P6 P3 --> P6C P5 --> WS P5 --> FU9 P3 --> FU11 P4 --> FU12 P3 --> FU13 style P3 fill:#d4edda,stroke:#155724 style P4 fill:#d4edda,stroke:#155724 style P5 fill:#d4edda,stroke:#155724 style FC fill:#d4edda,stroke:#155724 style SS fill:#d4edda,stroke:#155724 style RB fill:#d4edda,stroke:#155724 style WS fill:#d4edda,stroke:#155724 style FU9 fill:#d4edda,stroke:#155724 style FU11 fill:#d4edda,stroke:#155724 style FU12 fill:#d4edda,stroke:#155724 style FU13 fill:#d4edda,stroke:#155724 style CORS fill:#d4edda,stroke:#155724 style P8PV fill:#d4edda,stroke:#155724 style S2A stroke:#0366d6,stroke-width:4px ```
…int one (Comfy-Org#17794) Linear FE-2227. Follow-up parked from the Comfy-Org#17656 review. ## Why `BillingFailure.serverCode` is an unbounded server string in a contract whose whole point is that server text never reaches a user. Its doc said "never render it", but the type said plain `string`, so a command could invent a code and compare against it as if the server had sent one. This closes provenance, not containment. After it, only `readBillingErrorCode` can mint a `BillingServerCode`, so a code that reaches a comparison is one the server actually sent. The value is still `string` underneath, so interpolating it into copy, widening it with `??`, concatenating it or passing it to `t()` all still compile — the rendering half of the Comfy-Org#17656 finding stays open, and the file comment says so. Full containment is costed in "Not done here" below. ## How - `BillingServerCode = string & { readonly [brand]: true }` with a module-private `unique symbol`, so the brand cannot be forged outside the module that declares it. - `readBillingErrorCode` is the single producer and the only place the brand is minted, at the decode boundary. The brand erases at runtime, so there is no cost. - Two contract-level helpers bound what a holder can do: `matchesServerCode` compares against a code a command names, and `unwrapServerCode` is the one widening back to `string`, so every widening is visible at its call site. - The four equality comparisons (`topup.ts` `commandFailure`, `subscriptionCommands.ts` `alreadyInRequestedState`, `mapServerCode`, and the reactivation check) now go through `matchesServerCode`. The named constants and their closed sets stay where they were. - The one host handoff, `topupFailureError` in `topupOperationView.ts`, calls `unwrapServerCode` to put the code where `WorkspaceApiError.code` already lives. It is the only widening in the tree. ## AS-IS / TO-BE No behaviour change; the change is type-level only. AS-IS, any caller could write `const code: BillingFailure['serverCode'] = 'NO_PAYMENT_METHOD'` and compare against a code no server ever sent. TO-BE that line is a compile error, and the only values in the field came through the decode boundary. Rendering paths are unchanged in both directions. Every existing test passes with the same assertions. ## Not done here Making the brand genuinely opaque — dropping the `string &` so nothing reads it without `unwrapServerCode` — is the containment half, and it is cheapest now: `topupOperationView.ts:98` is the only consumer today and it already calls `unwrapServerCode`. Measured cost of the switch, from compiling it: three errors, all inside the declaring module — `matchesServerCode`'s `===`, `unwrapServerCode`'s return, and the mint in `billingErrorBody.ts` — each needing an `as unknown as` that the current declaration does not. That tradeoff (containment bought with double casts in the owning module) is a deliberate call, not a default, and Comfy-Org#17798 / Comfy-Org#17799 add consumers this week. Flagged for a decision rather than taken here. ## Testing - New `billingContracts.test.ts`: a table over `matchesServerCode` for a matching code, a different code, and a failure with no error body; a `@ts-expect-error` case proving a plain string is not assignable to `serverCode`; and `unwrapServerCode` returning the string the server sent. - Fixtures mint codes through `readBillingErrorCode` on a real error body rather than casting, so the test exercises the production decode. - `pnpm typecheck`, `pnpm lint`, `pnpm format`, `pnpm knip`, `fallow audit --changed-since origin/main`, and the account, account-ui, and `src/platform/workspace/billing` suites all pass. ## Where this sits in the plan Billing SDK track FE-2210 ([implementation plan V2](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8)). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app. | Phase | Item | Ticket | Status | | --- | --- | --- | --- | | 1-2 | Session core, transport, readers | FE-2211/2212/2213 | merged | | 3 | Operation lifecycle, commands, eight-state projection | FE-2227/2214/2223 | merged (Comfy-Org#17655) | | 4 | `@comfyorg/account-ui` composables + `CheckoutSteps` | FE-2215 | merged (Comfy-Org#17662, Comfy-Org#17663) | | 5 slice 1 | Top-up through the SDK behind `billing_sdk_topup_enabled` | FE-2216 | merged (Comfy-Org#17665) | | rollout C | `hosted_billing_destination` server flag read by the host | FE-2218 | merged (Comfy-Org#17716) | | rollout C | `hostedDestination` port on the lifecycle, value on operation state | FE-2210/2218 | open (Comfy-Org#17783) | | 7 prep | Scope-source port + credentialed transport (BFF / cookie hosts) | FE-2218 | open (Comfy-Org#17782) | | 7 prep | `@comfyorg/account` → `@comfyorg/account-core` rename | FE-2218 | local, opens after Comfy-Org#17782 and Comfy-Org#17783 | | 7 prep | `billing-contract` route builder + `return_to` registry | FE-2218 | in progress | | 3A-3 | Workshop adapter over `createHostedTopupCheckout` | FE-2214 | open (Comfy-Org#17793) | | 8 | `previewSubscribe`, plans, payment-methods readers + account-ui + billing-web views | FE-2331 | todo | | 7 | npm publish (`ingest-types`, `account-core`, `billing-contract`), Platform install, billing-web live top-up | FE-2218 | todo | | 6 | Contract tests + live E2E per flow × consumer | FE-2217 | todo | | 5 slice 2 | Subscription flows through the SDK | FE-2216 | todo (plan-change decision) | | follow-up | One `needsCustomerAttention` predicate (from the Comfy-Org#17665 review) | FE-2216 | open (Comfy-Org#17792) | | follow-up | Unforgeable `BillingServerCode` (from the Comfy-Org#17656 review) | FE-2227 | **this PR** | ```mermaid flowchart LR P3["Phase 3 core lifecycle (merged)"] P4["Phase 4 account-ui (merged)"] P5["Phase 5 slice 1 top-up flag (merged)"] FC["PR 17716 hosted_billing_destination flag (merged)"] HD["PR 17783 hostedDestination port"] SS["PR 17782 scope-source port + credentialed transport"] RN["account-core rename"] RB["billing-contract route builder + return_to"] WS["Workshop adapter"] P8["Phase 8 readers + billing-web views"] PUB["npm publish account-core / billing-contract"] P7["Phase 7 host proof: Platform + billing-web live"] P6["Phase 6 evidence"] S2["Phase 5 slice 2 subscription"] FU9["customer-attention predicate"] FU11["unforgeable BillingServerCode"] P3 --> HD FC --> HD HD --> RB P3 --> SS SS --> P7 RB --> P7 P3 --> RN RN --> PUB RB --> PUB PUB --> P7 P4 --> P8 P8 --> S2 P5 --> P6 P5 --> WS P5 --> FU9 P3 --> FU11 style P3 fill:#d4edda,stroke:#155724 style P4 fill:#d4edda,stroke:#155724 style P5 fill:#d4edda,stroke:#155724 style FC fill:#d4edda,stroke:#155724 style FU11 stroke:#0366d6,stroke-width:4px ```
…ders, hosted composables, own-origin session and v1 surfaces (Comfy-Org#17798) Linear FE-2331 / FE-2218. This PR is the whole Phase 8 view layer after the stack was consolidated: Comfy-Org#17799 (account-ui `usePlans` / `usePaymentMethods` / `usePreviewSubscribe` + app-root readers), Comfy-Org#17807 (billing-web own-origin session, sign-in, SDK composition) and Comfy-Org#17809 (billing-web `/v1` entry routing, subscription and payment-method surfaces) were squash-merged into this branch; their bodies, decisions and screenshots remain on those PRs. Rebased onto main after Comfy-Org#17782 (scopeSource), Comfy-Org#17795 (billing-contract) and Comfy-Org#17797 (previewSubscribe) landed, so none of that content is in this diff. ## Why Phase 8's hosted billing surfaces render plan management and saved payment methods, and both reads have to go through the billing SDK so they inherit the scope tracking, deduplication, and coded failures the other readers already have. The generated schemas for both routes exist, so nothing has to be hand-declared. ## How - `plans.ts`: `createPlansReader` over `GET /billing/plans`, decoded with `zGetBillingPlansResponse`. No freshness window — the catalog carries no declared lifetime, so the host decides when to re-read. - `paymentMethods.ts`: `createPaymentMethodsReader` over `GET /billing/payment-methods`, decoded with `zListSavedPaymentMethodsResponse`, plus `invalidate()` so a host returning from the payment portal can drop the list it holds without a scope change. - Both follow the existing reader shape exactly: `createBillingScopeTracker` drops the snapshot and any in-flight read on a scope change, concurrent reads for one scope share a single request, a 2xx that fails the schema is `MALFORMED_RESPONSE`, and HTTP failures map through `codeForHttpStatus`. - Exported from `@comfyorg/account/billing` alongside the credits, status, and capabilities readers. The four readers now share the same request/publish body, which `fallow audit` reports as a duplication warning. Factoring it out would touch `credits.ts` and `status.ts`, which two open PRs already modify, so it is left for a follow-up. ## AS-IS / TO-BE No UI change. The cloud app still calls `workspaceApi.getBillingPlans` and `workspaceApi.listSavedPaymentMethods`; the composables and host wiring that move it onto these readers land in separate PRs. ## Testing `plans.test.ts` and `paymentMethods.test.ts` cover the decode and scope of a successful read, the caller timeout reaching the request, deduplication of concurrent reads, a scope change in flight reporting `SUPERSEDED` with nothing cached, a signed-out reader reporting `NOT_AUTHENTICATED` without a request, the HTTP status table (401 replayed and unreplayed, 403, 404, 500), a malformed 2xx, and `dispose`. Payment methods additionally cover the empty list and `invalidate` dropping the snapshot so the next read refetches. `pnpm typecheck`, `pnpm lint`, `pnpm format`, `pnpm knip`, and `fallow audit --changed-since origin/main` pass. Follow-up, not in this PR: the four readers now share a 32-line scope/in-flight skeleton (`credits.ts`, `status.ts`, `plans.ts`, `paymentMethods.ts`; fallow reports it as one clone family). Comfy-Org#17782 has landed, but extracting it still touches files Comfy-Org#17794 is changing, so it waits for that to land. ## Where this sits in the plan Billing SDK track FE-2210 ([implementation plan V2](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8)). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app. | Phase | Item | Ticket | Status | | --- | --- | --- | --- | | 1-2 | Session core, transport, readers | FE-2211/2212/2213 | merged | | 3 | Operation lifecycle, commands, eight-state projection | FE-2227/2214/2223 | merged (Comfy-Org#17655) | | 4 | `@comfyorg/account-ui` composables + `CheckoutSteps` | FE-2215 | merged (Comfy-Org#17662, Comfy-Org#17663) | | 5 slice 1 | Top-up through the SDK behind `billing_sdk_topup_enabled` | FE-2216 | merged (Comfy-Org#17665) | | rollout C | `hosted_billing_destination` server flag read by the host | FE-2218 | merged (Comfy-Org#17716) | | rollout C | `hostedDestination` port on the lifecycle, value on operation state | FE-2210/2218 | open (Comfy-Org#17783) | | 7 prep | Scope-source port + credentialed transport (BFF / cookie hosts) | FE-2218 | merged (Comfy-Org#17782) | | 7 prep | `@comfyorg/account` → `@comfyorg/account-core` rename | FE-2218 | local, opens after Comfy-Org#17783 and Comfy-Org#17794 | | 7 prep | `billing-contract` route builder + `return_to` registry | FE-2218 | merged (Comfy-Org#17795) | | 3A-3 | Workshop adapter over `createHostedTopupCheckout` | FE-2214 | merged (Comfy-Org#17793) | | 8 core | `previewSubscribe` command | FE-2331 | merged (Comfy-Org#17797) | | 8 core | Plans + saved payment-methods readers | FE-2331 | **this PR** | | 8 ui | account-ui composables (`usePlans`, `usePaymentMethods`, `usePreviewSubscribe`) | FE-2331 | **this PR** (was Comfy-Org#17799) | | 7 | billing-web own-origin session, sign-in, SDK composition | FE-2218 | **this PR** (was Comfy-Org#17807) | | 8 ui | billing-web `/v1` entry routing + subscription / payment-method surfaces | FE-2331 | **this PR** (was Comfy-Org#17809) | | 7 | npm publish (`ingest-types`, `account-core`, `billing-contract`), Platform install, billing-web live top-up | FE-2218 | todo | | 6 | Contract tests + live E2E per flow × consumer | FE-2217 | todo | | 5 slice 2 | Subscription flows through the SDK | FE-2216 | todo (plan-change decision) | | follow-up | One `needsCustomerAttention` predicate (from the Comfy-Org#17665 review) | FE-2216 | merged (Comfy-Org#17792) | | follow-up | Opaque `BillingServerCode` (from the Comfy-Org#17656 review) | FE-2227 | open (Comfy-Org#17794) | | follow-up | `useCredits` clears on `SUPERSEDED` (from the Comfy-Org#17799 review) | FE-2215 | open (Comfy-Org#17824) | ```mermaid flowchart LR P3["Phase 3 core lifecycle (merged)"] P4["Phase 4 account-ui (merged)"] P5["Phase 5 slice 1 top-up flag (merged)"] FC["PR 17716 hosted_billing_destination flag (merged)"] HD["PR 17783 hostedDestination port"] SS["PR 17782 scope-source port + credentialed transport"] RN["account-core rename"] RB["billing-contract route builder + return_to"] WS["Workshop adapter"] P8PV["previewSubscribe command"] P8RD["plans + payment-methods readers"] P8["account-ui hosted composables"] BWS["billing-web session + sign-in"] BWV["billing-web /v1 surfaces"] PUB["npm publish account-core / billing-contract"] P7["Phase 7 host proof: Platform + billing-web live"] P6["Phase 6 evidence"] S2["Phase 5 slice 2 subscription"] FU9["customer-attention predicate"] FU11["opaque BillingServerCode"] FU12["useCredits clears on SUPERSEDED"] P3 --> HD FC --> HD HD --> RB P3 --> SS SS --> P7 RB --> P7 P3 --> RN RN --> PUB RB --> PUB PUB --> P7 P3 --> P8PV P3 --> P8RD P8PV --> P8 P8RD --> P8 P4 --> P8 P8 --> S2 P8 --> BWS BWS --> BWV RB --> BWV BWV --> P7 P5 --> P6 P5 --> WS P5 --> FU9 P3 --> FU11 P4 --> FU12 style P3 fill:#d4edda,stroke:#155724 style P4 fill:#d4edda,stroke:#155724 style P5 fill:#d4edda,stroke:#155724 style FC fill:#d4edda,stroke:#155724 style SS fill:#d4edda,stroke:#155724 style RB fill:#d4edda,stroke:#155724 style WS fill:#d4edda,stroke:#155724 style FU9 fill:#d4edda,stroke:#155724 style P8PV fill:#d4edda,stroke:#155724 style P8RD stroke:#0366d6,stroke-width:4px style P8 stroke:#0366d6,stroke-width:4px style BWS stroke:#0366d6,stroke-width:4px style BWV stroke:#0366d6,stroke-width:4px ```
… a status (Comfy-Org#17844) Follow-up to Comfy-Org#17827, from @huang47's review. ## Why Two of the three review points, both in files Comfy-Org#17827 touched. **1. The workflow does not gate on itself** ([comment](Comfy-Org#17827 (comment))). `app_billing_web` listed only `apps/billing-web/**`, so a PR that changes nothing but `ci-billing-web-unit.yaml` leaves `billing-web-unit` skipped and `billing-web-unit-gate` passing through its skip branch. Comfy-Org#17827 merged exactly that way — run [35103654481](https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/35103654481) never executed the job it added. Only the post-merge push run on `main` ([35121739924](https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/35121739924)) did, because every filter output defaults to `'true'` off `pull_request`. **2. The flag has no status of its own** ([comment](Comfy-Org#17827 (comment))). `codecov.yml` declared the `billing-web` flag but no `project.billing-web` / `patch.billing-web` under `coverage.status`, while the website flag has both. The upload arrived with nothing attributing it, which is why Comfy-Org#17827 showed live `codecov/patch/website` and `codecov/project/website` checks and no billing-web counterparts. ## How - `app_billing_web` now lists `.github/workflows/ci-billing-web-unit.yaml`, the way `app_website` lists `ci-website-e2e.yaml` and its two scripts. Output description updated to match. - `project.billing-web` and `patch.billing-web` mirror the website entries verbatim apart from the path and flag: scoped to `apps/billing-web/src/**`, `informational: true`, `flag_coverage_not_uploaded_behavior: pass`, so a skipped job does not fail the status. ## Also in this PR (added after the first push) **The flag rename** (`billing-web` → `billing-web-unit`, @huang47's third point) landed as a second commit, 089a852. It changes `flags:` in `ci-billing-web-unit.yaml`, the `flags:` list of both new status entries and the `flags.` block in `codecov.yml` in one commit, so the upload and the config never disagree. The status keys stay `billing-web` (check names `codecov/project/billing-web`, `codecov/patch/billing-web`), mirroring how the website keeps status key `website` with flag `website-unit`. The first push could not include it because that session's token lacked the `workflow` scope; this push has it. Deliberately unchanged: `app_website` still does **not** list `ci-website-unit.yaml` (only the e2e workflow and its two scripts), so the website *unit* workflow keeps the blind spot this PR fixes for billing-web. @huang47 — worth the matching one-liner, or do you want the asymmetry left alone? ## AS-IS / TO-BE No UI change; CI configuration only. - AS-IS: a `ci-billing-web-unit.yaml`-only PR skips the suite and reports a green gate. The `billing-web` flag uploads with no dedicated status. - TO-BE: that PR runs the suite. The upload gets `codecov/project/billing-web` and `codecov/patch/billing-web`. ## Testing - `curl -X POST --data-binary @codecov.yml https://codecov.io/validate` → `Valid!`. Both new statuses resolve to flag `billing-web` and path `(?s:apps/billing\-web/src/.*)\Z`. - Cross-checked the three places the flag name appears — the workflow's `flags:`, `flags.billing-web`, and both status entries — all read `billing-web`, so the upload is attributed. - Both changed files parse as YAML; `app_billing_web` resolves to `['apps/billing-web/**', '.github/workflows/ci-billing-web-unit.yaml']`. - Not demonstrated end-to-end: this PR touches neither `apps/billing-web/**` nor the workflow, so `billing-web-unit` is expected to **skip** here too. The self-test behaviour can only be observed on a PR that edits the workflow file, which is the push this token cannot make. The mechanism is the same glob matching that already makes `app_website` react to `ci-website-e2e.yaml`. ## Where this sits in the plan Billing SDK track FE-2210 ([implementation plan V2](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8)). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app. | Phase | Item | Ticket | Status | | --- | --- | --- | --- | | 1-2 | Session core, transport, readers | FE-2211/2212/2213 | merged | | 3 | Operation lifecycle, commands, eight-state projection | FE-2227/2214/2223 | merged (Comfy-Org#17655) | | 4 | `@comfyorg/account-ui` composables + `CheckoutSteps` | FE-2215 | merged (Comfy-Org#17662, Comfy-Org#17663) | | 5 slice 1 | Top-up through the SDK behind `billing_sdk_topup_enabled` | FE-2216 | merged (Comfy-Org#17665) | | rollout C | `hosted_billing_destination` server flag read by the host | FE-2218 | merged (Comfy-Org#17716) | | rollout C | `hostedDestination` port on the lifecycle, value on operation state | FE-2210/2218 | Comfy-Org#17783 (review) | | 7 prep | Scope-source port + credentialed transport (BFF / cookie hosts) | FE-2218 | merged (Comfy-Org#17782) | | 7 prep | `@comfyorg/account` → `@comfyorg/account-core` rename | FE-2218 | todo (after Comfy-Org#17783, Comfy-Org#17794) | | 7 prep | `billing-contract` route builder + `return_to` registry | FE-2218 | merged (Comfy-Org#17795) | | 3A-3 | Workshop adapter over `createHostedTopupCheckout` | FE-2214 | merged (Comfy-Org#17793) | | 8 core | `previewSubscribe` command | FE-2331 | merged (Comfy-Org#17797) | | 8 core | Plans + saved payment-methods readers | FE-2331 | Comfy-Org#17798 (review) | | 8 ui | account-ui composables (`usePlans`, `usePaymentMethods`, `usePreviewSubscribe`) | FE-2331 | Comfy-Org#17798 (review) | | 7 | billing-web own-origin session, sign-in, SDK composition | FE-2218 | Comfy-Org#17798 (review) | | 7 | billing-web unit tests in CI (`ci-billing-web-unit.yaml`) | FE-2218 | merged (Comfy-Org#17827); **this PR** (Comfy-Org#17844) self-tests the workflow and adds the flag statuses | | 7 | ingest CORS + top-up return hosts for billing.comfy.org and its previews (Comfy-Org/cloud) | FE-2218 | Comfy-Org/cloud#9512 (approved x2, CI rerun) | | 8 ui | billing-web `/v1` entry routing + subscription / payment-method surfaces | FE-2331 | Comfy-Org#17798 (review) | | 7 | npm publish (`ingest-types`, `account-core`, `billing-contract`), Platform install, billing-web live top-up | FE-2218 | todo | | 6 | Contract tests per generated schema (package layer) | FE-2217 | Comfy-Org#17829 (review) | | 6 | Live E2E per flow × consumer + evidence table | FE-2217 | todo (needs staging flags) | | 5 slice 2 | Subscription flows through the SDK | FE-2216 | todo (plan-change decision) | | follow-up | One `needsCustomerAttention` predicate (from the Comfy-Org#17665 review) | FE-2216 | merged (Comfy-Org#17792) | | follow-up | Opaque `BillingServerCode` (from the Comfy-Org#17656 review) | FE-2227 | Comfy-Org#17794 (review) | | follow-up | `useCredits` clears on `SUPERSEDED` (from the Comfy-Org#17799 review) | FE-2215 | merged (Comfy-Org#17824) | | follow-up | credits / status / capabilities readers fence a late failure as `SUPERSEDED` (from the Comfy-Org#17798 review) | FE-2331 | merged (Comfy-Org#17828) | ```mermaid flowchart LR P3["Phase 3 core lifecycle (merged)"] P4["Phase 4 account-ui (merged)"] P5["Phase 5 slice 1 top-up flag (merged)"] FC["PR 17716 hosted_billing_destination flag (merged)"] HD["PR 17783 hostedDestination port"] SS["PR 17782 scope-source port + credentialed transport"] RN["account-core rename"] RB["billing-contract route builder + return_to"] WS["Workshop adapter"] P8PV["previewSubscribe command"] P8RD["plans + payment-methods readers"] P8["account-ui hosted composables"] BWS["billing-web session + sign-in"] BWV["billing-web /v1 surfaces"] CORS["cloud PR 9512 ingest CORS + return hosts"] PUB["npm publish account-core / billing-contract"] P7["Phase 7 host proof: Platform + billing-web live"] CI["billing-web unit CI: PR 17827 (merged) + PR 17844 follow-up"] P6C["Phase 6 contract tests"] P6["Phase 6 live evidence"] S2["Phase 5 slice 2 subscription"] FU9["customer-attention predicate"] FU11["opaque BillingServerCode"] FU12["useCredits clears on SUPERSEDED"] FU13["reader late-failure fence"] P3 --> HD FC --> HD HD --> RB P3 --> SS SS --> P7 RB --> P7 P3 --> RN RN --> PUB RB --> PUB PUB --> P7 P3 --> P8PV P3 --> P8RD P8PV --> P8 P8RD --> P8 P4 --> P8 P8 --> S2 P8 --> BWS BWS --> BWV RB --> BWV BWV --> P7 CORS --> P7 BWS --> CI CI --> P7 P5 --> P6 P3 --> P6C P5 --> WS P5 --> FU9 P3 --> FU11 P4 --> FU12 P3 --> FU13 style P3 fill:#d4edda,stroke:#155724 style P4 fill:#d4edda,stroke:#155724 style P5 fill:#d4edda,stroke:#155724 style FC fill:#d4edda,stroke:#155724 style SS fill:#d4edda,stroke:#155724 style RB fill:#d4edda,stroke:#155724 style WS fill:#d4edda,stroke:#155724 style FU9 fill:#d4edda,stroke:#155724 style P8PV fill:#d4edda,stroke:#155724 style CI stroke:#0366d6,stroke-width:4px ```
… billing reads (Comfy-Org#17852) Stacked on Comfy-Org#17798 (base branch `jaewon/fe-2331-plans-payment-methods-readers`); merge that first. Comfy-Org#17851 (the `account-core` rename) sits on the same parent: whichever of the two lands second is re-based mechanically (the rename has a replay script). ## Why `fallow audit` on Comfy-Org#17798 reported a clone family across the five billing readers: `credits.ts`, `status.ts`, `capabilities.ts`, `plans.ts` and `paymentMethods.ts` each re-implemented the same fetch-and-fence shape — capture the scope, share one request per scope, release a caller on its own signal, report a late answer (success or failure) as `SUPERSEDED`, and drop a published snapshot on a denial unless the request predates a change the host fenced. Five copies of that logic is five places the Comfy-Org#17828 late-failure fence had to be applied, and the next reader would have been a sixth. ## How One skeleton, `createScopedReader`, owns the request sharing, the caller release, the publish fence and the denial drop. A reader supplies only its route, decoder (`parse`) and projection into a snapshot, plus two optional hooks that absorb the real variants: `cached` (capabilities' freshness window) and `publish` (payment-methods' fenced list, capabilities' publish-as-stale). `setSnapshot` and `fenceInFlight({ detach })` let each reader assemble its own `invalidate` — capabilities fences without detaching, payment methods fences and detaches. The public API of every reader is unchanged in shape and semantics: `index.ts` is untouched and no consumer in `account-ui`, `billing-web` or `src/platform/workspace/billing` changed. Per-reader production size: credits 158→80, status 137→64, plans 163→78, paymentMethods 197→94, capabilities 317→235 lines. Tests: the fence family is proven once in `scopedReader.test.ts` with a five-reader case table (sparse filters for the one reader that paces itself), and each reader keeps only the tests of its own projection — capabilities' freshness, denials, revision invalidation and `resolved_for` checks; payment-methods' three invalidation cases. Coverage went up: status gained the signed-out-in-flight case, plans and payment methods gained dispose, all five gained sign-out-then-read. ## AS-IS / TO-BE No user-facing change; core package internals only. - AS-IS: five readers, each with its own copy of the scope fence; fallow reports 2 clone groups / 46 lines across three of them plus 4 groups spanning all four non-paced readers. - TO-BE: one skeleton, five thin readers; `fallow audit --changed-since <parent>` reports duplication 0 and no clone group above the 3-instance threshold. ## Testing | Gate | Result | | --- | --- | | `packages/account` vitest | 42 files, 659 tests (67 new shared cases replace 82 per-reader copies) | | `packages/account-ui` vitest | 9 files, 41 tests | | `@comfyorg/billing-web` test:unit | 10 files, 90 tests | | `pnpm typecheck`, `lint`, `format`, `knip` | exit 0 | | `fallow audit --changed-since origin/jaewon/fe-2331-plans-payment-methods-readers` | no issues in 13 changed files | ## Where this sits in the plan Billing SDK track FE-2210 ([implementation plan V2](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8)). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app. | Phase | Item | Ticket | Status | | --- | --- | --- | --- | | 1-2 | Session core, transport, readers | FE-2211/2212/2213 | merged | | 3 | Operation lifecycle, commands, eight-state projection | FE-2227/2214/2223 | merged (Comfy-Org#17655) | | 4 | `@comfyorg/account-ui` composables + `CheckoutSteps` | FE-2215 | merged (Comfy-Org#17662, Comfy-Org#17663) | | 5 slice 1 | Top-up through the SDK behind `billing_sdk_topup_enabled` | FE-2216 | merged (Comfy-Org#17665) | | rollout C | `hosted_billing_destination` server flag read by the host | FE-2218 | merged (Comfy-Org#17716) | | rollout C | `hostedDestination` port on the lifecycle, value on operation state | FE-2210/2218 | Comfy-Org#17783 (review) | | 7 prep | Scope-source port + credentialed transport (BFF / cookie hosts) | FE-2218 | merged (Comfy-Org#17782) | | 7 prep | `@comfyorg/account` → `@comfyorg/account-core` rename | FE-2218 | Comfy-Org#17851 (review, sibling of this PR on Comfy-Org#17798) | | 7 prep | `billing-contract` route builder + `return_to` registry | FE-2218 | merged (Comfy-Org#17795) | | 3A-3 | Workshop adapter over `createHostedTopupCheckout` | FE-2214 | merged (Comfy-Org#17793) | | 8 core | `previewSubscribe` command | FE-2331 | merged (Comfy-Org#17797) | | 8 core | Plans + saved payment-methods readers | FE-2331 | Comfy-Org#17798 (review) | | 8 ui | account-ui composables (`usePlans`, `usePaymentMethods`, `usePreviewSubscribe`) | FE-2331 | Comfy-Org#17798 (review) | | 7 | billing-web own-origin session, sign-in, SDK composition | FE-2218 | Comfy-Org#17798 (review) | | 7 | billing-web unit tests in CI (`ci-billing-web-unit.yaml`) | FE-2218 | merged (Comfy-Org#17827); Comfy-Org#17844 follow-up (review) | | 7 | ingest CORS + top-up return hosts for billing.comfy.org and its previews (Comfy-Org/cloud) | FE-2218 | merged (Comfy-Org/cloud#9512) | | 8 ui | billing-web `/v1` entry routing + subscription / payment-method surfaces | FE-2331 | Comfy-Org#17798 (review) | | 7 | npm publish (`ingest-types`, `account-core`, `billing-contract`), Platform install, billing-web live top-up | FE-2218 | todo | | 6 | Contract tests per generated schema (package layer) | FE-2217 | Comfy-Org#17829 (review) | | 6 | Live E2E per flow × consumer + evidence table | FE-2217 | todo (needs staging flags) | | 5 slice 2 | Subscription flows through the SDK | FE-2216 | todo (plan-change decision) | | follow-up | One `needsCustomerAttention` predicate (from the Comfy-Org#17665 review) | FE-2216 | merged (Comfy-Org#17792) | | follow-up | Opaque `BillingServerCode` (from the Comfy-Org#17656 review) | FE-2227 | merged (Comfy-Org#17794) | | follow-up | `useCredits` clears on `SUPERSEDED` (from the Comfy-Org#17799 review) | FE-2215 | merged (Comfy-Org#17824) | | follow-up | credits / status / capabilities readers fence a late failure as `SUPERSEDED` (from the Comfy-Org#17798 review) | FE-2331 | merged (Comfy-Org#17828) | | follow-up | one scoped-reader skeleton behind the five billing reads (from the Comfy-Org#17798 fallow report) | FE-2331 | **this PR** | ```mermaid flowchart LR P3["Phase 3 core lifecycle (merged)"] P4["Phase 4 account-ui (merged)"] P5["Phase 5 slice 1 top-up flag (merged)"] FC["PR 17716 hosted_billing_destination flag (merged)"] HD["PR 17783 hostedDestination port"] SS["PR 17782 scope-source port + credentialed transport"] RN["account-core rename"] RB["billing-contract route builder + return_to"] WS["Workshop adapter"] P8PV["previewSubscribe command"] P8RD["plans + payment-methods readers"] P8["account-ui hosted composables"] BWS["billing-web session + sign-in"] BWV["billing-web /v1 surfaces"] CORS["cloud PR 9512 ingest CORS + return hosts"] PUB["npm publish account-core / billing-contract"] P7["Phase 7 host proof: Platform + billing-web live"] P6C["Phase 6 contract tests"] P6["Phase 6 live evidence"] S2["Phase 5 slice 2 subscription"] FU9["customer-attention predicate"] FU11["opaque BillingServerCode"] FU12["useCredits clears on SUPERSEDED"] FU13["reader late-failure fence"] FU14["scoped reader skeleton"] P3 --> HD FC --> HD HD --> RB P3 --> SS SS --> P7 RB --> P7 P3 --> RN RN --> PUB RB --> PUB PUB --> P7 P3 --> P8PV P3 --> P8RD P8PV --> P8 P8RD --> P8 P4 --> P8 P8 --> S2 P8 --> BWS BWS --> BWV RB --> BWV BWV --> P7 CORS --> P7 P5 --> P6 P3 --> P6C P5 --> WS P5 --> FU9 P3 --> FU11 P4 --> FU12 P3 --> FU13 P8RD --> FU14 FU13 --> FU14 style P3 fill:#d4edda,stroke:#155724 style P4 fill:#d4edda,stroke:#155724 style P5 fill:#d4edda,stroke:#155724 style FC fill:#d4edda,stroke:#155724 style SS fill:#d4edda,stroke:#155724 style RB fill:#d4edda,stroke:#155724 style WS fill:#d4edda,stroke:#155724 style FU9 fill:#d4edda,stroke:#155724 style FU11 fill:#d4edda,stroke:#155724 style FU12 fill:#d4edda,stroke:#155724 style FU13 fill:#d4edda,stroke:#155724 style CORS fill:#d4edda,stroke:#155724 style P8PV fill:#d4edda,stroke:#155724 style FU14 stroke:#0366d6,stroke-width:4px ```
…the SDK rail behind billing_sdk_subscription_enabled (#17853) Stacked on #17783 (base branch `jaewon/fe-2210-hosted-destination-port`); merge that first. Phase 5 slice 1 (#17665) moved top-up onto the Billing SDK behind `billing_sdk_topup_enabled`. The subscription actions the host already owns — cancel, resubscribe, and opening the payment portal — still call the workspace API directly and rely on the legacy poller for settlement and telemetry. This slice moves those three onto the SDK's commands behind their own server flag, `billing_sdk_subscription_enabled` (already on `/api/features` via Comfy-Org/cloud#9248, PostHog at 0%), so the eight-state lifecycle, idempotency, recovery and telemetry come from one implementation. Subscribe and plan change are slice 2b, stacked on this PR. - **Rail switch.** `billingSdkSubscriptionRailEnabled` = `billing_sdk_subscription_enabled` AND `unified_cloud_auth`, exactly like the top-up rail. `useSubscriptionRail()` reads it once, synchronously, at the start of an action, so a flag flip mid-flow cannot issue on one rail and observe on the other. - **Three actions, one adapter.** `useWorkspaceBilling.cancelSubscription / resubscribe / manageSubscription` try the rail first; the store runs `sdk.commands.cancelSubscription()`, `resubscribe()`, `openPaymentPortal({ returnUrl })` and projects the result onto what the adapter already does with the legacy calls: settle, or throw a `WorkspaceApiError` (message is the host's, since the SDK never carries server text; `serverCode` lands in `.code`). A command that settles in any phase but `succeeded` is a failure, matching the poller. The refresh after success mirrors the poller's: cancel → status + balance + capabilities; resubscribe → `reconcileSubscriptionSuccess` + capabilities. - **Fallback.** A 404 (backend gate closed while the client flag is on) projects to `unavailable`: the adapter runs its legacy body for that action, and the store latches the route as unavailable for the tab so later actions go straight to legacy without another failed round trip. Every other failure — including `SUPERSEDED` — is thrown, never retried on legacy, so a late or superseded result cannot double-issue. - **Telemetry.** Lifecycle events are now reported for non-topup operations (top-up keeps its resumed-only filter because its dialog reports). `toBillingTelemetryEvent` already emits the poller's payload shape, so dashboards cannot tell the rails apart. - **No client-derived server state.** Eligibility and already-held answers come from the SDK and the server, as for top-up. `subscribe`, `previewSubscribe`, `useSubscriptionCheckout` and `useLegacyBilling` are untouched. | State | AS-IS (flag off) | TO-BE (flag on) | | --- | --- | --- | | Cancel dialog at rest | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-cancel-dialog.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-cancel-dialog.png"> | | Cancel in flight | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-cancel-in-flight.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-cancel-in-flight.png"> | | Cancel settled (success toast) | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-cancel-settled.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-cancel-settled.png"> | | Cancel failed (error toast) | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-cancel-failed.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-cancel-failed.png"> | | User popover after cancel (cancelled state) | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-panel-after-cancel.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-panel-after-cancel.png"> | | Cancel request recorded | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-network.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-network.png"> | | Settings billing panel | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-billing-panel.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-billing-panel.png"> | | Resubscribe (Resume Pro) | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-resubscribe.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-resubscribe.png"> | | Resubscribe request recorded | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-resubscribe-network.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-resubscribe-network.png"> | | Payment-portal request recorded | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-portal-network.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-portal-network.png"> | - AS-IS (flag off): cancel / resubscribe / portal POST the workspace API directly; settlement and telemetry come from the legacy poller. - TO-BE (flag on): the same dialogs and toasts, the POSTs go through the SDK transport (`Idempotency-Key` on the request), settlement through the operation lifecycle; a 404 falls back to the legacy call. | Gate | Result | | --- | --- | | `vitest run src/platform/workspace/billing src/composables/billing src/platform/workspace/composables src/platform/workspace/stores src/composables/useFeatureFlags` | 41 files, 1138 tests (12 new projection tests, 13 new adapter rail tests, +5 store tests) | | `pnpm typecheck`, `pnpm typecheck:browser`, `lint`, `format:check`, `knip` | exit 0 | | `fallow audit --changed-since origin/jaewon/fe-2210-hosted-destination-port` | no issues in 11 changed files, complexity 0, duplication 0 | | Playwright `browser_tests/tests/dialogs/cancelSubscriptionSdkRail.spec.ts` (cloud project) | **3 passed** against a served cloud dev build — `PLAYWRIGHT_TEST_URL=http://localhost:5173 pnpm exec playwright test --project=cloud browser_tests/tests/dialogs/cancelSubscriptionSdkRail.spec.ts --reporter=list`. Flag off → legacy request, flow unchanged; flag on → SDK request (`Idempotency-Key`), same dialog outcome; flag on + 404 → legacy fallback. | Billing SDK track FE-2210 ([implementation plan V2](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8)). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app. | Phase | Item | Ticket | Status | | --- | --- | --- | --- | | 1-2 | Session core, transport, readers | FE-2211/2212/2213 | merged | | 3 | Operation lifecycle, commands, eight-state projection | FE-2227/2214/2223 | merged (#17655) | | 4 | `@comfyorg/account-ui` composables + `CheckoutSteps` | FE-2215 | merged (#17662, #17663) | | 5 slice 1 | Top-up through the SDK behind `billing_sdk_topup_enabled` | FE-2216 | merged (#17665) | | rollout C | `hosted_billing_destination` server flag read by the host | FE-2218 | merged (#17716) | | rollout C | `hostedDestination` port on the lifecycle, value on operation state | FE-2210/2218 | #17783 (review; parent of this PR) | | 7 prep | Scope-source port + credentialed transport (BFF / cookie hosts) | FE-2218 | merged (#17782) | | 7 prep | `@comfyorg/account` → `@comfyorg/account-core` rename | FE-2218 | #17851 (review) | | 7 prep | `billing-contract` route builder + `return_to` registry | FE-2218 | merged (#17795) | | 3A-3 | Workshop adapter over `createHostedTopupCheckout` | FE-2214 | merged (#17793) | | 8 core | `previewSubscribe` command | FE-2331 | merged (#17797) | | 8 core | Plans + saved payment-methods readers | FE-2331 | #17798 (queued) | | 8 ui | account-ui composables (`usePlans`, `usePaymentMethods`, `usePreviewSubscribe`) | FE-2331 | #17798 (queued) | | 7 | billing-web own-origin session, sign-in, SDK composition | FE-2218 | #17798 (queued) | | 7 | billing-web unit tests in CI (`ci-billing-web-unit.yaml`) | FE-2218 | merged (#17827); #17844 (queued) | | 7 | ingest CORS + top-up return hosts for billing.comfy.org and its previews (Comfy-Org/cloud) | FE-2218 | merged (Comfy-Org/cloud#9512) | | 8 ui | billing-web `/v1` entry routing + subscription / payment-method surfaces | FE-2331 | #17798 (queued) | | 7 | npm publish (`ingest-types`, `account-core`, `billing-contract`), Platform install, billing-web live top-up | FE-2218 | todo | | 6 | Contract tests per generated schema (package layer) | FE-2217 | | 6 | Live E2E per flow × consumer + evidence table | FE-2217 | todo (needs staging flags) | | 5 slice 2a | Cancel, resubscribe and payment portal through the SDK behind `billing_sdk_subscription_enabled` | FE-2216 | **this PR** | | 5 slice 2b | Subscribe / plan change through the SDK (`previewSubscribe` quote, then subscribe; the SDK stops short-circuiting an active plan) | FE-2216 | next, stacked on this PR | | follow-up | One `needsCustomerAttention` predicate (from the #17665 review) | FE-2216 | merged (#17792) | | follow-up | Opaque `BillingServerCode` (from the #17656 review) | FE-2227 | merged (#17794) | | follow-up | `useCredits` clears on `SUPERSEDED` (from the #17799 review) | FE-2215 | merged (#17824) | | follow-up | credits / status / capabilities readers fence a late failure as `SUPERSEDED` (from the #17798 review) | FE-2331 | merged (#17828) | ```mermaid flowchart LR P3["Phase 3 core lifecycle (merged)"] P4["Phase 4 account-ui (merged)"] P5["Phase 5 slice 1 top-up flag (merged)"] FC["PR 17716 hosted_billing_destination flag (merged)"] HD["PR 17783 hostedDestination port"] SS["PR 17782 scope-source port + credentialed transport"] RN["account-core rename"] RB["billing-contract route builder + return_to"] WS["Workshop adapter"] P8PV["previewSubscribe command"] P8RD["plans + payment-methods readers"] P8["account-ui hosted composables"] BWS["billing-web session + sign-in"] BWV["billing-web /v1 surfaces"] CORS["cloud PR 9512 ingest CORS + return hosts"] PUB["npm publish account-core / billing-contract"] P7["Phase 7 host proof: Platform + billing-web live"] P6C["Phase 6 contract tests"] P6["Phase 6 live evidence"] S2A["Phase 5 slice 2a cancel / resubscribe / portal rail"] S2B["Phase 5 slice 2b subscribe + plan change"] FU9["customer-attention predicate"] FU11["opaque BillingServerCode"] FU12["useCredits clears on SUPERSEDED"] FU13["reader late-failure fence"] P3 --> HD FC --> HD HD --> RB P3 --> SS SS --> P7 RB --> P7 P3 --> RN RN --> PUB RB --> PUB PUB --> P7 P3 --> P8PV P3 --> P8RD P8PV --> P8 P8RD --> P8 P4 --> P8 P8 --> S2B HD --> S2A S2A --> S2B P8 --> BWS BWS --> BWV RB --> BWV BWV --> P7 CORS --> P7 P5 --> P6 P3 --> P6C P5 --> WS P5 --> FU9 P3 --> FU11 P4 --> FU12 P3 --> FU13 style P3 fill:#d4edda,stroke:#155724 style P4 fill:#d4edda,stroke:#155724 style P5 fill:#d4edda,stroke:#155724 style FC fill:#d4edda,stroke:#155724 style SS fill:#d4edda,stroke:#155724 style RB fill:#d4edda,stroke:#155724 style WS fill:#d4edda,stroke:#155724 style FU9 fill:#d4edda,stroke:#155724 style FU11 fill:#d4edda,stroke:#155724 style FU12 fill:#d4edda,stroke:#155724 style FU13 fill:#d4edda,stroke:#155724 style CORS fill:#d4edda,stroke:#155724 style P8PV fill:#d4edda,stroke:#155724 style S2A stroke:#0366d6,stroke-width:4px ```
…the SDK rail behind billing_sdk_subscription_enabled (#17853) Stacked on #17783 (base branch `jaewon/fe-2210-hosted-destination-port`); merge that first. Phase 5 slice 1 (#17665) moved top-up onto the Billing SDK behind `billing_sdk_topup_enabled`. The subscription actions the host already owns — cancel, resubscribe, and opening the payment portal — still call the workspace API directly and rely on the legacy poller for settlement and telemetry. This slice moves those three onto the SDK's commands behind their own server flag, `billing_sdk_subscription_enabled` (already on `/api/features` via Comfy-Org/cloud#9248, PostHog at 0%), so the eight-state lifecycle, idempotency, recovery and telemetry come from one implementation. Subscribe and plan change are slice 2b, stacked on this PR. - **Rail switch.** `billingSdkSubscriptionRailEnabled` = `billing_sdk_subscription_enabled` AND `unified_cloud_auth`, exactly like the top-up rail. `useSubscriptionRail()` reads it once, synchronously, at the start of an action, so a flag flip mid-flow cannot issue on one rail and observe on the other. - **Three actions, one adapter.** `useWorkspaceBilling.cancelSubscription / resubscribe / manageSubscription` try the rail first; the store runs `sdk.commands.cancelSubscription()`, `resubscribe()`, `openPaymentPortal({ returnUrl })` and projects the result onto what the adapter already does with the legacy calls: settle, or throw a `WorkspaceApiError` (message is the host's, since the SDK never carries server text; `serverCode` lands in `.code`). A command that settles in any phase but `succeeded` is a failure, matching the poller. The refresh after success mirrors the poller's: cancel → status + balance + capabilities; resubscribe → `reconcileSubscriptionSuccess` + capabilities. - **Fallback.** A 404 (backend gate closed while the client flag is on) projects to `unavailable`: the adapter runs its legacy body for that action, and the store latches the route as unavailable for the tab so later actions go straight to legacy without another failed round trip. Every other failure — including `SUPERSEDED` — is thrown, never retried on legacy, so a late or superseded result cannot double-issue. - **Telemetry.** Lifecycle events are now reported for non-topup operations (top-up keeps its resumed-only filter because its dialog reports). `toBillingTelemetryEvent` already emits the poller's payload shape, so dashboards cannot tell the rails apart. - **No client-derived server state.** Eligibility and already-held answers come from the SDK and the server, as for top-up. `subscribe`, `previewSubscribe`, `useSubscriptionCheckout` and `useLegacyBilling` are untouched. | State | AS-IS (flag off) | TO-BE (flag on) | | --- | --- | --- | | Cancel dialog at rest | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-cancel-dialog.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-cancel-dialog.png"> | | Cancel in flight | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-cancel-in-flight.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-cancel-in-flight.png"> | | Cancel settled (success toast) | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-cancel-settled.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-cancel-settled.png"> | | Cancel failed (error toast) | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-cancel-failed.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-cancel-failed.png"> | | User popover after cancel (cancelled state) | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-panel-after-cancel.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-panel-after-cancel.png"> | | Cancel request recorded | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-network.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-network.png"> | | Settings billing panel | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-billing-panel.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-billing-panel.png"> | | Resubscribe (Resume Pro) | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-resubscribe.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-resubscribe.png"> | | Resubscribe request recorded | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-resubscribe-network.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-resubscribe-network.png"> | | Payment-portal request recorded | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/as-is-portal-network.png"> | <img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17853-screenshots/screenshots/to-be-portal-network.png"> | - AS-IS (flag off): cancel / resubscribe / portal POST the workspace API directly; settlement and telemetry come from the legacy poller. - TO-BE (flag on): the same dialogs and toasts, the POSTs go through the SDK transport (`Idempotency-Key` on the request), settlement through the operation lifecycle; a 404 falls back to the legacy call. | Gate | Result | | --- | --- | | `vitest run src/platform/workspace/billing src/composables/billing src/platform/workspace/composables src/platform/workspace/stores src/composables/useFeatureFlags` | 41 files, 1138 tests (12 new projection tests, 13 new adapter rail tests, +5 store tests) | | `pnpm typecheck`, `pnpm typecheck:browser`, `lint`, `format:check`, `knip` | exit 0 | | `fallow audit --changed-since origin/jaewon/fe-2210-hosted-destination-port` | no issues in 11 changed files, complexity 0, duplication 0 | | Playwright `browser_tests/tests/dialogs/cancelSubscriptionSdkRail.spec.ts` (cloud project) | **3 passed** against a served cloud dev build — `PLAYWRIGHT_TEST_URL=http://localhost:5173 pnpm exec playwright test --project=cloud browser_tests/tests/dialogs/cancelSubscriptionSdkRail.spec.ts --reporter=list`. Flag off → legacy request, flow unchanged; flag on → SDK request (`Idempotency-Key`), same dialog outcome; flag on + 404 → legacy fallback. | Billing SDK track FE-2210 ([implementation plan V2](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8)). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app. | Phase | Item | Ticket | Status | | --- | --- | --- | --- | | 1-2 | Session core, transport, readers | FE-2211/2212/2213 | merged | | 3 | Operation lifecycle, commands, eight-state projection | FE-2227/2214/2223 | merged (#17655) | | 4 | `@comfyorg/account-ui` composables + `CheckoutSteps` | FE-2215 | merged (#17662, #17663) | | 5 slice 1 | Top-up through the SDK behind `billing_sdk_topup_enabled` | FE-2216 | merged (#17665) | | rollout C | `hosted_billing_destination` server flag read by the host | FE-2218 | merged (#17716) | | rollout C | `hostedDestination` port on the lifecycle, value on operation state | FE-2210/2218 | #17783 (review; parent of this PR) | | 7 prep | Scope-source port + credentialed transport (BFF / cookie hosts) | FE-2218 | merged (#17782) | | 7 prep | `@comfyorg/account` → `@comfyorg/account-core` rename | FE-2218 | #17851 (review) | | 7 prep | `billing-contract` route builder + `return_to` registry | FE-2218 | merged (#17795) | | 3A-3 | Workshop adapter over `createHostedTopupCheckout` | FE-2214 | merged (#17793) | | 8 core | `previewSubscribe` command | FE-2331 | merged (#17797) | | 8 core | Plans + saved payment-methods readers | FE-2331 | #17798 (queued) | | 8 ui | account-ui composables (`usePlans`, `usePaymentMethods`, `usePreviewSubscribe`) | FE-2331 | #17798 (queued) | | 7 | billing-web own-origin session, sign-in, SDK composition | FE-2218 | #17798 (queued) | | 7 | billing-web unit tests in CI (`ci-billing-web-unit.yaml`) | FE-2218 | merged (#17827); #17844 (queued) | | 7 | ingest CORS + top-up return hosts for billing.comfy.org and its previews (Comfy-Org/cloud) | FE-2218 | merged (Comfy-Org/cloud#9512) | | 8 ui | billing-web `/v1` entry routing + subscription / payment-method surfaces | FE-2331 | #17798 (queued) | | 7 | npm publish (`ingest-types`, `account-core`, `billing-contract`), Platform install, billing-web live top-up | FE-2218 | todo | | 6 | Contract tests per generated schema (package layer) | FE-2217 | | 6 | Live E2E per flow × consumer + evidence table | FE-2217 | todo (needs staging flags) | | 5 slice 2a | Cancel, resubscribe and payment portal through the SDK behind `billing_sdk_subscription_enabled` | FE-2216 | **this PR** | | 5 slice 2b | Subscribe / plan change through the SDK (`previewSubscribe` quote, then subscribe; the SDK stops short-circuiting an active plan) | FE-2216 | next, stacked on this PR | | follow-up | One `needsCustomerAttention` predicate (from the #17665 review) | FE-2216 | merged (#17792) | | follow-up | Opaque `BillingServerCode` (from the #17656 review) | FE-2227 | merged (#17794) | | follow-up | `useCredits` clears on `SUPERSEDED` (from the #17799 review) | FE-2215 | merged (#17824) | | follow-up | credits / status / capabilities readers fence a late failure as `SUPERSEDED` (from the #17798 review) | FE-2331 | merged (#17828) | ```mermaid flowchart LR P3["Phase 3 core lifecycle (merged)"] P4["Phase 4 account-ui (merged)"] P5["Phase 5 slice 1 top-up flag (merged)"] FC["PR 17716 hosted_billing_destination flag (merged)"] HD["PR 17783 hostedDestination port"] SS["PR 17782 scope-source port + credentialed transport"] RN["account-core rename"] RB["billing-contract route builder + return_to"] WS["Workshop adapter"] P8PV["previewSubscribe command"] P8RD["plans + payment-methods readers"] P8["account-ui hosted composables"] BWS["billing-web session + sign-in"] BWV["billing-web /v1 surfaces"] CORS["cloud PR 9512 ingest CORS + return hosts"] PUB["npm publish account-core / billing-contract"] P7["Phase 7 host proof: Platform + billing-web live"] P6C["Phase 6 contract tests"] P6["Phase 6 live evidence"] S2A["Phase 5 slice 2a cancel / resubscribe / portal rail"] S2B["Phase 5 slice 2b subscribe + plan change"] FU9["customer-attention predicate"] FU11["opaque BillingServerCode"] FU12["useCredits clears on SUPERSEDED"] FU13["reader late-failure fence"] P3 --> HD FC --> HD HD --> RB P3 --> SS SS --> P7 RB --> P7 P3 --> RN RN --> PUB RB --> PUB PUB --> P7 P3 --> P8PV P3 --> P8RD P8PV --> P8 P8RD --> P8 P4 --> P8 P8 --> S2B HD --> S2A S2A --> S2B P8 --> BWS BWS --> BWV RB --> BWV BWV --> P7 CORS --> P7 P5 --> P6 P3 --> P6C P5 --> WS P5 --> FU9 P3 --> FU11 P4 --> FU12 P3 --> FU13 style P3 fill:#d4edda,stroke:#155724 style P4 fill:#d4edda,stroke:#155724 style P5 fill:#d4edda,stroke:#155724 style FC fill:#d4edda,stroke:#155724 style SS fill:#d4edda,stroke:#155724 style RB fill:#d4edda,stroke:#155724 style WS fill:#d4edda,stroke:#155724 style FU9 fill:#d4edda,stroke:#155724 style FU11 fill:#d4edda,stroke:#155724 style FU12 fill:#d4edda,stroke:#155724 style FU13 fill:#d4edda,stroke:#155724 style CORS fill:#d4edda,stroke:#155724 style P8PV fill:#d4edda,stroke:#155724 style S2A stroke:#0366d6,stroke-width:4px ```
…unt-core (Comfy-Org#17851) Stacked on Comfy-Org#17798 (base branch `jaewon/fe-2331-plans-payment-methods-readers`); merge that first, then this rebases to `main` with no content change. ## Why Phase 7 (FE-2218) publishes the framework-free billing core to npm so Platform can install it from a clean non-workspace checkout, and the plan fixes the physical `account-core` / `account-ui` split as the boundary that gets published, not the transitional `packages/account`. The view package `@comfyorg/account-ui` already exists; the core still carries the old name. This is the one mechanical rename PR the plan schedules after Phase 5 slice 1 and before the first publish. ## How Two commits so the review is trivial: 1. `git mv packages/account packages/account-core` — 95 files, 0 insertions, 0 deletions, every path a 100% rename. 2. The specifier and config edits — package name `@comfyorg/account` → `@comfyorg/account-core`, every `workspace:*` dependency (root, `apps/billing-web`, `apps/website`, `packages/account-ui`), every import specifier under `src/`, `packages/`, `apps/`, `browser_tests/`, the root `typecheck` / `lint` scripts (`typecheck:account` → `typecheck:account-core`), `knip.config.ts`, `eslint.config.ts`, the per-package loop and codecov file list in `ci-tests-unit.yaml`, the lockfile importer keys, and the two ADRs that name the package in prose. The delta over a 1:1 swap is oxfmt reflowing import lines the five extra characters pushed past 80 columns. Left alone on purpose: the `./vue` entry (the auth Vue pieces move to `account-ui` in the next PR of this stack), the Firebase app name `comfy-account` in ADR-0028, and the ADR filenames and headings (renaming those would break the ADR index and inbound links). `git grep "@comfyorg/account\b"` and `git grep "packages/account/"` return nothing after this change. The replay script lives under `temp/scripts/rename-account-core.sh` (gitignored); if a sibling PR merges first, re-running it on a fresh base reproduces this diff. ## AS-IS / TO-BE No user-facing change; package boundary only. - AS-IS: `packages/account` publishes as `@comfyorg/account` and is the name Platform would have to install, while the view layer is already `@comfyorg/account-ui`. - TO-BE: `packages/account-core` publishes as `@comfyorg/account-core`; `account-ui` and `billing-web` depend on it by the final name. ## Testing | Gate | Result | | --- | --- | | `pnpm install --frozen-lockfile` | resolves with the new name | | `packages/account-core` vitest | 41 files, 674 tests | | `packages/account-ui` vitest | 9 files, 41 tests | | `@comfyorg/billing-web` test:unit / build | 10 files, 90 tests / built | | `@comfyorg/website` typecheck | 0 errors | | root `pnpm typecheck`, `lint`, `format`, `knip` | all exit 0 | | `vitest run src/platform/workspace/billing` | 5 files, 50 tests | | `pnpm typecheck:browser`, `typecheck:website` (pre-commit) | green | ## Where this sits in the plan Billing SDK track FE-2210 ([implementation plan V2](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8)). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app. | Phase | Item | Ticket | Status | | --- | --- | --- | --- | | 1-2 | Session core, transport, readers | FE-2211/2212/2213 | merged | | 3 | Operation lifecycle, commands, eight-state projection | FE-2227/2214/2223 | merged (Comfy-Org#17655) | | 4 | `@comfyorg/account-ui` composables + `CheckoutSteps` | FE-2215 | merged (Comfy-Org#17662, Comfy-Org#17663) | | 5 slice 1 | Top-up through the SDK behind `billing_sdk_topup_enabled` | FE-2216 | merged (Comfy-Org#17665) | | rollout C | `hosted_billing_destination` server flag read by the host | FE-2218 | merged (Comfy-Org#17716) | | rollout C | `hostedDestination` port on the lifecycle, value on operation state | FE-2210/2218 | Comfy-Org#17783 (review) | | 7 prep | Scope-source port + credentialed transport (BFF / cookie hosts) | FE-2218 | merged (Comfy-Org#17782) | | 7 prep | `@comfyorg/account` → `@comfyorg/account-core` rename | FE-2218 | **this PR** | | 7 prep | `billing-contract` route builder + `return_to` registry | FE-2218 | merged (Comfy-Org#17795) | | 3A-3 | Workshop adapter over `createHostedTopupCheckout` | FE-2214 | merged (Comfy-Org#17793) | | 8 core | `previewSubscribe` command | FE-2331 | merged (Comfy-Org#17797) | | 8 core | Plans + saved payment-methods readers | FE-2331 | Comfy-Org#17798 (review) | | 8 ui | account-ui composables (`usePlans`, `usePaymentMethods`, `usePreviewSubscribe`) | FE-2331 | Comfy-Org#17798 (review) | | 7 | billing-web own-origin session, sign-in, SDK composition | FE-2218 | Comfy-Org#17798 (review) | | 7 | billing-web unit tests in CI (`ci-billing-web-unit.yaml`) | FE-2218 | merged (Comfy-Org#17827); Comfy-Org#17844 follow-up (review) | | 7 | ingest CORS + top-up return hosts for billing.comfy.org and its previews (Comfy-Org/cloud) | FE-2218 | merged (Comfy-Org/cloud#9512) | | 8 ui | billing-web `/v1` entry routing + subscription / payment-method surfaces | FE-2331 | Comfy-Org#17798 (review) | | 7 | npm publish (`ingest-types`, `account-core`, `billing-contract`), Platform install, billing-web live top-up | FE-2218 | todo | | 6 | Contract tests per generated schema (package layer) | FE-2217 | Comfy-Org#17829 (review) | | 6 | Live E2E per flow × consumer + evidence table | FE-2217 | todo (needs staging flags) | | 5 slice 2 | Subscription flows through the SDK | FE-2216 | todo (plan-change decision) | | follow-up | One `needsCustomerAttention` predicate (from the Comfy-Org#17665 review) | FE-2216 | merged (Comfy-Org#17792) | | follow-up | Opaque `BillingServerCode` (from the Comfy-Org#17656 review) | FE-2227 | merged (Comfy-Org#17794) | | follow-up | `useCredits` clears on `SUPERSEDED` (from the Comfy-Org#17799 review) | FE-2215 | merged (Comfy-Org#17824) | | follow-up | credits / status / capabilities readers fence a late failure as `SUPERSEDED` (from the Comfy-Org#17798 review) | FE-2331 | merged (Comfy-Org#17828) | ```mermaid flowchart LR P3["Phase 3 core lifecycle (merged)"] P4["Phase 4 account-ui (merged)"] P5["Phase 5 slice 1 top-up flag (merged)"] FC["PR 17716 hosted_billing_destination flag (merged)"] HD["PR 17783 hostedDestination port"] SS["PR 17782 scope-source port + credentialed transport"] RN["account-core rename"] RB["billing-contract route builder + return_to"] WS["Workshop adapter"] P8PV["previewSubscribe command"] P8RD["plans + payment-methods readers"] P8["account-ui hosted composables"] BWS["billing-web session + sign-in"] BWV["billing-web /v1 surfaces"] CORS["cloud PR 9512 ingest CORS + return hosts"] PUB["npm publish account-core / billing-contract"] P7["Phase 7 host proof: Platform + billing-web live"] P6C["Phase 6 contract tests"] P6["Phase 6 live evidence"] S2["Phase 5 slice 2 subscription"] FU9["customer-attention predicate"] FU11["opaque BillingServerCode"] FU12["useCredits clears on SUPERSEDED"] FU13["reader late-failure fence"] P3 --> HD FC --> HD HD --> RB P3 --> SS SS --> P7 RB --> P7 P3 --> RN RN --> PUB RB --> PUB PUB --> P7 P3 --> P8PV P3 --> P8RD P8PV --> P8 P8RD --> P8 P4 --> P8 P8 --> S2 P8 --> BWS BWS --> BWV RB --> BWV BWV --> P7 CORS --> P7 P5 --> P6 P3 --> P6C P5 --> WS P5 --> FU9 P3 --> FU11 P4 --> FU12 P3 --> FU13 style P3 fill:#d4edda,stroke:#155724 style P4 fill:#d4edda,stroke:#155724 style P5 fill:#d4edda,stroke:#155724 style FC fill:#d4edda,stroke:#155724 style SS fill:#d4edda,stroke:#155724 style RB fill:#d4edda,stroke:#155724 style WS fill:#d4edda,stroke:#155724 style FU9 fill:#d4edda,stroke:#155724 style FU11 fill:#d4edda,stroke:#155724 style FU12 fill:#d4edda,stroke:#155724 style FU13 fill:#d4edda,stroke:#155724 style CORS fill:#d4edda,stroke:#155724 style P8PV fill:#d4edda,stroke:#155724 style RN stroke:#0366d6,stroke-width:4px ```
…ling core (Comfy-Org#17854) Stacked on Comfy-Org#17851 (base branch `jaewon/fe-2218-account-core-rename`), which stacks on Comfy-Org#17798; merge those first. ## Why The plan's first decision was that the Vue layer leaves the account package: composables and unstyled components ship from `@comfyorg/account-ui`, and the core keeps zero Vue coupling by construction rather than by an import-guard test. The auth Vue pieces (`PasswordRules`, `SocialAuthButtons`, `TurnstileWidget`, the region and Turnstile gates, the lifecycle scope and generation guard) had shipped in the core's `./vue` entry days before that decision and were deliberately left for a later follow-up so the fresh auth stack was not destabilised. With the rename in Comfy-Org#17851 fixing `account-core` as the boundary that gets published (Phase 7), this is that follow-up: the published core must not drag `vue`, `@vueuse/core` or a `.vue` entry to Platform. ## How - `packages/account-core/src/vue/**` → `packages/account-ui/src/auth/**` with `git mv` (7 modules + their 7 tests; git records every file as a rename). The framework-free helpers stay in the core and keep their public subpaths (`/signInSchemas`, `/turnstileScript`, `/boundedOperation`); the moved files reach them through those. - `@comfyorg/account-ui` gains per-module `./auth/*` exports (mirroring how consumers already import these individually and how the app-side test mocks target one module each) plus the two workspace deps the moved files need (`@comfyorg/shared-frontend-utils`, `@comfyorg/tailwind-utils`; both fine in the view package, neither allowed in the core). - The core drops the `./vue/*` exports, `vue`, `@vueuse/core`, `vue-tsc`, `@vitejs/plugin-vue`, `@testing-library/vue|user-event`, `@comfyorg/tailwind-utils` and the `peerDependenciesMeta` block; `typecheck` becomes `tsc --noEmit`; the vitest `account-vue` project becomes `account-firebase` (happy-dom for `src/firebase/**` only). - `vueBoundary.test.ts` now proves the boundary three ways: no `vue` / `@vueuse` import anywhere under `src` (the old `vue/` carve-out is gone), no Vue dependency in any manifest field, and no `.vue` file behind any export. - 17 import sites in 13 files repointed (`apps/billing-web`, `apps/website`, `src/`); root and `apps/website` gain `@comfyorg/account-ui: workspace:*`. A pure `git mv` commit was not possible: the pre-commit hook lints and type-checks the staged tree, and a rename without repoints leaves 17 unresolved imports. Commit 1 is therefore the rename plus the mechanical repoints; commit 2 is the boundary guard. ## AS-IS / TO-BE No user-facing change; package boundary only. - AS-IS: `@comfyorg/account-core` exports `./vue/*` and depends on `vue`; a Platform install of the core would pull Vue and `.vue` files. - TO-BE: `@comfyorg/account-core` has no view entry and no Vue dependency; the sign-in pieces ship from `@comfyorg/account-ui/auth/*` next to `./billing`. ## Testing | Gate | Result | | --- | --- | | `packages/account-core` vitest | 34 files, 638 tests | | `packages/account-ui` vitest | 16 files, 79 tests (7 moved suites) | | `@comfyorg/billing-web` test:unit / build | 10 files, 90 tests / built | | `@comfyorg/website` typecheck | 0 errors | | root `pnpm typecheck`, `lint`, `format`, `knip` | exit 0 | | `vitest run src/components/dialog/content/signin src/components/auth src/platform/workspace/billing` | 11 files, 94 tests | | `git grep "account-core/vue"` | no matches | ## Where this sits in the plan Billing SDK track FE-2210 ([implementation plan V2](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8)). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app. | Phase | Item | Ticket | Status | | --- | --- | --- | --- | | 1-2 | Session core, transport, readers | FE-2211/2212/2213 | merged | | 3 | Operation lifecycle, commands, eight-state projection | FE-2227/2214/2223 | merged (Comfy-Org#17655) | | 4 | `@comfyorg/account-ui` composables + `CheckoutSteps` | FE-2215 | merged (Comfy-Org#17662, Comfy-Org#17663) | | 5 slice 1 | Top-up through the SDK behind `billing_sdk_topup_enabled` | FE-2216 | merged (Comfy-Org#17665) | | rollout C | `hosted_billing_destination` server flag read by the host | FE-2218 | merged (Comfy-Org#17716) | | rollout C | `hostedDestination` port on the lifecycle, value on operation state | FE-2210/2218 | Comfy-Org#17783 (review) | | 7 prep | Scope-source port + credentialed transport (BFF / cookie hosts) | FE-2218 | merged (Comfy-Org#17782) | | 7 prep | `@comfyorg/account` → `@comfyorg/account-core` rename | FE-2218 | Comfy-Org#17851 (review; parent of this PR) | | 4 follow-up | auth Vue pieces leave the core for `@comfyorg/account-ui` (`./auth/*`) | FE-2215 | **this PR** | | 7 prep | `billing-contract` route builder + `return_to` registry | FE-2218 | merged (Comfy-Org#17795) | | 3A-3 | Workshop adapter over `createHostedTopupCheckout` | FE-2214 | merged (Comfy-Org#17793) | | 8 core | `previewSubscribe` command | FE-2331 | merged (Comfy-Org#17797) | | 8 core | Plans + saved payment-methods readers | FE-2331 | Comfy-Org#17798 (queued) | | 8 ui | account-ui composables (`usePlans`, `usePaymentMethods`, `usePreviewSubscribe`) | FE-2331 | Comfy-Org#17798 (queued) | | 7 | billing-web own-origin session, sign-in, SDK composition | FE-2218 | Comfy-Org#17798 (queued) | | 7 | billing-web unit tests in CI (`ci-billing-web-unit.yaml`) | FE-2218 | merged (Comfy-Org#17827); Comfy-Org#17844 (queued) | | 7 | ingest CORS + top-up return hosts for billing.comfy.org and its previews (Comfy-Org/cloud) | FE-2218 | merged (Comfy-Org/cloud#9512) | | 8 ui | billing-web `/v1` entry routing + subscription / payment-method surfaces | FE-2331 | Comfy-Org#17798 (queued) | | 7 | npm publish (`ingest-types`, `account-core`, `billing-contract`), Platform install, billing-web live top-up | FE-2218 | todo | | 6 | Contract tests per generated schema (package layer) | FE-2217 | Comfy-Org#17829 (review) | | 6 | Live E2E per flow × consumer + evidence table | FE-2217 | todo (needs staging flags) | | 5 slice 2 | Subscription flows through the SDK | FE-2216 | todo (plan-change decision) | | follow-up | One `needsCustomerAttention` predicate (from the Comfy-Org#17665 review) | FE-2216 | merged (Comfy-Org#17792) | | follow-up | Opaque `BillingServerCode` (from the Comfy-Org#17656 review) | FE-2227 | merged (Comfy-Org#17794) | | follow-up | `useCredits` clears on `SUPERSEDED` (from the Comfy-Org#17799 review) | FE-2215 | merged (Comfy-Org#17824) | | follow-up | credits / status / capabilities readers fence a late failure as `SUPERSEDED` (from the Comfy-Org#17798 review) | FE-2331 | merged (Comfy-Org#17828) | ```mermaid flowchart LR P3["Phase 3 core lifecycle (merged)"] P4["Phase 4 account-ui (merged)"] P5["Phase 5 slice 1 top-up flag (merged)"] FC["PR 17716 hosted_billing_destination flag (merged)"] HD["PR 17783 hostedDestination port"] SS["PR 17782 scope-source port + credentialed transport"] RN["PR 17851 account-core rename"] VUE["auth Vue pieces to account-ui"] RB["billing-contract route builder + return_to"] WS["Workshop adapter"] P8PV["previewSubscribe command"] P8RD["plans + payment-methods readers"] P8["account-ui hosted composables"] BWS["billing-web session + sign-in"] BWV["billing-web /v1 surfaces"] CORS["cloud PR 9512 ingest CORS + return hosts"] PUB["npm publish account-core / billing-contract"] P7["Phase 7 host proof: Platform + billing-web live"] P6C["Phase 6 contract tests"] P6["Phase 6 live evidence"] S2["Phase 5 slice 2 subscription"] FU9["customer-attention predicate"] FU11["opaque BillingServerCode"] FU12["useCredits clears on SUPERSEDED"] FU13["reader late-failure fence"] P3 --> HD FC --> HD HD --> RB P3 --> SS SS --> P7 RB --> P7 P3 --> RN RN --> PUB RN --> VUE RB --> PUB PUB --> P7 P3 --> P8PV P3 --> P8RD P8PV --> P8 P8RD --> P8 P4 --> P8 P8 --> S2 P8 --> BWS BWS --> BWV RB --> BWV BWV --> P7 CORS --> P7 P5 --> P6 P3 --> P6C P5 --> WS P5 --> FU9 P3 --> FU11 P4 --> FU12 P3 --> FU13 style P3 fill:#d4edda,stroke:#155724 style P4 fill:#d4edda,stroke:#155724 style P5 fill:#d4edda,stroke:#155724 style FC fill:#d4edda,stroke:#155724 style SS fill:#d4edda,stroke:#155724 style RB fill:#d4edda,stroke:#155724 style WS fill:#d4edda,stroke:#155724 style FU9 fill:#d4edda,stroke:#155724 style FU11 fill:#d4edda,stroke:#155724 style FU12 fill:#d4edda,stroke:#155724 style FU13 fill:#d4edda,stroke:#155724 style CORS fill:#d4edda,stroke:#155724 style P8PV fill:#d4edda,stroke:#155724 style VUE stroke:#0366d6,stroke-width:4px ```
Why
Stacked on the FE-2215 composables PR (
jaewon/fe-2215-phase-4-new-view-package-for-billing-composables-and), itself stacked on the Phase 3 integration branch (jaewon/fe-2227-phase3-integration, PR 0 + #17657 + #17659); retarget once each parent lands.Second half of Phase 4: the unstyled
CheckoutStepscomponent, split out of the composables PR to keep both under the size guard.How
packages/account-ui/src/billing/CheckoutSteps.vue, ported from the PoCvue/CheckoutSteps.tsonto the mergedPaymentProjection+paymentCopyKeys/createPaymentCopy:projection(eight-state, fromuseTopUp/useCheckout), acopyprop of host-localized overrides by approvedPaymentCopyKey,disabled, and class props (rootClass,headerClass,bodyClass,reasonClass,safetyClass,actionsClass,actionClass) the wayPasswordRules/SocialAuthButtonsdo.noChargeConfirmedunlocks it (a host override of that line is ignored bycreatePaymentCopy).verifying→ continue verification,declined/processing_error/canceled→ retry. Emitsretry,cancel,continue-verification;header/body/actionsslots receive the projection, copy key/text, and the callbacks so a host lays out its own controls.Adds
@testing-library/user-eventto the package devDependencies (lockfile updated) and the two index exports.Tests (6): approved copy with host overrides and class props, safety line gated by the projection only, default actions and their emits, no action on success / nothing while disabled, slot scope and callbacks.
AS-IS / TO-BE
No styled UI surface, no screenshots (the component is unstyled by design;
data-billing-stepanddata-copy-keyattributes are the only markers).Stack (2026-09-14)
Merge top-down. After a parent is squash-merged, rebase each child with
git rebase --onto origin/main <parent tip>and force-push; GitHub retargets the base. Solid edges are code dependencies, dashed edges are sequencing.