Repository navigation
FE-2210 / FE-2218 feat(account): hosted destination port on the billing operation lifecycle - #17783
Conversation
🎭 Playwright: ✅ 2033 passed, 0 failed · 1 flaky📊 Browser Reports
🎨 Storybook: ✅ Built — View Storybook🌐 Website E2ETip All tests passed.
📦 Bundle: 10.1 MB gzip 🔴 +3.62 kBDetailsSummary
Category Glance App Entry Points — 3.73 kB (baseline 3.73 kB) • ⚪ 0 BMain entry bundles and manifests
Status: 1 added / 1 removed Graph Workspace — 1.44 MB (baseline 1.44 MB) • ⚪ 0 BGraph editor runtime, canvas, workflow orchestration
Status: 2 added / 2 removed / 1 unchanged Views & Navigation — 132 kB (baseline 132 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces
Status: 14 added / 14 removed / 4 unchanged Panels & Settings — 637 kB (baseline 637 kB) • ⚪ 0 BConfiguration panels, inspectors, and settings screens
Status: 10 added / 10 removed / 17 unchanged User & Accounts — 32.3 kB (baseline 32.3 kB) • ⚪ 0 BAuthentication, profile, and account management bundles
Status: 6 added / 6 removed / 5 unchanged Editors & Dialogs — 126 kB (baseline 126 kB) • ⚪ 0 BModals, dialogs, drawers, and in-app editors
Status: 7 added / 7 removed / 1 unchanged UI Components — 124 kB (baseline 124 kB) • ⚪ 0 BReusable component library chunks
Status: 7 added / 7 removed / 9 unchanged Data & Services — 3.83 MB (baseline 3.81 MB) • 🔴 +16.1 kBStores, services, APIs, and repositories
Status: 13 added / 13 removed / 3 unchanged Utilities & Hooks — 562 kB (baseline 561 kB) • 🔴 +341 BHelpers, composables, and utility bundles
Status: 19 added / 19 removed / 18 unchanged Vendor & Third-Party — 18.2 MB (baseline 18.2 MB) • ⚪ 0 BExternal libraries and shared vendor chunks Status: 18 unchanged Other — 17.7 MB (baseline 17.7 MB) • ⚪ 0 BBundles that do not match a named category
Status: 73 added / 73 removed / 224 unchanged ⚡ Performance Report
Show regressions
All metrics
Historical variance (last 15 runs)
Trend (last 15 commits on main)
Raw data{
"timestamp": "2026-09-17T04:57:55.810Z",
"gitSha": "bbcaa86e2f13a50cae1643e6899b2a20be7dba88",
"branch": "jaewon/fe-2210-hosted-destination-port",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 2001.3250000000085,
"styleRecalcs": 6,
"styleRecalcDurationMs": 5.960999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 468.39799999999997,
"heapDeltaBytes": 8171448,
"heapUsedBytes": 69797372,
"domNodes": -268,
"jsHeapTotalBytes": 4448256,
"scriptDurationMs": 10.274000000000003,
"eventListeners": -154,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-idle",
"durationMs": 2007.9399999999623,
"styleRecalcs": 7,
"styleRecalcDurationMs": 6.777000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 342.658,
"heapDeltaBytes": 9248976,
"heapUsedBytes": 70951544,
"domNodes": -266,
"jsHeapTotalBytes": 4972544,
"scriptDurationMs": 8.715999999999998,
"eventListeners": -154,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-mouse-sweep",
"durationMs": 2044.4180000000074,
"styleRecalcs": 79,
"styleRecalcDurationMs": 36.664,
"layouts": 14,
"layoutDurationMs": 5.148,
"taskDurationMs": 1050.2640000000001,
"heapDeltaBytes": 9319812,
"heapUsedBytes": 70447872,
"domNodes": -264,
"jsHeapTotalBytes": 5496832,
"scriptDurationMs": 196.803,
"eventListeners": -158,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1809.8860000000059,
"styleRecalcs": 75,
"styleRecalcDurationMs": 27.558,
"layouts": 14,
"layoutDurationMs": 4.463,
"taskDurationMs": 841.479,
"heapDeltaBytes": -3210932,
"heapUsedBytes": 59460840,
"domNodes": -261,
"jsHeapTotalBytes": 6021120,
"scriptDurationMs": 161.06699999999998,
"eventListeners": -186,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1731.675999999993,
"styleRecalcs": 31,
"styleRecalcDurationMs": 16.334999999999997,
"layouts": 6,
"layoutDurationMs": 1.2,
"taskDurationMs": 353.49700000000007,
"heapDeltaBytes": 2134816,
"heapUsedBytes": 63305320,
"domNodes": 74,
"jsHeapTotalBytes": 4456448,
"scriptDurationMs": 12.108,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1723.4090000000606,
"styleRecalcs": 32,
"styleRecalcDurationMs": 17.966999999999995,
"layouts": 6,
"layoutDurationMs": 1.213,
"taskDurationMs": 352.98800000000006,
"heapDeltaBytes": 2174576,
"heapUsedBytes": 64720524,
"domNodes": 76,
"jsHeapTotalBytes": 4718592,
"scriptDurationMs": 13.015999999999996,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "dom-widget-clipping",
"durationMs": 732.1369999999661,
"styleRecalcs": 11,
"styleRecalcDurationMs": 8.632000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 480.91499999999996,
"heapDeltaBytes": 17934700,
"heapUsedBytes": 80490872,
"domNodes": 18,
"jsHeapTotalBytes": 5767168,
"scriptDurationMs": 173.18800000000002,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "dom-widget-clipping",
"durationMs": 628.4259999999904,
"styleRecalcs": 10,
"styleRecalcDurationMs": 6.785000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 443.80100000000004,
"heapDeltaBytes": 17832620,
"heapUsedBytes": 80583832,
"domNodes": 16,
"jsHeapTotalBytes": 5242880,
"scriptDurationMs": 161.442,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-idle",
"durationMs": 2051.1960000000045,
"styleRecalcs": 6,
"styleRecalcDurationMs": 10.597,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 592.33,
"heapDeltaBytes": -204532,
"heapUsedBytes": 79498888,
"domNodes": -256,
"jsHeapTotalBytes": -8192,
"scriptDurationMs": 34.407999999999994,
"eventListeners": -184,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-idle",
"durationMs": 2051.539000000048,
"styleRecalcs": 5,
"styleRecalcDurationMs": 5.691999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 647.066,
"heapDeltaBytes": 27692,
"heapUsedBytes": 79907340,
"domNodes": -260,
"jsHeapTotalBytes": -8192,
"scriptDurationMs": 36.479,
"eventListeners": -182,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-pan",
"durationMs": 2381.858999999963,
"styleRecalcs": 63,
"styleRecalcDurationMs": 9.28,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1698.3460000000005,
"heapDeltaBytes": 18430456,
"heapUsedBytes": 83569828,
"domNodes": 2,
"jsHeapTotalBytes": 1273856,
"scriptDurationMs": 867.5730000000001,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-pan",
"durationMs": 2474.154999999996,
"styleRecalcs": 68,
"styleRecalcDurationMs": 13.699000000000003,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1788.1959999999997,
"heapDeltaBytes": -14990436,
"heapUsedBytes": 65975612,
"domNodes": -263,
"jsHeapTotalBytes": 1826816,
"scriptDurationMs": 916.727,
"eventListeners": -182,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-zoom",
"durationMs": 3653.6030000000324,
"styleRecalcs": 60,
"styleRecalcDurationMs": 9.971999999999998,
"layouts": 60,
"layoutDurationMs": 13.171000000000001,
"taskDurationMs": 1760.484,
"heapDeltaBytes": 10094652,
"heapUsedBytes": 75523748,
"domNodes": -11,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 817.5349999999999,
"eventListeners": 10,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-zoom",
"durationMs": 3668.4999999999945,
"styleRecalcs": 63,
"styleRecalcDurationMs": 13.453999999999997,
"layouts": 60,
"layoutDurationMs": 13.652000000000001,
"taskDurationMs": 1806.6930000000002,
"heapDeltaBytes": -12235952,
"heapUsedBytes": 70375772,
"domNodes": -268,
"jsHeapTotalBytes": 5758976,
"scriptDurationMs": 828.965,
"eventListeners": -186,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.80000000000109
},
{
"name": "legacy-node-drag",
"durationMs": 3128.969999999981,
"styleRecalcs": 40,
"styleRecalcDurationMs": 5.129999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1985.7230000000002,
"heapDeltaBytes": 22406800,
"heapUsedBytes": 88741568,
"domNodes": 0,
"jsHeapTotalBytes": 417792,
"scriptDurationMs": 1016.451,
"eventListeners": 188,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "legacy-node-drag",
"durationMs": 3171.524999999974,
"styleRecalcs": 41,
"styleRecalcDurationMs": 5.551,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1936.7250000000001,
"heapDeltaBytes": 20782512,
"heapUsedBytes": 86969988,
"domNodes": 2,
"jsHeapTotalBytes": 417792,
"scriptDurationMs": 1000.1750000000001,
"eventListeners": 188,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "minimap-idle",
"durationMs": 2027.9979999999682,
"styleRecalcs": 5,
"styleRecalcDurationMs": 4.694,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 583.306,
"heapDeltaBytes": -3854676,
"heapUsedBytes": 84038536,
"domNodes": -252,
"jsHeapTotalBytes": -495616,
"scriptDurationMs": 34.608,
"eventListeners": -154,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "minimap-idle",
"durationMs": 2060.2069999999912,
"styleRecalcs": 6,
"styleRecalcDurationMs": 6.3290000000000015,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 671.9050000000001,
"heapDeltaBytes": -10047736,
"heapUsedBytes": 77747772,
"domNodes": -266,
"jsHeapTotalBytes": 28672,
"scriptDurationMs": 41.40700000000001,
"eventListeners": -182,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 591.2629999999695,
"styleRecalcs": 46,
"styleRecalcDurationMs": 9.92,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 406.697,
"heapDeltaBytes": 13967084,
"heapUsedBytes": 77177648,
"domNodes": 18,
"jsHeapTotalBytes": 4980736,
"scriptDurationMs": 143.86,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 592.3700000000736,
"styleRecalcs": 46,
"styleRecalcDurationMs": 11.468000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 417.62499999999994,
"heapDeltaBytes": 13504588,
"heapUsedBytes": 77277360,
"domNodes": 18,
"jsHeapTotalBytes": 5767168,
"scriptDurationMs": 150.081,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "subgraph-idle",
"durationMs": 1995.9430000000111,
"styleRecalcs": 9,
"styleRecalcDurationMs": 9.519999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 488.22999999999996,
"heapDeltaBytes": 5763536,
"heapUsedBytes": 68560040,
"domNodes": -279,
"jsHeapTotalBytes": 4710400,
"scriptDurationMs": 9.702000000000002,
"eventListeners": -200,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-idle",
"durationMs": 2004.8969999999144,
"styleRecalcs": 9,
"styleRecalcDurationMs": 8.090999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 444.58,
"heapDeltaBytes": 4944716,
"heapUsedBytes": 68566120,
"domNodes": -277,
"jsHeapTotalBytes": 4972544,
"scriptDurationMs": 7.877999999999999,
"eventListeners": -200,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1721.4079999999967,
"styleRecalcs": 77,
"styleRecalcDurationMs": 27.807000000000006,
"layouts": 18,
"layoutDurationMs": 5.146999999999999,
"taskDurationMs": 774.474,
"heapDeltaBytes": 7500412,
"heapUsedBytes": 71071628,
"domNodes": -277,
"jsHeapTotalBytes": 5496832,
"scriptDurationMs": 109.87899999999999,
"eventListeners": -202,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1706.4530000000104,
"styleRecalcs": 77,
"styleRecalcDurationMs": 25.605000000000004,
"layouts": 18,
"layoutDurationMs": 4.935999999999999,
"taskDurationMs": 786.649,
"heapDeltaBytes": -5132092,
"heapUsedBytes": 58578144,
"domNodes": -275,
"jsHeapTotalBytes": 5496832,
"scriptDurationMs": 106.756,
"eventListeners": -200,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-transition-enter",
"durationMs": 1384.4890000000305,
"styleRecalcs": 17,
"styleRecalcDurationMs": 28.312000000000005,
"layouts": 5,
"layoutDurationMs": 13.333000000000002,
"taskDurationMs": 890.3989999999998,
"heapDeltaBytes": -6536692,
"heapUsedBytes": 87040852,
"domNodes": 13587,
"jsHeapTotalBytes": 11272192,
"scriptDurationMs": 33.157999999999994,
"eventListeners": 2387,
"totalBlockingTimeMs": 136,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 8476.08600000001,
"styleRecalcs": 247,
"styleRecalcDurationMs": 35.738,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 5988.72,
"heapDeltaBytes": 11447544,
"heapUsedBytes": 75249332,
"domNodes": -250,
"jsHeapTotalBytes": 2060288,
"scriptDurationMs": 2858.976,
"eventListeners": -136,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "viewport-pan-sweep",
"durationMs": 8601.47399999994,
"styleRecalcs": 248,
"styleRecalcDurationMs": 36.639,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 6029.164000000001,
"heapDeltaBytes": 12977212,
"heapUsedBytes": 93136268,
"domNodes": -263,
"jsHeapTotalBytes": 3330048,
"scriptDurationMs": 2830.209,
"eventListeners": -166,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-idle",
"durationMs": 17561.68299999996,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 16994.667,
"heapDeltaBytes": -42175224,
"heapUsedBytes": 162217660,
"domNodes": -8061,
"jsHeapTotalBytes": -14225408,
"scriptDurationMs": 304.13800000000003,
"eventListeners": -14926,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.776666666666763,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-idle",
"durationMs": 17653.678000000014,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 17278.359,
"heapDeltaBytes": -36348292,
"heapUsedBytes": 194835812,
"domNodes": -8061,
"jsHeapTotalBytes": -12652544,
"scriptDurationMs": 305.089,
"eventListeners": -14926,
"totalBlockingTimeMs": 0,
"frameDurationMs": 18.886666666666617,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "vue-large-graph-pan",
"durationMs": 20543.54599999999,
"styleRecalcs": 156,
"styleRecalcDurationMs": 16.560999999999993,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 20257.521,
"heapDeltaBytes": -31616328,
"heapUsedBytes": 190735804,
"domNodes": -8061,
"jsHeapTotalBytes": -19144704,
"scriptDurationMs": 893.077,
"eventListeners": -14922,
"totalBlockingTimeMs": 24,
"frameDurationMs": 17.776666666666763,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-pan",
"durationMs": 20838.968999999906,
"styleRecalcs": 150,
"styleRecalcDurationMs": 19.293000000000006,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 20622.269,
"heapDeltaBytes": -40461708,
"heapUsedBytes": 190430396,
"domNodes": -8061,
"jsHeapTotalBytes": -11661312,
"scriptDurationMs": 940.7850000000001,
"eventListeners": -14922,
"totalBlockingTimeMs": 174,
"frameDurationMs": 18.333333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-node-resize-workload",
"durationMs": 6131.151000000045,
"styleRecalcs": 20,
"styleRecalcDurationMs": 82.98799999999999,
"layouts": 20,
"layoutDurationMs": 25.546,
"taskDurationMs": 6071.159000000001,
"heapDeltaBytes": -59824132,
"heapUsedBytes": 171454992,
"domNodes": -8065,
"jsHeapTotalBytes": 12775424,
"scriptDurationMs": 109.978,
"eventListeners": -14926,
"totalBlockingTimeMs": 390,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-node-resize-workload",
"durationMs": 6249.91,
"styleRecalcs": 20,
"styleRecalcDurationMs": 80.24700000000001,
"layouts": 20,
"layoutDurationMs": 25.127999999999982,
"taskDurationMs": 6220.013,
"heapDeltaBytes": -45658108,
"heapUsedBytes": 177073368,
"domNodes": -8061,
"jsHeapTotalBytes": 13430784,
"scriptDurationMs": 112.49300000000001,
"eventListeners": -14924,
"totalBlockingTimeMs": 387,
"frameDurationMs": 17.773333333333238,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "vue-zoom-out-idle",
"durationMs": 8554.142000000069,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 8374.43,
"heapDeltaBytes": 24640756,
"heapUsedBytes": 197182228,
"domNodes": 0,
"jsHeapTotalBytes": -20185088,
"scriptDurationMs": 133.71299999999997,
"eventListeners": -12,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-zoom-out-idle",
"durationMs": 8752.957999999922,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 8600.839999999998,
"heapDeltaBytes": 26109480,
"heapUsedBytes": 196691972,
"domNodes": 0,
"jsHeapTotalBytes": -8912896,
"scriptDurationMs": 143.03699999999998,
"eventListeners": -14,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.780000000000047,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "workflow-execution",
"durationMs": 139.75799999991523,
"styleRecalcs": 9,
"styleRecalcDurationMs": 23.115000000000002,
"layouts": 3,
"layoutDurationMs": 1.7940000000000003,
"taskDurationMs": 104.575,
"heapDeltaBytes": 3151876,
"heapUsedBytes": 65299072,
"domNodes": 135,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 11.481000000000002,
"eventListeners": 17,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "workflow-execution",
"durationMs": 109.279000000015,
"styleRecalcs": 6,
"styleRecalcDurationMs": 16.313000000000002,
"layouts": 3,
"layoutDurationMs": 1.9160000000000001,
"taskDurationMs": 82.65,
"heapDeltaBytes": 3065516,
"heapUsedBytes": 65194784,
"domNodes": 129,
"jsHeapTotalBytes": 262144,
"scriptDurationMs": 6.559,
"eventListeners": 33,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
}
]
}🔬 E2E Coverage
Top 10 files by uncovered lines
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
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 (10)
Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe billing model now supports ChangesHosted billing destination
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant billingSdkStore
participant createBillingSdk
participant createBillingOperationLifecycle
participant BillingOperationState
billingSdkStore->>createBillingSdk: provide hostedBillingDestination
createBillingSdk->>createBillingOperationLifecycle: pass hostedDestination
createBillingOperationLifecycle->>BillingOperationState: store destination for hosted presentation
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The hosted destination is carried through the billing lifecycle and feature-flag wiring with coverage for both destinations and dynamic reads. No current merge-blocking risk is identified. 🚥 Pre-merge checks | ✅ 7✅ Passed checks (7 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #17783 +/- ##
========================================
Coverage 82.66% 82.67%
========================================
Files 2886 2888 +2
Lines 142753 142896 +143
Branches 36718 36767 +49
========================================
+ Hits 118009 118140 +131
- Misses 23508 23521 +13
+ Partials 1236 1235 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 25 files with indirect coverage changes 🚀 New features to boost your workflow:
|
… customer (Comfy-Org#17792) Linear FE-2216. Follow-up parked from Comfy-Org#17665 review. ## Why The rule "this operation needs the customer, so the dialog must show it instead of the amount step" was written three times: twice inline in `billingOperationStore`'s `subscriptionActionOperation` and `topupActionOperation` computeds, and once as `needsCustomerAttention` in the SDK rail's `topupOperationView`. Three copies of one rule across two rails means a change to it has to be found in three places. ## How - New leaf module `src/platform/workspace/billing/customerAttention.ts` exports the single pure predicate `needsCustomerAttention`. Its parameter is a structural readonly shape (`status`, `actionUrl`, `authenticationState`) that both the poller's `BillingOperation` record and the SDK's `TopupOperationView` satisfy, so neither rail's type is imported by the other. - The two store computeds call it and keep their own `type`, `workspaceId` and `dismissed` filters. - `topupOperationView.ts` loses its copy; `billingSdkStore.ts` imports the predicate from the new module. - `isParkedAwaitingCustomer` is a different rule (polling cadence, `authenticationRequiredSeen`) and is untouched. ## AS-IS / TO-BE No behaviour change. The predicate is byte-for-byte the store's condition; the view's copy was equivalent because a `TopupOperationView` in `reconciliation_needed` always carries a null `actionUrl`. ## Testing - New `customerAttention.test.ts` covers the rule as one `it.for` table: hosted action URL, `requires_action`, `failed_retryable`, `reconciliation_needed`, plain pending, settled. - `topupOperationView.test.ts` drops the assertions that only existed to cover the deleted copy; its projection assertions are unchanged. - `vitest run src/platform/workspace`: 74 files, 1608 tests 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 | in progress | | 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 | **this PR** | | follow-up | Opaque `BillingServerCode` (from the Comfy-Org#17656 review) | FE-2227 | in progress | ```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["opaque 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 FU9 stroke:#0366d6,stroke-width:4px ```
…ckout behind billing_sdk_topup_enabled (Comfy-Org#17793) Linear FE-2214. ## Why Workshop (comfy.org/models) is the last surface still buying credits through a hand-written `fetch` to `POST /api/billing/topup/checkout`: its own token handling, its own request shape, no re-mint on a 401, no capability gate. The billing SDK already owns that call for the cloud app. This puts Workshop on the same command behind the server flag the cloud rollout uses, so the two surfaces can be moved together and rolled back together. ## How - `apps/website/src/config/workshop-features.ts` — one authorized `GET {cloud}/api/features` per signed-in uid, decoded with a zod shape that reads only `billing_sdk_topup_enabled`. Signed out, a non-OK response, a request failure, a missing key, and a non-boolean value are all `false`. No other flag is read, and capabilities are not involved. - `apps/website/src/config/workshop-billing-sdk.ts` — the site's one composition of `@comfyorg/account/billing`, mirroring the app's `createBillingSdk`: session-backed transport bound to the Workshop cloud origin, credits/capabilities/status readers, the operation lifecycle (`sessionStorage` pointer, no embedded checkout, no telemetry sink — the site has no billing-operation funnel), and the top-up command. Built lazily, so a page that never opens the dialog never constructs it and nothing touches `sessionStorage` during a server render. Every constructor call lives in this one file. - `apps/website/src/lib/workshop/buy-credits-sdk.ts` — the routing seam the dialog now calls. Flag off, or the SDK answering `NOT_AVAILABLE` (the backend route is still flag-gated off), falls through to today's `createTopUpCheckout`. Any other SDK failure becomes a `TopUpCheckoutError` carrying the SDK's `httpStatus` and `code`, which is exactly what the dialog's existing `handleCheckoutFailure` already handles. - The SDK's `url` goes through the same Stripe-host allowlist the legacy path applies, not the SDK's https-only check; a URL that fails it is `INVALID_RESPONSE`. - `buy-credits.ts` keeps its behaviour and gains two exports the new seam reuses — the allowlist predicate and the return-URL builder — so both paths produce the same `return_url` and enforce the same hosts. - The dialog change is the import and one call site. The pre-opened tab, the `attemptId` return announce, and the balance watch are untouched; the SDK mints its own idempotency key, so `attemptId` stays purely the return correlation. ## AS-IS / TO-BE Nothing the user sees changes by design — same dialog, same steps, same tab hand-off. The only difference is which client issues the checkout request. | | AS-IS — flag off | TO-BE — flag on | | --- | --- | --- | | Amount step, $50 picked | <img width="420" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/refs/heads/assets/pr-17793-screenshots/flag-off-amount.png"> | <img width="420" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/refs/heads/assets/pr-17793-screenshots/flag-on-amount.png"> | | Checkout opened | <img width="420" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/refs/heads/assets/pr-17793-screenshots/flag-off-checkout.png"> | <img width="420" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/refs/heads/assets/pr-17793-screenshots/flag-on-checkout.png"> | Flag on against a backend that has not deployed the route — the SDK's 404 becomes `NOT_AVAILABLE`, the site's own request runs, and the dialog lands on the same checkout-opened step pointed at the cloud credits page: <img width="420" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/refs/heads/assets/pr-17793-screenshots/flag-on-fallback.png"> <details><summary>Full page for context</summary> <img width="840" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/refs/heads/assets/pr-17793-screenshots/flag-on-amount-full.png"> </details> ### Request evidence Recorded by the E2E spec from the intercepted `POST /api/billing/topup/checkout`. Every row buys the $50 pack, so every body carries `amount_cents: 5000` and a non-empty `idempotency_key`. | Flag | POST count | `Idempotency-Key` header | `Authorization` | `return_url` carries `workshopTopUpReturn` | | --- | --- | --- | --- | --- | | off | 1 | absent | `Bearer mock-workspace-jwt` | yes | | on | 1 | present, equal to the body's `idempotency_key` | `Bearer mock-workspace-jwt` | yes | | `/api/features` 500 | 1 | absent | `Bearer mock-workspace-jwt` | yes | | on, route answers 404 | 3 — SDK, then the site's request and its cloud-credits retry | on the SDK POST only | `Bearer mock-workspace-jwt` | yes on the first two; the retry uses the cloud credits URL | - Flag off (today, and every signed-out or failed flag read): byte-identical behaviour. The same `POST /api/billing/topup/checkout` with the same body, the same 404 retry through the cloud credits page, the same errors. The whole existing `BuyCreditsDialog` suite passes unchanged against this path. - Flag on: the checkout session comes from `createTopupCommand(...).createHostedTopupCheckout({ amountCents, returnUrl })` over the session transport — so the request carries a freshly minted workspace JWT, retries once on a 401 under its idempotency key, is refused early when `can_top_up` is false, and is superseded rather than misattributed if the workspace changes mid-flight. The dialog opens the returned URL exactly as before. A backend that has not enabled the route yet answers 404, which the SDK reports as `NOT_AVAILABLE` and the seam turns back into the legacy request, so turning the flag on before the backend is ready is a no-op. ## Testing - `apps/website/src/config/workshop-features.test.ts` — the flag on / off / missing / non-boolean / non-object body / non-OK status / request failure / signed out, one authorized read per uid with the bearer header and `cache: no-store`, and a re-read for the next uid. - `apps/website/src/lib/workshop/buy-credits-sdk.test.ts` — flag off calls the legacy request and never the SDK; flag on uses the SDK URL and never the legacy request, with the dialog's own return URL; `NOT_AVAILABLE` falls back; every other failure surfaces as a mapped `TopUpCheckoutError`; an SDK URL outside the allowlist is `INVALID_RESPONSE`. - `BuyCreditsDialog.test.ts` pins the flag off, so the existing suite is the regression proof that the fallback path did not move. - `pnpm --filter @comfyorg/website test:unit`, `pnpm typecheck`, `pnpm typecheck:website`, `pnpm lint`, `pnpm format`, `pnpm knip`, and `fallow audit --changed-since origin/main` all pass. - `apps/website/e2e/workshop-buy-credits-sdk.spec.ts` — the app-level proof, signing in and buying the $50 pack with every outbound destination fulfilled locally: the site issues the request while the flag is off; the billing SDK issues it while the flag is on, with the `Idempotency-Key` header equal to the body's key and the identical popup URL and checkout-opened step (the regression assertion); the flag read failing falls back to the site; a 404 from the hosted route falls back through the site's request and its cloud-credits retry; and the flag is read once per session, never before a checkout starts and not again for a second purchase. Run with `WEBSITE_E2E_PORT=4327 PLAYWRIGHT_HTML_OPEN=never pnpm --filter @comfyorg/website test:e2e --project=desktop e2e/workshop-buy-credits-sdk.spec.ts e2e/models-sign-in-draft.spec.ts e2e/payment.spec.ts` (30 passed). Rebase note: Comfy-Org#17782 renames the readers' and lifecycle's `session` option to `scopeSource`; every constructor call here is in `workshop-billing-sdk.ts`, so that is a one-file follow-up whichever lands first. ## 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 | **this PR** | | 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 | Opaque `BillingServerCode` (from the Comfy-Org#17656 review) | FE-2227 | in progress | ```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["opaque 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 WS stroke:#0366d6,stroke-width:4px ```
CodeJuggernaut
left a comment
There was a problem hiding this comment.
Port lands where the body says it does; nothing to add.
christian-byrne
left a comment
There was a problem hiding this comment.
Approving, so you have both of your rebase blockers cleared.
I came at this from capture-at-adoption, since that is where the Phase 2 scope bugs lived, and it holds up. Two things make it hold rather than happen to work:
The read is in one place and the reducer never does it. destinationFor is the only caller of hostedDestination() on the adoption path, and switchEvent puts the value on the event rather than letting the reducer reach for it. So the reducer stays a pure function of state and event, which is what makes the switch-back case trustworthy instead of timing-dependent.
The drop is explicit, and pinned twice. presentation_switched to embedded sets hostedDestination: undefined rather than spreading the old state, and that is asserted at both levels — operationState.test.ts:214 on the reducer, and operationLifecycle.test.ts:899 end to end ("takes on the destination when it moves to the hosted page, and drops it on the way back", with toBeUndefined() on both sides of the round trip). A stale destination surviving a rollback is the bug this shape exists to prevent, and it is the one that would have been easy to leave untested.
re-reads the destination for an operation recovered from the pointer covers the other half.
The fail-closed chain holds end to end. billingSdkStore.ts feeds flags.hostedBillingDestination, which is #17716's normalize that fails closed to 'stripe', and the port's own default is () => 'stripe'. Two independent defaults that agree, so a missing or garbage flag cannot route anyone to an origin that is not serving.
One thing to decide before it matters, not a finding
hostedDestination is currently write-only. It is produced, carried on operation state, and projected — and nothing outside the package reads it to route anyone. So the semantics in the docstring, "an operation recovered from the pointer lands on today's destination", have not met a consumer yet.
When one lands, that sentence has a consequence worth choosing deliberately: a customer mid-purchase on billing_web whose flag flips to stripe gets recovered claiming stripe, while their actual checkout session is still sitting on the other property. Re-reading is clearly right for a rollout kill switch and clearly wrong for "where is this person's live session", and right now the code does the first without having to distinguish them.
Not this PR's problem. Worth a line in whichever PR first routes on the value.
CI clean, coderabbit and CodeJuggernaut both approved. Nothing blocking from me.
huang47
left a comment
There was a problem hiding this comment.
Reviewed 2559f507f4a6b2531745c8cc07b22674bb44ab13.
Source evidence:
- Public state contract declares
presentationand optionalhostedDestinationindependently, allowing both invalid combinations described inline. - Store wiring reads
flags.hostedBillingDestination, but the store test mock only suppliesembeddedCheckoutEnabled.
Local test execution was blocked by dependency setup permissions in the read-only review workspace. These findings are based on source inspection; no runtime failure is claimed.
| @@ -43,6 +49,8 @@ export interface BillingOperationIdentity { | |||
| readonly kind: BillingOperationKind | |||
| readonly scope: BillingScope | |||
| readonly presentation: BillingPresentation | |||
| /** Where the hosted page is served; absent while the presentation is embedded. */ | |||
| readonly hostedDestination?: HostedBillingDestination | |||
There was a problem hiding this comment.
🔴 Can we encode the hosted destination invariant in the public state type before merge? packages/account/src/core/billing/operationState.ts:51 currently permits hosted state without a destination and embedded state with one, so consumers cannot narrow routing safely from presentation alone.
There was a problem hiding this comment.
Correct as stated, and not changing it in this PR.
{ presentation: 'embedded', hostedDestination: 'stripe' } and { presentation: 'hosted' } both typecheck today, and the docstring admits that rather than the type preventing it.
The reason it does not belong here is the blast radius. BillingOperationIdentity is exported from the package index, and four of the seven BillingOperationState variants extend or intersect it. An interface cannot extend a union, so splitting it turns PendingBillingOperation and FailedBillingOperation into intersection aliases, rewrites identityOf (operationState.ts:144) and the presentation_switched arm to construct the right variant, and forces every read of .hostedDestination to narrow on .presentation first — across operationLifecycle.ts, billingSdkTestUtils.ts, createBillingSdk.ts, billingSdkStore.ts and four test files. It is also a public contract that #17799, #17807 and #17809 are stacked on and consume as-is.
Pinned behaviourally in the meantime, at both levels: operationState.test.ts:214 asserts the reducer drops the destination switching back to embedded, and operationLifecycle.test.ts:899 asserts toBeUndefined() on both sides of a full hosted round trip. Weaker than an unrepresentable state, and I am not claiming otherwise — it catches the regression, it does not prevent the construction.
Christian approved this shape on the strength of those tests, so it is a design disagreement rather than something to settle unilaterally mid-stack. If you both want the union I would do it as its own PR against the merged stack. Jaewon will pick up the call.
There was a problem hiding this comment.
Landed in fcb013b0dc — see the reply on the newer thread (r4032223234) for the shape and the compile proof. Short version: you were right, and the reason I gave here for deferring it does not hold. An intersection distributes over a union, so the four BillingOperationIdentity & { phase: ... } arms and the satisfies in billingSdkTestUtils.ts kept compiling; only the two interfaces had to become intersections. Consumers can now narrow routing from presentation === 'hosted' and get a destination.
| embeddedCheckoutAvailable: () => | ||
| flags.embeddedCheckoutEnabled && | ||
| Boolean(import.meta.env.VITE_STRIPE_PUBLISHABLE_KEY), | ||
| hostedDestination: () => flags.hostedBillingDestination, |
There was a problem hiding this comment.
🟡 Can we add a composition-root test for the hosted destination flag? src/platform/workspace/billing/sdk/billingSdkStore.ts:79 is the only flag-to-SDK link, while the existing store mock omits hostedBillingDestination and lets options.hostedDestination() return undefined.
There was a problem hiding this comment.
Fixed in 8923091.
It was worse than thin coverage: with only embeddedCheckoutEnabled on the flag mock, flags.hostedBillingDestination read undefined in every test in the file, so nothing proved the store passes the flag to createBillingSdk at all.
The mock now supplies it, and two tests assert it — a table over both destinations reaching options.hostedDestination(), and re-reads the destination flag rather than capturing it at composition. Verified red: pinning the wiring to a literal 'stripe' fails both. 43/43 green in src/platform/workspace/billing/sdk/.
|
Thanks — noted on the write-only point, and you are right that it is a choice rather than a default. Carrying it to the PR that first routes on the value: the two cases need different sources. A rollout kill switch wants today's flag, which is what re-reading gives; "where is this person's live session" wants the destination the operation was created against, which has to come off the operation record rather than be re-derived. Recovering from the pointer currently answers the first question with the second one's shape, and the moment a consumer routes a mid-purchase customer that stops being harmless. I will make that PR state which of the two it is asking for rather than inherit the current behaviour silently. |
The recovery test pinned the harness destination to a single value, so it would have passed even if the lifecycle had captured the destination at construction. Start the port on 'stripe', flip it to 'billing_web' after the lifecycle exists, and recover: the assertion now fails when the lookup moves out of adopt().
…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 ```
…he operation identity BillingOperationIdentity now carries "hostedDestination is present iff presentation is hosted" in the type: a hosted identity cannot be built without a destination, and an embedded one cannot carry one. The pending and failed operations become intersections over that union, and the reducer rebuilds an identity from the narrowed variant instead of overwriting a key the other variant forbids.
fcb013b to
41c96be
Compare
|
@christian-byrne answering the rebase watch item, and flagging that this approval no longer counts. The approval was dismissed by a rebase that changed nothing in this PR's diff. Head moved to
if (outcome.status === 'ok') sdk.paymentMethods.invalidate()And a test would fail if it disappeared — both directions are pinned in
Both are call-count assertions on the reader mock, so deleting line 281 fails the first one outright. CI at the new head is mid-run with 0 failing so far; |
christian-byrne
left a comment
There was a problem hiding this comment.
Re-approving after the rebase. I checked the two things that a conflict resolution could have dropped without anything failing, rather than reinstating on trust.
1. The portal invalidation survived — billingSdkStore.ts:281, if (outcome.status === 'ok') sdk.paymentMethods.invalidate().
And it is no longer the fragile line I warned about, because it now has tests either side of the branch:
expect(harness.sdk.paymentMethods.invalidate).toHaveBeenCalledOnce()
expect(harness.sdk.paymentMethods.invalidate).not.toHaveBeenCalled()I asked for a grep after resolving. Pinning it instead is the better answer — the next rebase cannot lose it quietly, and the not.toHaveBeenCalled() case also pins the outcome.status === 'ok' gate, so a well-meaning simplification to "always invalidate" fails too.
2. The discriminated union survived — BillingPresentationState is intact at operationState.ts:47, both branches, on its new packages/account-core/ path. So the rename landed under it and the invariant came through the move.
CI is fully green, 0 failing and 0 pending, base main.
@huang47's three threads are still open and still his; his changes-requested is what gates this. Nothing outstanding from me.
…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 ```
CodeJuggernaut
left a comment
There was a problem hiding this comment.
Two things block on this head: a cancel on the SDK rail reports no telemetry when it fails before an operation exists, and the new rail flag pair has no owning test; the description still reads as a type-only port while the diff ships the subscription rail. The rest is duplication and test hygiene; huang47's hold stands until he returns.
Severity: Major (description)
What: the body describes a type-only port ("No UI change"; Testing gates over packages/account, src/platform/workspace/billing, src/config, useFeatureFlags.test.ts; the plan table's "5 slice 2 | Subscription flows through the SDK | todo") while the diff ships #17853's rail: the billing_sdk_subscription_enabled flag, useSubscriptionRail.ts, three rail branches in the adapter, three store commands, subscriptionOperationView.ts, the 285-line rail suite and the 214-line Playwright spec.
Why this is an issue: the body becomes the merge record and points the blocking reviewer at a type; the largest new suite and the browser spec sit outside every gate it names.
Proposed Fix: fold #17853's How, Testing and flag name into the body, move the plan row to "this PR", replace the stale packages/account and @comfyorg/account/billing names.
| @@ -456,6 +497,14 @@ export function useWorkspaceBilling(): BillingState & BillingActions { | |||
| } | |||
|
|
|||
| async function cancelSubscription(): Promise<void> { | |||
There was a problem hiding this comment.
Severity: Major
What: src/platform/workspace/composables/useWorkspaceBilling.ts:499-506 returns from the SDK-rail branch above the legacy cancel's started (:510-515), succeeded and failed events; the lifecycle emits started only at adoption (operationLifecycle.ts:502) and terminal events only for adopted records (:331-342); runSubscriptionCommand (billingSdkStore.ts:227-236) and onSubscriptionRail (:448-461) emit nothing; ALREADY_HELD carries no operation (subscriptionCommands.ts:155-158); the dialog skips its own failure event when the adapter owns billing (CancelSubscriptionDialogContent.vue:137-139).
Why this is an issue: with billing_sdk_subscription_enabled on, a cancel that fails before an operation exists (a transport 5xx, INVALID_REQUEST, a degraded status pre-read) or that the server reports already canceled emits no billing event at all, so a broken rail reads as healthy on the dashboard the rollout watches.
Proposed Fix: hoist attemptStartedAt and the started event above the rail branch, emit failed with categorizeBillingApiError(err) from onSubscriptionRail's error path before rethrowing, emit succeeded for the already-held no-op, and pin a REQUEST_FAILED rail cancel to one started plus one failed in useWorkspaceBilling.subscriptionRail.test.ts.
There was a problem hiding this comment.
Fixed in ba8bb77.
attemptStartedAt and the started event are now hoisted above the rail branch, so one cancel emits exactly one started whichever rail runs it, and the rail branch reports its own outcome: succeeded on a settle (including the ALREADY_HELD no-op, which projects to succeeded), failed with categorizeBillingApiError(err) on the error path before rethrowing. The legacy path keeps its own succeeded/failed; it just no longer emits a second started.
Three cases pinned in useWorkspaceBilling.subscriptionRail.test.ts under cancel telemetry on the billing SDK rail, asserting the exact stage sequence: a settle is ['started','succeeded'], a REQUEST_FAILED 500 is ['started','failed'] with failure_category: 'api_rejected', and a 404 fallback to the workspace client is ['started'] — that last one is the regression guard against the double started the hoist could have introduced.
resubscribe and the portal emit nothing on either rail, so there is no equivalent gap there.
| * `serverCode` stays out of it, being unbounded in shape and a value to match | ||
| * rather than to show. | ||
| */ | ||
| function describeFailure(code: string, httpStatus: number | undefined): string { |
There was a problem hiding this comment.
Severity: Major
What: src/platform/workspace/billing/sdk/subscriptionOperationView.ts:48-50 and :56-70 re-implement the failure projection topupOperationView.ts:83-90 owns, with the message `${code} (${httpStatus})` where the owner passes t('credits.topUp.unknownError'), and the branded serverCode passed through where the owner unwraps it; onSubscriptionRail writes it to the adapter's public error.value (useWorkspaceBilling.ts:457) and the cancel dialog shows it as the toast detail (CancelSubscriptionDialogContent.vue:141-145).
Why this is an issue: a rail cancel failure shows the customer REQUEST_FAILED (500) or SUPERSEDED where legacy showed the server's sentence or "Failed to cancel subscription", against #17853's "the same dialogs and toasts", and two projections of one failure shape in one directory already disagree.
Proposed Fix: one shared billingFailureError used by both views, keeping only the 404 branch local.
There was a problem hiding this comment.
Split: the half that reached the customer as a machine string is fixed, the describeFailure half is deliberate.
Fixed in f8fe86d — the settled-but-not-succeeded branch. It built new Error("phase: ${phase}") and dropped the failed operation's declineReason entirely, so a declined card read as phase: failed in the toast detail. It now goes through declineDetail — the same localization topupOperationView.ts:32 owns, imported rather than re-implemented — with t('billingOperation.subscriptionFailedDetail') for timed_out/reconciliation_needed/superseded, and the phase kept machine-readable on WorkspaceApiError.code. subscriptionOperationView.test.ts pins generic and insufficient_funds to different sentences, so the mapping has to stay keyed on the reason rather than collapse to one constant.
Not actioned: describeFailure on the transport failure. Understood, and kept on purpose. The dialog's summary is already t('subscription.cancelDialog.failed') and the detail line is the second line under it; the code plus status is what a customer can quote to support, where a second localized sentence would only restate the summary. That divergence from topup's t('credits.topUp.unknownError') is the intent documented at subscriptionOperationView.ts:41-46, not drift. serverCode staying branded is the same call — it is a value to match, not to show.
If you would rather both views converge on one billingFailureError, that is a presentation decision above this PR; Jaewon will pick it up rather than flip it here.
| respondNotFound: () => void | ||
| } | ||
|
|
||
| async function mockCloudBoot(page: Page): Promise<CancelRoute> { |
There was a problem hiding this comment.
Severity: Minor
What: browser_tests/tests/dialogs/cancelSubscriptionSdkRail.spec.ts:50-141 hand-rolls the cloud boot that cloudBootMocks.ts:24 (mockCloudBootRoutes), :83 (bootCloud) and cloudAppSetup.ts:65 (setupCloudApp) export, and names its local helper mockCloudBoot, the export's own name at cloudBootMocks.ts:59; the boot block now has four copies.
Why this is an issue: grepping the exported name returns two unrelated helpers and the copy already diverges from the owner.
Proposed Fix: mockCloudBootRoutes plus mockWorkspaceTokenMint and bootCloud, keep only the cancel-route recorder local, rename it.
There was a problem hiding this comment.
Understood and deliberately not actioned in this PR.
The name collision is real — the local helper does shadow cloudBootMocks.ts:59's export in a grep — but the failure mode is a confusing search result, not a broken test or a wrong artifact, and rewriting the spec onto mockCloudBootRoutes + mockWorkspaceTokenMint + bootCloud is a Playwright-fixture change whose only proof is a full E2E shard. Every push here restarts the suite and strands the two PRs stacked on this branch, so it is not worth spending that on a Minor.
Logged for the boot-block consolidation that covers all four copies at once rather than moving one of them; Jaewon will follow up there.
…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 ```
…y path emits (FE-2210) The SDK-rail branch of cancelSubscription returned above the legacy path's started/succeeded/failed events, and neither the command nor the lifecycle emits anything for a cancel that fails before an operation is adopted. With billing_sdk_subscription_enabled on, a transport 5xx, an INVALID_REQUEST or a server-reported already-canceled left the rollout dashboard with no event at all, so a broken rail read as healthy. Hoist attemptStartedAt and the started event above the rail branch so one cancel emits one started on either path, and report the rail's own outcome as succeeded or failed with the same failure_category the legacy path uses.
…the subscription rail (FE-2210)
projectSubscriptionResult turned a settled-but-not-succeeded command into
`new Error("phase: failed")`, discarding the failed operation's declineReason.
The adapter writes that message into error.value and the cancel dialog renders
it as the toast detail, so with billing_sdk_subscription_enabled on a declined
card read as "phase: failed" where the legacy path showed the server's sentence.
Project a failed settle through declineDetail, the localization the top-up view
already owns, and every other terminal phase through the generic subscription
failure copy. The phase stays machine-readable on WorkspaceApiError.code, where
this module already keeps its identifiers.
billingSdkSubscriptionEnabled and billingSdkSubscriptionRailEnabled had no owning describe, so dropping the unified-auth conjunction or swapping the fail-closed resolver kept every suite green while cancel, resubscribe and the portal composed the SDK over a session the host does not have. Mirror the top-up pair's tables.
christian-byrne
left a comment
There was a problem hiding this comment.
Re-approving after the head move. Both properties I pinned earlier survived, checked rather than assumed:
sdk.paymentMethods.invalidate()still atbillingSdkStore.ts, with its two tests either side of theoutcome.status === 'ok'gate.BillingPresentationStatestill the two-branch union, on thepackages/account-core/path.
CI is green, 0 failing and 0 pending.
@huang47 — your three threads are answered by code, and their paths have gone stale
Worth flagging directly, because it is probably why the re-stamp has not happened. All three of your threads cite packages/account/src/core/billing/operationState.ts. That path no longer exists — #17851 moved the package to packages/account-core/, so GitHub is anchoring your comments to a file that is gone, which makes them look unaddressed even where they are not.
The substance is in. fcb013b0dc landed exactly what you asked for:
export type BillingPresentationState =
| { readonly presentation: 'embedded'; readonly hostedDestination?: never }
| { readonly presentation: 'hosted'; readonly hostedDestination: HostedBillingDestination }I compiled it both directions and posted the results earlier — hosted-without-destination, embedded-with-destination, and hosted-without-destination through a function parameter are all rejected now, and the three valid shapes plus consumer narrowing still compile. The function-parameter case is the one that was actually open; excess-property checking already covered the literals.
Your composition-root test ask is the one I do not see landed.
Not mine to clear
The four CodeJuggernaut threads are new since my last pass — three Major, on useWorkspaceBilling.ts, useFeatureFlags.ts and subscriptionOperationView.ts. I have not reviewed those and they are not mine to resolve; flagging only so the count is not read as stale.
CodeJuggernaut
left a comment
There was a problem hiding this comment.
Two of the four fixes overshoot: rail cancels that issue an operation now report every event twice, and a settle failure lands as a network failure because the projected error has no status. Flag tests and the decline copy are right. Still not ready.
| duration_ms: Date.now() - attemptStartedAt | ||
| }) | ||
|
|
||
| telemetry?.trackBillingEvent({ |
There was a problem hiding this comment.
Severity: Major
What: src/platform/workspace/composables/useWorkspaceBilling.ts:519-535 now emits started for every cancel and, on the SDK rail, succeeded or failed for every outcome, while a rail cancel that issues an operation is already reported by the lifecycle: adopt emits started (operationLifecycle.ts:502-508), emitTerminalTelemetry the terminal event (:331-352), and reportTelemetry forwards every cancel event because its only suppression is non-resumed top-ups (billingSdkStore.ts:122-131).
Why this is an issue: a healthy rail cancel records started, started, succeeded, succeeded in one payload shape (billingSdkTelemetry.ts:22-31), so the dashboard double-counts the primary path and the two terminal copies can disagree on category; the comment at billingSdkStore.ts:117-121 calling the lifecycle the only reporter is now false, and the new suite cannot see any of it because createBillingSdk is mocked wholesale (useWorkspaceBilling.subscriptionRail.test.ts:71-72) and fakeBillingSdk has no onTelemetry.
Proposed Fix: one reporter per cancel: either suppress non-resumed cancel (and resubscribe) lifecycle events at billingSdkStore.ts:123 now that the composable reports both ends, or keep the lifecycle as the reporter for adopted operations and emit the composable's pair only when nothing was adopted (the ALREADY_HELD shape and a failure before begin issued); rewrite the comment at :117-121 to match and pin the total in a billingSdkStore test that drives reportTelemetry with a cancel lifecycle event.
There was a problem hiding this comment.
Confirmed, and it is mine: ba8bb77 hoisted the started event above the rail branch and added the terminal pair, without noticing the lifecycle already reports an adopted cancel. Traced the whole path rather than taking the line numbers on faith: cancelSubscription: () => settle('cancel', issueCancel) (subscriptionCommands.ts:432) -> settle calls lifecycle.begin (:264) -> adopt emits started (operationLifecycle.ts:502) and emitTerminalTelemetry the terminal event with a real failure_category and duration_ms (:331) -> onTelemetry: reportTelemetry (billingSdkStore.ts:86), whose only suppression is non-resumed top-ups. So a healthy rail cancel is started, started, succeeded, succeeded, exactly as you describe.
Not fixing it on this PR, and not because the finding is weak. Picking between your two options sets the rail's telemetry ownership rule, which #17856 and #17860 are both built on, and any push here strands both children on a rebase. That is rule 8 for me: the choice is Jaewon's, not an autofix's.
What lowers the urgency meanwhile: the rail is flag-gated (useSubscriptionRail returns null unless billingSdkSubscriptionRailEnabled), so nothing is double-counting in production today.
My reading for whoever takes it: option B is the better of the two, because the lifecycle's terminal event carries api_rejected / poll_timeout / reconciliation_needed and decline_reason, none of which the composable can reconstruct — which is also what F2 is about. That needs the rail outcome to say whether an operation was ever issued, rather than the composable inferring it from a missing HTTP status.
| const { operation, phase } = outcome | ||
| return { | ||
| status: 'error', | ||
| error: new WorkspaceApiError( |
There was a problem hiding this comment.
Severity: Major
What: src/platform/workspace/billing/sdk/subscriptionOperationView.ts:89-95 builds the settle failure as new WorkspaceApiError(message, undefined, phase), and the new .catch at useWorkspaceBilling.ts:530-531 categorizes it with categorizeBillingApiError, which returns 'network' for any WorkspaceApiError without a status (src/platform/telemetry/utils/billingFailureCategory.ts:14-15).
Why this is an issue: a declined card, a timed_out settle, a reconciliation_needed settle and a status-less SUPERSEDED all land in the bucket the helper's docblock reserves for "never reached the backend", while the lifecycle's event for the same operation says api_rejected, poll_timeout or reconciliation_needed (operationLifecycle.ts:260-275); the only pinned failure case is a transport 500 with a real status (useWorkspaceBilling.subscriptionRail.test.ts:233-252), so the wrong categories ship green.
Proposed Fix: once F1 leaves one reporter, categorize in the composable only the pre-operation failures projectFailure builds (they carry a status); if it must report settle failures, derive the category from the settle phase (or carry it on SubscriptionRailOutcome) rather than an HTTP status the projection never has, and add a failed-phase row to the rail telemetry table.
There was a problem hiding this comment.
Confirmed. projectUnsuccessfulSettle builds new WorkspaceApiError(message, undefined, phase) (subscriptionOperationView.ts:89), and categorizeBillingApiError returns 'network' for any WorkspaceApiError whose status is undefined (billingFailureCategory.ts:14-15) — a bucket its own docblock reserves for "never reached the backend". So a declined card, a timed_out settle and a reconciliation_needed settle all report as network while the lifecycle's event for the same operation says otherwise.
Same handling as F1, and for the same reason: the category has to come from the settle phase, which is only worth wiring once the single-reporter question is settled, and settling it here forces a rebase on #17856 and #17860. Escalated to Jaewon with F1 rather than patched around.
| }) | ||
| }) | ||
|
|
||
| describe('cancel telemetry on the billing SDK rail', () => { |
There was a problem hiding this comment.
Severity: Minor (test)
What: the cancel telemetry on the billing SDK rail describe (useWorkspaceBilling.subscriptionRail.test.ts:218-263) asserts exact stage sequences, its first case titled "one started and one succeeded", on a harness where createBillingSdk is mocked wholesale (:71-72) and fakeBillingSdk (:108) has no onTelemetry, and no case drives a settle to failed.
Why this is an issue: the suite offered as proof of one report per cancel stays green through the duplicate at head and any reintroduction of it, and the title claims a global count the harness cannot observe.
Proposed Fix: pin the total one level down in a billingSdkStore test that drives reportTelemetry with a cancel lifecycle event (or scope the title to the composable's own events), and add the settle-to-failed row both Majors live on.
There was a problem hiding this comment.
Agreed, and the harness limitation is the sharper half: createBillingSdk is mocked wholesale and fakeBillingSdk has no onTelemetry, so the suite can only ever see the composable's own events — it would stay green through the duplicate at head. The title claims a total it cannot observe.
Leaving it for now: the right pin is a billingSdkStore test driving reportTelemetry with a cancel lifecycle event, and what that test should assert depends on which reporter F1 keeps. It lands with F1 rather than as a separate push.
| @@ -109,10 +116,15 @@ export const useBillingSdkStore = defineStore('billingSdk', () => { | |||
|
|
|||
| // A top-up the dialog issued is reported by the dialog, exactly as before; | |||
There was a problem hiding this comment.
Severity: Minor (comments)
What: src/platform/workspace/billing/sdk/billingSdkStore.ts:117-121 still says a cancel or resubscribe "has no such second reporter on this rail ... so the lifecycle's events are the only ones it emits", and billingSdkStore.test.ts:371 is titled "reports a cancel it issued, which no dialog reports on this rail".
Why this is an issue: both state the ownership boundary a reader uses to decide whether to add a reporter, and after ba8bb77 both are false; leaving them is how resubscribe and the portal acquire the same duplicate.
Proposed Fix: rewrite both with whichever ownership rule F1 settles on.
There was a problem hiding this comment.
Correct — both are false at head, and ba8bb77 is what made them false. The comment at billingSdkStore.ts:117-121 still asserts the ownership boundary a reader would use to decide whether to add a reporter, which is precisely how resubscribe and the portal would pick up the same duplicate.
Rewriting it now would mean writing down an ownership rule that F1 has not settled, so it goes with F1.
| } | ||
| }) | ||
|
|
||
| await expect(setupBilling().cancelSubscription()).rejects.toThrow( |
There was a problem hiding this comment.
Severity: Minor (test)
What: useWorkspaceBilling.subscriptionRail.test.ts:211-213 pins "We couldn't update your subscription. Please try again.", the sentence subscriptionOperationView.test.ts:51 already owns.
Why this is an issue: two owners for one copy line; a copy edit reddens both suites for one fact.
Proposed Fix: assert the composable forwards the projection's message, or drop the sentence pin here.
There was a problem hiding this comment.
Agreed, two owners for one sentence. subscriptionOperationView.test.ts:51 owns the copy; the composable suite should assert it forwards the projection's message rather than re-pinning the string.
Real but small, and not worth a push of its own on this PR: every push here restarts the full check set and strands #17856 and #17860. Folding it into the F1 change.
…act when the hosted destination says billing_web (#17860) Stacked on #17856 (base branch `jaewon/fe-2216-plan-change`) → #17853 → #17783; merge those first. ## Why Rollout layer C (`hosted_billing_destination`, `stripe` | `billing_web`, PostHog at 100% `stripe`) decides where a hosted billing action lands. The plan says the host reads the flag, hands it to the SDK (#17783) and, when it says `billing_web`, mints a `/v1/<intent>` entry with `return_to` from `@comfyorg/billing-contract`, the one definition of that route surface (#17795); when it says `stripe`, the backend's URL is opened unchanged. Today the host only opens the bare billing-web origin from the user popover (#17716) with no intent and no `return_to`, and "Billing & invoices" in the settings panel always goes to the Stripe portal. This is the last un-opened code item before the Phase 7 host proof. ## How - `src/platform/workspace/billing/hostedBillingRoutes.ts`: `hostedBillingRoute(destination, intent)` returns `{ kind: 'billing_web', url }` built by `buildBillingEntryUrl({ billingOrigin, intent, product: 'comfyui', returnTo: 'comfyui_workspace' })`, or `{ kind: 'provider' }` meaning "use the server's URL". The environment is derived, not hardcoded: the cloud base URL's hostname through the existing `resolveDeployEnv` map (`prod-v2 | stg-v2 | test-v2` → `production | staging | test`), which also classifies a local dev session by the backend it talks to. Fails closed to the provider on: no configured origin, an unknown backend family, a return target with no destination in that family, or an entry the contract refuses. A path-prefixed `VITE_BILLING_WEB_URL` keeps its prefix under the minted route. - Consumers: the popover's "Plans and pricing" mints the `pricing` intent (billing-web routes it to the subscription view; the in-app dialog stays the `stripe` behaviour and the popup-blocked fallback); `useWorkspaceBilling.manageSubscription()` mints `payment-methods` **before** either rail is consulted, so on `billing_web` no portal URL is requested on the SDK rail or the legacy one, and `openPortalWindow` + `refreshOnPortalReturn` still run so the return re-reads status, balance and capabilities. - Also fixed on the way: the popover treated a falsy `window.open(…, "noopener,noreferrer")` result as a blocked popup and showed the in-app pricing dialog as a fallback. Per the HTML spec `noopener` always returns `null`, so on `billing_web` the tab and the dialog opened together — a latent defect inherited from #17370 on `main`, caught by this PR's evidence run. The fallback is gone; the E2E `window.open` stub now returns `null` for `noopener` like a browser does, and a popover case covers both destinations. - Left on the provider on purpose: `useSubscriptionCheckout.recoverOutstandingPayment` and the `payment_method_url` steps inside an operation are mid-checkout provider steps, not hosted management; `invoices` and `result` are not served by billing-web yet (`ComingSoonView`), so nothing mints them; the legacy `/customers` rail's `accessBillingPortal` is being retired by the personal-billing flip and is not touched. - `@comfyorg/billing-contract` becomes a root `workspace:*` dependency. The CI cloud build for E2E (`.github/actions/build-cloud-frontend`, used only by `ci-tests-e2e.yaml` and `pr-update-playwright-expectations.yaml`, never by a deploy) gets `VITE_BILLING_WEB_URL=https://billing-web.example`, a reserved origin the spec stubs, reachable only when the server flag says `billing_web`. - No frontend-derived server state: the destination is the flag as-is; the host chooses only the URL shape. ## AS-IS / TO-BE | AS-IS — `hosted_billing_destination: stripe` | TO-BE — `hosted_billing_destination: billing_web` | | --- | --- | | **1. User popover, "Plans and pricing" hovered**<br><img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17860-screenshots/screenshots/as-is-popover-plans.png"><br>Same menu item, unchanged by the flag. | **1. User popover, "Plans and pricing" hovered**<br><img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17860-screenshots/screenshots/to-be-popover-plans.png"><br>Same menu item, unchanged by the flag. | | **2. After clicking "Plans and pricing"**<br><img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17860-screenshots/screenshots/as-is-plans-result.png"><br>In-app "Choose a Plan" dialog, no tab opened. | **2. After clicking "Plans and pricing"**<br><img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17860-screenshots/screenshots/to-be-plans-result.png"><br>`billing-web.example/v1/pricing?product=comfyui&return_to=comfyui_workspace` tab opens and nothing else: `window.open` returns `null` under `noopener` as the spec requires, and no in-app dialog is left behind. | | **3. Settings ▸ Workspace ▸ Plan & Credits, before clicking "Billing & invoices"**<br><img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17860-screenshots/screenshots/as-is-settings-billing.png"><br>Identical panel; the destination is only read on click. | **3. Settings ▸ Workspace ▸ Plan & Credits, before clicking "Billing & invoices"**<br><img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17860-screenshots/screenshots/to-be-settings-billing.png"><br>Identical panel; the destination is only read on click. | | **4. After clicking "Billing & invoices"**<br><img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17860-screenshots/screenshots/as-is-manage-result.png"><br>`POST /api/billing/payment-portal` recorded, and the URL it returned (`https://billing.example/portal`) opened. | **4. After clicking "Billing & invoices"**<br><img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17860-screenshots/screenshots/to-be-manage-result.png"><br>No request to `/api/billing/payment-portal` on either rail; `billing-web.example/v1/payment-methods?product=comfyui&return_to=comfyui_workspace` minted and opened. | | **5. Return trip — refocusing the app tab after the hosted tab opened**<br><img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17860-screenshots/screenshots/as-is-return-refresh.png"><br>`/api/billing/status`, `/balance` and `/capabilities` re-read. | **5. Return trip — refocusing the app tab after the hosted tab opened**<br><img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17860-screenshots/screenshots/to-be-return-refresh.png"><br>Same three reads; `openPortalWindow` + `refreshOnPortalReturn` still run on the minted route. | - AS-IS (`stripe`, today's default): popover → in-app pricing dialog; settings → Stripe portal via `POST /billing/payment-portal`. - TO-BE (`billing_web`): popover → `<billing-web>/v1/pricing?product=comfyui&return_to=comfyui_workspace`; settings → `<billing-web>/v1/payment-methods?…`, no portal request on either rail; the app re-reads billing state on return. ## Testing | Gate | Result | | --- | --- | | `vitest run src/platform/workspace src/composables/billing src/composables/useFeatureFlags src/config` | 91 files, 1890 tests (19 new route cases: intent × destination × env × prefix × each fail-closed branch; 3 new adapter cases; 3 popover cases re-pointed) | | `packages/billing-contract` vitest | 3 files, 62 tests | | `pnpm typecheck`, `typecheck:browser`, `lint`, `format`, `knip` | exit 0 | | `fallow audit --changed-since origin/jaewon/fe-2216-plan-change` | no issues in 10 changed files | | `PLAYWRIGHT_TEST_URL=http://localhost:5431 pnpm exec playwright test --project=cloud browser_tests/tests/dialogs/hostedBillingDestination.spec.ts --reporter=list`, against `VITE_BILLING_WEB_URL=https://billing-web.example pnpm dev:cloud` | `4 passed (4.6s)` — settings on both destinations, plus the two new avatar-menu cases: `opens the in-app pricing table from the avatar menu while the destination is stripe` and `opens the billing-web pricing entry alone from the avatar menu while the destination is billing_web` | ## 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) | | 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 | merged (#17798) | | 8 ui | account-ui composables (`usePlans`, `usePaymentMethods`, `usePreviewSubscribe`) | FE-2331 | merged (#17798) | | 7 | billing-web own-origin session, sign-in, SDK composition | FE-2218 | merged (#17798) | | 7 | billing-web unit tests in CI (`ci-billing-web-unit.yaml`) | FE-2218 | merged (#17827, #17844) | | 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 | merged (#17798) | | 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 | #17853 (review) | | 5 slice 2b | Subscribe and plan change through the SDK, priced by the server | FE-2216 | #17856 (review; parent of this PR) | | 7 / rollout C | Host mints billing-web `/v1/<intent>` entries with `return_to` when `hosted_billing_destination` is `billing_web` | FE-2218 | **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["PR 17853 slice 2a cancel / resubscribe / portal rail"] S2B["PR 17856 slice 2b subscribe + plan change"] LC["Layer C: host mints billing-web entries"] 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 S2B --> LC RB --> LC HD --> LC LC --> P7 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 BWV fill:#d4edda,stroke:#155724 style BWS fill:#d4edda,stroke:#155724 style P8 fill:#d4edda,stroke:#155724 style P8RD fill:#d4edda,stroke:#155724 style CORS fill:#d4edda,stroke:#155724 style FU13 fill:#d4edda,stroke:#155724 style FU12 fill:#d4edda,stroke:#155724 style FU11 fill:#d4edda,stroke:#155724 style P8PV fill:#d4edda,stroke:#155724 style LC stroke:#0366d6,stroke-width:4px ```
…act when the hosted destination says billing_web (#17860) Stacked on #17856 (base branch `jaewon/fe-2216-plan-change`) → #17853 → Rollout layer C (`hosted_billing_destination`, `stripe` | `billing_web`, PostHog at 100% `stripe`) decides where a hosted billing action lands. The plan says the host reads the flag, hands it to the SDK (#17783) and, when it says `billing_web`, mints a `/v1/<intent>` entry with `return_to` from `@comfyorg/billing-contract`, the one definition of that route surface (#17795); when it says `stripe`, the backend's URL is opened unchanged. Today the host only opens the bare billing-web origin from the user popover (#17716) with no intent and no `return_to`, and "Billing & invoices" in the settings panel always goes to the Stripe portal. This is the last un-opened code item before the Phase 7 host proof. - `src/platform/workspace/billing/hostedBillingRoutes.ts`: `hostedBillingRoute(destination, intent)` returns `{ kind: 'billing_web', url }` built by `buildBillingEntryUrl({ billingOrigin, intent, product: 'comfyui', returnTo: 'comfyui_workspace' })`, or `{ kind: 'provider' }` meaning "use the server's URL". The environment is derived, not hardcoded: the cloud base URL's hostname through the existing `resolveDeployEnv` map (`prod-v2 | stg-v2 | test-v2` → `production | staging | test`), which also classifies a local dev session by the backend it talks to. Fails closed to the provider on: no configured origin, an unknown backend family, a return target with no destination in that family, or an entry the contract refuses. A path-prefixed `VITE_BILLING_WEB_URL` keeps its prefix under the minted route. - Consumers: the popover's "Plans and pricing" mints the `pricing` intent (billing-web routes it to the subscription view; the in-app dialog stays the `stripe` behaviour and the popup-blocked fallback); `useWorkspaceBilling.manageSubscription()` mints `payment-methods` **before** either rail is consulted, so on `billing_web` no portal URL is requested on the SDK rail or the legacy one, and `openPortalWindow` + `refreshOnPortalReturn` still run so the return re-reads status, balance and capabilities. - Also fixed on the way: the popover treated a falsy `window.open(…, "noopener,noreferrer")` result as a blocked popup and showed the in-app pricing dialog as a fallback. Per the HTML spec `noopener` always returns `null`, so on `billing_web` the tab and the dialog opened together — a latent defect inherited from #17370 on `main`, caught by this PR's evidence run. The fallback is gone; the E2E `window.open` stub now returns `null` for `noopener` like a browser does, and a popover case covers both destinations. - Left on the provider on purpose: `useSubscriptionCheckout.recoverOutstandingPayment` and the `payment_method_url` steps inside an operation are mid-checkout provider steps, not hosted management; `invoices` and `result` are not served by billing-web yet (`ComingSoonView`), so nothing mints them; the legacy `/customers` rail's `accessBillingPortal` is being retired by the personal-billing flip and is not touched. - `@comfyorg/billing-contract` becomes a root `workspace:*` dependency. The CI cloud build for E2E (`.github/actions/build-cloud-frontend`, used only by `ci-tests-e2e.yaml` and `pr-update-playwright-expectations.yaml`, never by a deploy) gets `VITE_BILLING_WEB_URL=https://billing-web.example`, a reserved origin the spec stubs, reachable only when the server flag says `billing_web`. - No frontend-derived server state: the destination is the flag as-is; the host chooses only the URL shape. | AS-IS — `hosted_billing_destination: stripe` | TO-BE — `hosted_billing_destination: billing_web` | | --- | --- | | **1. User popover, "Plans and pricing" hovered**<br><img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17860-screenshots/screenshots/as-is-popover-plans.png"><br>Same menu item, unchanged by the flag. | **1. User popover, "Plans and pricing" hovered**<br><img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17860-screenshots/screenshots/to-be-popover-plans.png"><br>Same menu item, unchanged by the flag. | | **2. After clicking "Plans and pricing"**<br><img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17860-screenshots/screenshots/as-is-plans-result.png"><br>In-app "Choose a Plan" dialog, no tab opened. | **2. After clicking "Plans and pricing"**<br><img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17860-screenshots/screenshots/to-be-plans-result.png"><br>`billing-web.example/v1/pricing?product=comfyui&return_to=comfyui_workspace` tab opens and nothing else: `window.open` returns `null` under `noopener` as the spec requires, and no in-app dialog is left behind. | | **3. Settings ▸ Workspace ▸ Plan & Credits, before clicking "Billing & invoices"**<br><img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17860-screenshots/screenshots/as-is-settings-billing.png"><br>Identical panel; the destination is only read on click. | **3. Settings ▸ Workspace ▸ Plan & Credits, before clicking "Billing & invoices"**<br><img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17860-screenshots/screenshots/to-be-settings-billing.png"><br>Identical panel; the destination is only read on click. | | **4. After clicking "Billing & invoices"**<br><img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17860-screenshots/screenshots/as-is-manage-result.png"><br>`POST /api/billing/payment-portal` recorded, and the URL it returned (`https://billing.example/portal`) opened. | **4. After clicking "Billing & invoices"**<br><img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17860-screenshots/screenshots/to-be-manage-result.png"><br>No request to `/api/billing/payment-portal` on either rail; `billing-web.example/v1/payment-methods?product=comfyui&return_to=comfyui_workspace` minted and opened. | | **5. Return trip — refocusing the app tab after the hosted tab opened**<br><img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17860-screenshots/screenshots/as-is-return-refresh.png"><br>`/api/billing/status`, `/balance` and `/capabilities` re-read. | **5. Return trip — refocusing the app tab after the hosted tab opened**<br><img width="480" src="https://raw.githubusercontent.com/Comfy-Org/ComfyUI_frontend/assets/pr-17860-screenshots/screenshots/to-be-return-refresh.png"><br>Same three reads; `openPortalWindow` + `refreshOnPortalReturn` still run on the minted route. | - AS-IS (`stripe`, today's default): popover → in-app pricing dialog; settings → Stripe portal via `POST /billing/payment-portal`. - TO-BE (`billing_web`): popover → `<billing-web>/v1/pricing?product=comfyui&return_to=comfyui_workspace`; settings → `<billing-web>/v1/payment-methods?…`, no portal request on either rail; the app re-reads billing state on return. | Gate | Result | | --- | --- | | `vitest run src/platform/workspace src/composables/billing src/composables/useFeatureFlags src/config` | 91 files, 1890 tests (19 new route cases: intent × destination × env × prefix × each fail-closed branch; 3 new adapter cases; 3 popover cases re-pointed) | | `packages/billing-contract` vitest | 3 files, 62 tests | | `pnpm typecheck`, `typecheck:browser`, `lint`, `format`, `knip` | exit 0 | | `fallow audit --changed-since origin/jaewon/fe-2216-plan-change` | no issues in 10 changed files | | `PLAYWRIGHT_TEST_URL=http://localhost:5431 pnpm exec playwright test --project=cloud browser_tests/tests/dialogs/hostedBillingDestination.spec.ts --reporter=list`, against `VITE_BILLING_WEB_URL=https://billing-web.example pnpm dev:cloud` | `4 passed (4.6s)` — settings on both destinations, plus the two new avatar-menu cases: `opens the in-app pricing table from the avatar menu while the destination is stripe` and `opens the billing-web pricing entry alone from the avatar menu while the destination is billing_web` | 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) | | 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 | merged (#17798) | | 8 ui | account-ui composables (`usePlans`, `usePaymentMethods`, `usePreviewSubscribe`) | FE-2331 | merged (#17798) | | 7 | billing-web own-origin session, sign-in, SDK composition | FE-2218 | merged (#17798) | | 7 | billing-web unit tests in CI (`ci-billing-web-unit.yaml`) | FE-2218 | merged (#17827, #17844) | | 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 | merged (#17798) | | 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 | #17853 (review) | | 5 slice 2b | Subscribe and plan change through the SDK, priced by the server | FE-2216 | #17856 (review; parent of this PR) | | 7 / rollout C | Host mints billing-web `/v1/<intent>` entries with `return_to` when `hosted_billing_destination` is `billing_web` | FE-2218 | **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["PR 17853 slice 2a cancel / resubscribe / portal rail"] S2B["PR 17856 slice 2b subscribe + plan change"] LC["Layer C: host mints billing-web entries"] 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 S2B --> LC RB --> LC HD --> LC LC --> P7 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 BWV fill:#d4edda,stroke:#155724 style BWS fill:#d4edda,stroke:#155724 style P8 fill:#d4edda,stroke:#155724 style P8RD fill:#d4edda,stroke:#155724 style CORS fill:#d4edda,stroke:#155724 style FU13 fill:#d4edda,stroke:#155724 style FU12 fill:#d4edda,stroke:#155724 style FU11 fill:#d4edda,stroke:#155724 style P8PV fill:#d4edda,stroke:#155724 style LC stroke:#0366d6,stroke-width:4px ```
Linear FE-2210 / FE-2218.
Why
The billing rollout turns three independent switches: (A) the host adoption flag that
picks legacy billing or the SDK, (B) the SDK's presentation routing — embedded challenge
or hosted page, decided by
selectBillingPresentation, and (C) the hosted destination —which origin actually serves a hosted page: the provider page behind the backend's
action_url, or the hosted billing app.C is a host fact. Only the host can read the server flag
hosted_billing_destination, sothe SDK must take it as a port rather than infer it, exactly like
embeddedCheckoutAvailable.And it has to reach operation state, not just the routing function: a consumer holding a
hosted operation has to decide from the state alone whether to open
actionUrlor hand theoperation to the billing-web route. The tab pointer stores only the operation id, so a
recovered operation has to re-read the port rather than replay a stored answer.
The route builder that consumes the value lands in a later PR; this one only makes the
value available.
How
HostedBillingDestination = 'stripe' | 'billing_web'now lives in the SDK core(
operationState.ts, next toBillingPresentation) and is exported from@comfyorg/account/billing.src/config/billingWeb.tsre-exports the core type andkeeps
normalizeHostedBillingDestinationas the host's flag-narrowing boundary.hostedDestination?: () => HostedBillingDestination.Absent means
stripe, so a host that never wires it keeps every hosted operation onthe provider page.
BillingOperationStatecarrieshostedDestinationwhilepresentation === 'hosted'and nothing otherwise. The port is read whenever the lifecycle routes an operation
hosted — on
begin, onrecover(server pending or pointer), and onswitchPresentation(id, 'hosted'); a switch back to embedded drops it.reduceBillingOperationstays pure:presentation_switchednow carries thedestination on its hosted variant instead of the reducer reading a port.
createBillingSdkrequireshostedDestination— the composition root is the oneplace that knows the server flag, so it is not optional there, the same as
embeddedCheckoutAvailable;billingSdkStorepasses() => flags.hostedBillingDestination.projectPaymentStepand the eight-state projection are untouched.AS-IS / TO-BE
No UI change. AS-IS a hosted operation's state says only that it is hosted, so nothing
downstream can tell the provider page from the billing app. TO-BE the same state also
says which origin serves it, re-read from the host port at every adoption — including an
operation recovered after a reload — with
stripeas the fail-toward default.Testing
packages/accountVitest: 38 files / 592 tests green. Three new lifecycle cases(absent port vs
billing_webon begin, re-read on recovery from the pointer,adopt-on-switch and drop-on-rollback); the existing reducer switch test extended with
the destination assertions.
src/platform/workspace/billing,src/config,useFeatureFlags.test.ts: 10 files / 153 tests green, including one newcreateBillingSdkcase proving the option reaches the lifecycle.packages/account-uiVitest: 6 files / 23 tests green, unchanged.pnpm typecheck,pnpm lint,pnpm format,pnpm knip, andfallow audit --changed-since origin/mainall clean.Independent of #17782; both touch the lifecycle options and the app composition root, so whichever lands second gets a one-line rebase.
Where this sits in the plan
Billing SDK track FE-2210 (implementation plan V2). Hybrid model: top-up in-app, subscription management / invoices / payment methods on the hosted billing app.
@comfyorg/account-uicomposables +CheckoutStepsbilling_sdk_topup_enabledhosted_billing_destinationserver flag read by the hosthostedDestinationport on the lifecycle, value on operation state@comfyorg/account→@comfyorg/account-corerenamebilling-contractroute builder +return_toregistrycreateHostedTopupCheckoutpreviewSubscribe, plans, payment-methods readers + account-ui + billing-web viewsingest-types,account-core,billing-contract), Platform install, billing-web live top-up