Repository navigation
feat(account): hosted top-up checkout command on the top-up surface (FE-2214) - #17689
Conversation
…FE-2214) Adds createHostedTopupCheckout to the top-up command: the POST /api/billing/topup/checkout route Workshop and Platform ship on, now decodable because the ingest-types regen (#17396) carries CreateTopupCheckoutRequest/Response. - input validated by the generated request schema; INVALID_AMOUNT / INVALID_RETURN_URL before anything is sent - same capability gate as the in-app command (ACCESS_DENIED with the server's denial), then the pre-purchase balance is read - one idempotency key per attempt in the body and on the request; 404 maps to NOT_AVAILABLE so a host keeps its legacy path - checkout_url must be https, else MALFORMED_RESPONSE; session_id passes through when present - no operation is adopted or invented: the result is the session URL plus baselineMicros, the host executes its OpenUrlMode and arms createBalanceWatch on return readTopupEligibility now returns the two failures it can actually produce.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
🎨 Storybook: ✅ Built — View Storybook🌐 Website E2ETip All tests passed.
🎭 Playwright: ✅ 1996 passed, 0 failed · 2 flaky📊 Browser Reports
📦 Bundle Size
⚡ Performance Report
Absolute values
Raw data{
"timestamp": "2026-09-15T01:45:06.122Z",
"gitSha": "f62b1dfb7b7b19fe5c25923e7cf8006aa74e4490",
"branch": "jaewon/fe-2214-hosted-topup-checkout",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 1992.7189999999655,
"styleRecalcs": 8,
"styleRecalcDurationMs": 4.744,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 411.7289999999999,
"heapDeltaBytes": 12994852,
"heapUsedBytes": 74202064,
"domNodes": -263,
"jsHeapTotalBytes": 5758976,
"scriptDurationMs": 6.256000000000001,
"eventListeners": -154,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-idle",
"durationMs": 1993.9170000000104,
"styleRecalcs": 10,
"styleRecalcDurationMs": 5.642999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 303.549,
"heapDeltaBytes": 11635164,
"heapUsedBytes": 73669768,
"domNodes": -258,
"jsHeapTotalBytes": 4972544,
"scriptDurationMs": 6.284,
"eventListeners": -152,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1677.6399999999967,
"styleRecalcs": 73,
"styleRecalcDurationMs": 16.898000000000003,
"layouts": 14,
"layoutDurationMs": 2.999,
"taskDurationMs": 597.92,
"heapDeltaBytes": 18049704,
"heapUsedBytes": 80086976,
"domNodes": -260,
"jsHeapTotalBytes": 4972544,
"scriptDurationMs": 101.852,
"eventListeners": -154,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1694.947999999954,
"styleRecalcs": 74,
"styleRecalcDurationMs": 16.45,
"layouts": 14,
"layoutDurationMs": 2.915,
"taskDurationMs": 603.1220000000001,
"heapDeltaBytes": -962576,
"heapUsedBytes": 61331440,
"domNodes": -258,
"jsHeapTotalBytes": 5234688,
"scriptDurationMs": 105.259,
"eventListeners": -184,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1711.1019999999826,
"styleRecalcs": 31,
"styleRecalcDurationMs": 11.112,
"layouts": 6,
"layoutDurationMs": 0.835,
"taskDurationMs": 252.85000000000002,
"heapDeltaBytes": 2144560,
"heapUsedBytes": 64323512,
"domNodes": 76,
"jsHeapTotalBytes": 5242880,
"scriptDurationMs": 7.445000000000002,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1717.4280000000408,
"styleRecalcs": 31,
"styleRecalcDurationMs": 11.787,
"layouts": 6,
"layoutDurationMs": 0.8290000000000001,
"taskDurationMs": 212.27300000000002,
"heapDeltaBytes": 2163196,
"heapUsedBytes": 64558928,
"domNodes": 77,
"jsHeapTotalBytes": 4718592,
"scriptDurationMs": 7.743999999999999,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "dom-widget-clipping",
"durationMs": 499.6810000000096,
"styleRecalcs": 12,
"styleRecalcDurationMs": 5.289000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 312.042,
"heapDeltaBytes": 17932504,
"heapUsedBytes": 80130756,
"domNodes": 20,
"jsHeapTotalBytes": 5505024,
"scriptDurationMs": 113.32400000000001,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66666666666665,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "dom-widget-clipping",
"durationMs": 442.21099999998614,
"styleRecalcs": 13,
"styleRecalcDurationMs": 5.997000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 285.998,
"heapDeltaBytes": 17585720,
"heapUsedBytes": 79547024,
"domNodes": 22,
"jsHeapTotalBytes": 6029312,
"scriptDurationMs": 112.22300000000001,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.663333333333338,
"p95FrameDurationMs": 16.700000000000273
},
{
"name": "large-graph-idle",
"durationMs": 2025.3749999999968,
"styleRecalcs": 8,
"styleRecalcDurationMs": 5.077999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 468.99899999999997,
"heapDeltaBytes": -2550680,
"heapUsedBytes": 76284700,
"domNodes": -252,
"jsHeapTotalBytes": -8192,
"scriptDurationMs": 20.057,
"eventListeners": -182,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-idle",
"durationMs": 2023.8630000000057,
"styleRecalcs": 10,
"styleRecalcDurationMs": 5.756000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 467.4320000000001,
"heapDeltaBytes": -737308,
"heapUsedBytes": 79383352,
"domNodes": -241,
"jsHeapTotalBytes": 778240,
"scriptDurationMs": 19.323,
"eventListeners": -180,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "large-graph-pan",
"durationMs": 2115.73599999997,
"styleRecalcs": 69,
"styleRecalcDurationMs": 11.325000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1054.446,
"heapDeltaBytes": -6467964,
"heapUsedBytes": 74910152,
"domNodes": -215,
"jsHeapTotalBytes": 516096,
"scriptDurationMs": 559.381,
"eventListeners": -182,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-pan",
"durationMs": 2145.1019999999517,
"styleRecalcs": 70,
"styleRecalcDurationMs": 9.549999999999997,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1165.884,
"heapDeltaBytes": -15456960,
"heapUsedBytes": 65651596,
"domNodes": -248,
"jsHeapTotalBytes": 1302528,
"scriptDurationMs": 551.9699999999999,
"eventListeners": -182,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-zoom",
"durationMs": 3089.1340000000014,
"styleRecalcs": 67,
"styleRecalcDurationMs": 10.255,
"layouts": 60,
"layoutDurationMs": 7.867000000000001,
"taskDurationMs": 1213.19,
"heapDeltaBytes": -9404912,
"heapUsedBytes": 72892352,
"domNodes": -246,
"jsHeapTotalBytes": -270336,
"scriptDurationMs": 505.073,
"eventListeners": -178,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-zoom",
"durationMs": 3072.747999999933,
"styleRecalcs": 63,
"styleRecalcDurationMs": 8.155,
"layouts": 60,
"layoutDurationMs": 8.229000000000001,
"taskDurationMs": 1146.4399999999998,
"heapDeltaBytes": 7574220,
"heapUsedBytes": 73770108,
"domNodes": 8,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 500.112,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "legacy-node-drag",
"durationMs": 2152.1470000000136,
"styleRecalcs": 47,
"styleRecalcDurationMs": 6.001999999999997,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1301.059,
"heapDeltaBytes": -4993960,
"heapUsedBytes": 79216764,
"domNodes": -245,
"jsHeapTotalBytes": -638976,
"scriptDurationMs": 604.796,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "legacy-node-drag",
"durationMs": 2165.80799999997,
"styleRecalcs": 48,
"styleRecalcDurationMs": 7.398999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1323.819,
"heapDeltaBytes": -4486364,
"heapUsedBytes": 79721380,
"domNodes": -245,
"jsHeapTotalBytes": -376832,
"scriptDurationMs": 622.773,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "minimap-idle",
"durationMs": 2033.0000000000155,
"styleRecalcs": 8,
"styleRecalcDurationMs": 4.959999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 481.4440000000001,
"heapDeltaBytes": -7221944,
"heapUsedBytes": 81215168,
"domNodes": -244,
"jsHeapTotalBytes": 28672,
"scriptDurationMs": 20.414,
"eventListeners": -182,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "minimap-idle",
"durationMs": 2034.104999999954,
"styleRecalcs": 7,
"styleRecalcDurationMs": 4.701999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 473.3930000000001,
"heapDeltaBytes": -2624972,
"heapUsedBytes": 79220992,
"domNodes": -254,
"jsHeapTotalBytes": -757760,
"scriptDurationMs": 20.567,
"eventListeners": -182,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 443.2130000000143,
"styleRecalcs": 48,
"styleRecalcDurationMs": 7.6560000000000015,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 285.65200000000004,
"heapDeltaBytes": 13374872,
"heapUsedBytes": 76853424,
"domNodes": 22,
"jsHeapTotalBytes": 5767168,
"scriptDurationMs": 95.04799999999999,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.663333333333338,
"p95FrameDurationMs": 16.700000000000273
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 462.4469999999974,
"styleRecalcs": 48,
"styleRecalcDurationMs": 7.405,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 291.598,
"heapDeltaBytes": 13278740,
"heapUsedBytes": 76581516,
"domNodes": 22,
"jsHeapTotalBytes": 5767168,
"scriptDurationMs": 98.75800000000001,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000273
},
{
"name": "subgraph-idle",
"durationMs": 1994.0659999999752,
"styleRecalcs": 10,
"styleRecalcDurationMs": 6.04,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 371.54,
"heapDeltaBytes": -4999540,
"heapUsedBytes": 58406884,
"domNodes": -273,
"jsHeapTotalBytes": 4972544,
"scriptDurationMs": 6.132999999999999,
"eventListeners": -230,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "subgraph-idle",
"durationMs": 2010.1280000000088,
"styleRecalcs": 10,
"styleRecalcDurationMs": 5.679000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 376.94200000000006,
"heapDeltaBytes": -5559140,
"heapUsedBytes": 57211676,
"domNodes": -274,
"jsHeapTotalBytes": 4710400,
"scriptDurationMs": 5.782000000000001,
"eventListeners": -230,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1687.5650000000064,
"styleRecalcs": 78,
"styleRecalcDurationMs": 17.352,
"layouts": 18,
"layoutDurationMs": 3.526,
"taskDurationMs": 561.061,
"heapDeltaBytes": 9685304,
"heapUsedBytes": 72965748,
"domNodes": -272,
"jsHeapTotalBytes": 6021120,
"scriptDurationMs": 68.5,
"eventListeners": -198,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1670.5939999999941,
"styleRecalcs": 79,
"styleRecalcDurationMs": 17.956,
"layouts": 18,
"layoutDurationMs": 3.655,
"taskDurationMs": 570.0970000000001,
"heapDeltaBytes": -2824508,
"heapUsedBytes": 60690388,
"domNodes": -273,
"jsHeapTotalBytes": 5496832,
"scriptDurationMs": 69.62100000000001,
"eventListeners": -230,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-transition-enter",
"durationMs": 816.0720000000197,
"styleRecalcs": 18,
"styleRecalcDurationMs": 20.19,
"layouts": 5,
"layoutDurationMs": 8.256000000000002,
"taskDurationMs": 538.3359999999999,
"heapDeltaBytes": 20048348,
"heapUsedBytes": 102442500,
"domNodes": 13587,
"jsHeapTotalBytes": 11010048,
"scriptDurationMs": 18.747,
"eventListeners": 2385,
"totalBlockingTimeMs": 106,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "viewport-pan-sweep",
"durationMs": 8186.530000000004,
"styleRecalcs": 250,
"styleRecalcDurationMs": 25.253,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 4145.495999999999,
"heapDeltaBytes": -12308764,
"heapUsedBytes": 68306640,
"domNodes": -242,
"jsHeapTotalBytes": 4747264,
"scriptDurationMs": 1928.7259999999999,
"eventListeners": -166,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 8138.864000000012,
"styleRecalcs": 250,
"styleRecalcDurationMs": 20.766,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 4035.64,
"heapDeltaBytes": 15570732,
"heapUsedBytes": 96295944,
"domNodes": -213,
"jsHeapTotalBytes": 2351104,
"scriptDurationMs": 1846.437,
"eventListeners": -166,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-idle",
"durationMs": 10563.744999999983,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 9843.065,
"heapDeltaBytes": -13724472,
"heapUsedBytes": 181381732,
"domNodes": -6543,
"jsHeapTotalBytes": 2871296,
"scriptDurationMs": 107.02799999999998,
"eventListeners": -7478,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.223333333333358,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "vue-large-graph-idle",
"durationMs": 8333.800999999994,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 7194.696,
"heapDeltaBytes": -26976128,
"heapUsedBytes": 172829036,
"domNodes": -6543,
"jsHeapTotalBytes": 6569984,
"scriptDurationMs": 89.61999999999999,
"eventListeners": -7482,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-pan",
"durationMs": 12740.523999999994,
"styleRecalcs": 68,
"styleRecalcDurationMs": 7.829000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 12154.981000000002,
"heapDeltaBytes": -37475796,
"heapUsedBytes": 163647220,
"domNodes": -6543,
"jsHeapTotalBytes": -843776,
"scriptDurationMs": 534.688,
"eventListeners": -7478,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333326,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-pan",
"durationMs": 12849.843999999961,
"styleRecalcs": 67,
"styleRecalcDurationMs": 8.189000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 12317.550000000001,
"heapDeltaBytes": -18428044,
"heapUsedBytes": 194998752,
"domNodes": -6573,
"jsHeapTotalBytes": 7491584,
"scriptDurationMs": 516.1850000000001,
"eventListeners": -7494,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-node-resize-workload",
"durationMs": 3727.8180000000134,
"styleRecalcs": 20,
"styleRecalcDurationMs": 54.82400000000001,
"layouts": 20,
"layoutDurationMs": 14.857999999999997,
"taskDurationMs": 3597.079,
"heapDeltaBytes": -21702852,
"heapUsedBytes": 178325724,
"domNodes": -6543,
"jsHeapTotalBytes": 17317888,
"scriptDurationMs": 49.428,
"eventListeners": -7478,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-node-resize-workload",
"durationMs": 3763.328999999999,
"styleRecalcs": 20,
"styleRecalcDurationMs": 55.646,
"layouts": 20,
"layoutDurationMs": 15.038999999999996,
"taskDurationMs": 3631.943,
"heapDeltaBytes": -22403832,
"heapUsedBytes": 172511008,
"domNodes": -6543,
"jsHeapTotalBytes": 18817024,
"scriptDurationMs": 49.288000000000004,
"eventListeners": -7480,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-zoom-out-idle",
"durationMs": 4230.416000000048,
"styleRecalcs": 1,
"styleRecalcDurationMs": 0.07199999999998874,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 3670.9479999999994,
"heapDeltaBytes": 32171596,
"heapUsedBytes": 199339836,
"domNodes": 0,
"jsHeapTotalBytes": -786432,
"scriptDurationMs": 44.219999999999985,
"eventListeners": -6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-zoom-out-idle",
"durationMs": 5253.6700000000565,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 4996.352,
"heapDeltaBytes": -18849080,
"heapUsedBytes": 168176616,
"domNodes": 0,
"jsHeapTotalBytes": -9437184,
"scriptDurationMs": 53.638999999999996,
"eventListeners": -8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.220000000000073,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "workflow-execution",
"durationMs": 427.61500000000296,
"styleRecalcs": 15,
"styleRecalcDurationMs": 13.856,
"layouts": 2,
"layoutDurationMs": 0.496,
"taskDurationMs": 78.827,
"heapDeltaBytes": 4957400,
"heapUsedBytes": 66867900,
"domNodes": 126,
"jsHeapTotalBytes": 262144,
"scriptDurationMs": 8.094,
"eventListeners": 81,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666682,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "workflow-execution",
"durationMs": 79.90400000005593,
"styleRecalcs": 6,
"styleRecalcDurationMs": 11.299999999999999,
"layouts": 5,
"layoutDurationMs": 1.4220000000000002,
"taskDurationMs": 60.657000000000004,
"heapDeltaBytes": 3127412,
"heapUsedBytes": 65059668,
"domNodes": 130,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 5.309999999999999,
"eventListeners": 33,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
}
]
}🔬 E2E Coverage
Top 10 files by uncovered lines
|
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## jaewon/fe-2214-phase-3a-top-up-command-mapping-on-the-shared-billing #17689 +/- ##
=====================================================================================================
Coverage 82.72% 82.72%
=====================================================================================================
Files 2789 2789
Lines 140529 140560 +31
Branches 37753 37766 +13
=====================================================================================================
+ Hits 116247 116278 +31
Misses 23195 23195
Partials 1087 1087
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 11 files with indirect coverage changes 🚀 New features to boost your workflow:
|
adee349
into
jaewon/fe-2214-phase-3a-top-up-command-mapping-on-the-shared-billing
…FE-2214) (#17689) ## Why FE-2214's done-when says all three current top-up hosts can integrate the top-up command. #17657 covers ComfyUI_frontend's route (`POST /api/billing/topup`, an operation to poll). Workshop (`apps/website`) and Platform ship on the other route, `POST /api/billing/topup/checkout`: a provider-hosted Checkout session with no `billing_op_id`, credits landing through a webhook. That route could not be decoded with generated schemas until the ingest-types regen #17396 merged; it now carries `CreateTopupCheckoutRequest` / `CreateTopupCheckoutResponse`, so this is the 3A-2 follow-up recorded on FE-2214. Stacked on #17657 (FE-2214 top-up command); merge after it. ## How `createTopupCommand` gains a second method on the same surface, `createHostedTopupCheckout({ amountCents, returnUrl, signal? })`: - input is validated by the generated `zCreateTopupCheckoutRequest`; `INVALID_AMOUNT` / `INVALID_RETURN_URL` are returned before anything is sent - the same capability gate as the in-app command (`ACCESS_DENIED` carrying the server's denial), then the pre-purchase balance is read - one idempotency key per attempt, in the body and on the request; a 404 maps to `NOT_AVAILABLE` so a host keeps its legacy path while `topup_checkout_enabled` is off - `checkout_url` must be https (`validateActionUrl`, the same rule every lifecycle continuation obeys), otherwise `MALFORMED_RESPONSE`; `session_id` passes through when present - nothing is adopted on the lifecycle and no operation id is invented (FE-2214 invariant): the result is `{ url, sessionId?, baselineMicros? }`. The host executes its `OpenUrlMode` on `url` (Workshop pre-opens a tab, Platform redirects) and on return arms the existing `createBalanceWatch` with `baselineMicros`, which is how the test proves completion `readTopupEligibility` (from the fallow split on #17657) now returns the two failures it can actually produce, which is what lets the hosted result union exclude `NO_PAYMENT_METHOD`. ## AS-IS / TO-BE AS-IS: `TopupCommand` exposes `createTopupCheckout` only; Workshop keeps its own `createTopUpCheckout` fetch with a hand-written `zTopUpCheckout` schema, and Platform its own. TO-BE: `TopupCommand` exposes `createHostedTopupCheckout` over the generated contract; a host adapter is a thin wrapper (validate → gate → POST → open → balance watch). No UI in this PR, so no screenshots; the consumer cutover for Workshop is a separate slice. ## Testing Eight new tests under `createHostedTopupCheckout` in `topup.test.ts`: success shape, request body and idempotency key, and no lifecycle operation; `can_top_up` false without a POST; amount and return-URL rejection without a request; 404 → `NOT_AVAILABLE`; missing or non-https URL → `MALFORMED_RESPONSE`; optional session id and baseline omitted when unknown; baseline handed to a balance watch that reconciles on return; no server or provider text on the failure path. Billing core suite 187 passing; oxlint, eslint, oxfmt, `vue-tsc` clean. ## Stack (2026-09-15) Merge top-down. After a parent is squash-merged, rebase each child with `git rebase --onto origin/main <parent tip>` and force-push; GitHub retargets the base. Solid edges are code dependencies, dashed edges are sequencing. ```mermaid flowchart TD P12["Phase 1 + 2 merged<br/>#17436 · #17442 · ingest-types regen #17396"] --> C["FE-2227 Phase 3 core<br/>#17655 · base main"] C --> P0["PR 0 coded error bodies + 3DS driver<br/>#17656"] P0 --> A["FE-2214 top-up command<br/>#17657"] A --> A2["FE-2214 3A-2 hosted top-up checkout<br/>this PR"] P0 --> B1["FE-2223 B1 subscription commands<br/>#17658"] B1 --> B2["FE-2223 B2 eight-state projection<br/>#17659"] A --> I["Integration, do not merge<br/>#17660"] B2 --> I I --> V1["FE-2215 @comfyorg/account-ui composables<br/>#17662"] V1 --> V2["FE-2215 CheckoutSteps<br/>#17663"] I --> SES["core: narrowed BillingSession type<br/>#17664"] SES --> AD1["FE-2216 slice 1 top-up behind a flag<br/>#17665"] A2 -.-> WS["Workshop adapter over createHostedTopupCheckout<br/>later slice"] AD1 -.-> AD2["FE-2216 slice 2 subscription<br/>needs previewSubscribe (FE-2331)"] AD1 --> E["FE-2217 Phase 6 evidence"] BW["billing-web #17370 → #17574"] --> H["FE-2218 Phase 7 separate origin"] AD1 --> H H --> H8["FE-2331 Phase 8 hosted surfaces"] ``` Design: [Billing SDK implementation plan (V2)](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8). Linear: FE-2214.
…FE-2214) (#17689) FE-2214's done-when says all three current top-up hosts can integrate the top-up command. #17657 covers ComfyUI_frontend's route (`POST /api/billing/topup`, an operation to poll). Workshop (`apps/website`) and Platform ship on the other route, `POST /api/billing/topup/checkout`: a provider-hosted Checkout session with no `billing_op_id`, credits landing through a webhook. That route could not be decoded with generated schemas until the ingest-types regen #17396 merged; it now carries `CreateTopupCheckoutRequest` / `CreateTopupCheckoutResponse`, so this is the 3A-2 follow-up recorded on FE-2214. Stacked on #17657 (FE-2214 top-up command); merge after it. `createTopupCommand` gains a second method on the same surface, `createHostedTopupCheckout({ amountCents, returnUrl, signal? })`: - input is validated by the generated `zCreateTopupCheckoutRequest`; `INVALID_AMOUNT` / `INVALID_RETURN_URL` are returned before anything is sent - the same capability gate as the in-app command (`ACCESS_DENIED` carrying the server's denial), then the pre-purchase balance is read - one idempotency key per attempt, in the body and on the request; a 404 maps to `NOT_AVAILABLE` so a host keeps its legacy path while `topup_checkout_enabled` is off - `checkout_url` must be https (`validateActionUrl`, the same rule every lifecycle continuation obeys), otherwise `MALFORMED_RESPONSE`; `session_id` passes through when present - nothing is adopted on the lifecycle and no operation id is invented (FE-2214 invariant): the result is `{ url, sessionId?, baselineMicros? }`. The host executes its `OpenUrlMode` on `url` (Workshop pre-opens a tab, Platform redirects) and on return arms the existing `createBalanceWatch` with `baselineMicros`, which is how the test proves completion `readTopupEligibility` (from the fallow split on #17657) now returns the two failures it can actually produce, which is what lets the hosted result union exclude `NO_PAYMENT_METHOD`. AS-IS: `TopupCommand` exposes `createTopupCheckout` only; Workshop keeps its own `createTopUpCheckout` fetch with a hand-written `zTopUpCheckout` schema, and Platform its own. TO-BE: `TopupCommand` exposes `createHostedTopupCheckout` over the generated contract; a host adapter is a thin wrapper (validate → gate → POST → open → balance watch). No UI in this PR, so no screenshots; the consumer cutover for Workshop is a separate slice. Eight new tests under `createHostedTopupCheckout` in `topup.test.ts`: success shape, request body and idempotency key, and no lifecycle operation; `can_top_up` false without a POST; amount and return-URL rejection without a request; 404 → `NOT_AVAILABLE`; missing or non-https URL → `MALFORMED_RESPONSE`; optional session id and baseline omitted when unknown; baseline handed to a balance watch that reconciles on return; no server or provider text on the failure path. Billing core suite 187 passing; oxlint, eslint, oxfmt, `vue-tsc` clean. Merge top-down. After a parent is squash-merged, rebase each child with `git rebase --onto origin/main <parent tip>` and force-push; GitHub retargets the base. Solid edges are code dependencies, dashed edges are sequencing. ```mermaid flowchart TD P12["Phase 1 + 2 merged<br/>#17436 · #17442 · ingest-types regen #17396"] --> C["FE-2227 Phase 3 core<br/>#17655 · base main"] C --> P0["PR 0 coded error bodies + 3DS driver<br/>#17656"] P0 --> A["FE-2214 top-up command<br/>#17657"] A --> A2["FE-2214 3A-2 hosted top-up checkout<br/>this PR"] P0 --> B1["FE-2223 B1 subscription commands<br/>#17658"] B1 --> B2["FE-2223 B2 eight-state projection<br/>#17659"] A --> I["Integration, do not merge<br/>#17660"] B2 --> I I --> V1["FE-2215 @comfyorg/account-ui composables<br/>#17662"] V1 --> V2["FE-2215 CheckoutSteps<br/>#17663"] I --> SES["core: narrowed BillingSession type<br/>#17664"] SES --> AD1["FE-2216 slice 1 top-up behind a flag<br/>#17665"] A2 -.-> WS["Workshop adapter over createHostedTopupCheckout<br/>later slice"] AD1 -.-> AD2["FE-2216 slice 2 subscription<br/>needs previewSubscribe (FE-2331)"] AD1 --> E["FE-2217 Phase 6 evidence"] BW["billing-web #17370 → #17574"] --> H["FE-2218 Phase 7 separate origin"] AD1 --> H H --> H8["FE-2331 Phase 8 hosted surfaces"] ``` Design: [Billing SDK implementation plan (V2)](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8). Linear: FE-2214.
…4) (#17657) ## Why Stacked on PR 0 (`jaewon/fe-2227-core-error-codes-and-challenge-driver`, #17656) → #17655 (FE-2227); merge after both. Phase 3A of the billing SDK: the top-up command mapped onto the shared operation lifecycle, covering both routes cloud exposes today. Only request/response mapping lives here — the status-read gate, single-flight, polling, routing, the pointer, failure meaning, and telemetry all come from the lifecycle in #17655/#17656 and are not duplicated. - Linear: https://linear.app/comfyorg/issue/FE-2214 ## How `packages/account/src/core/billing/topup.ts` — `createTopupCommand({ transport, lifecycle, capabilities, credits, idempotencyKey? })` returning two commands on one surface: **`createTopupCheckout({ amountCents, signal? })`** — the in-app route ComfyUI_frontend uses (`POST /billing/topup`, an operation to observe): 1. `capabilities.read()` → `can_top_up === false` ⇒ `{ status: 'error', code: 'ACCESS_DENIED', denial? }` without a POST. The server flag is the only gate; nothing is derived. 2. Amount validated with `zCreateTopupRequest`; the plain input object is what travels (the schema coerces to bigint, which the transport cannot serialize). 3. One fresh key per POST attempt, in the body (`idempotency_key`) and as `idempotencyKey` on the `BillingRequest`. Supplying that key is what makes the POST replayable at the transport's 401 gate (`replayable = method === 'GET' || idempotencyKey !== undefined`): the single 401 replay is safe *because* the same key travels in both places for the backend to deduplicate on. Backend dedup is load-bearing on this route, not incidental. A fresh key is minted per attempt, so two user-initiated top-ups never collide. 4. POST through `lifecycle.begin('topup', issue)`; the response is decoded with `zCreateTopupResponse` and its `billing_op_id` adopted regardless of `status`, so the first poll settles synchronous results and carries the coded decline. 5. Command-level `TopupResult` union: `ok` (terminal `succeeded` state embedded + `creditsReconciled`), `declined` (terminal `failed` state embedded: `declineReason`, `recoveryAction`, `retryable`), `unsettled` (`timed_out` / `reconciliation_needed` embedded), plus `error` codes — the core `BillingErrorCode`s untouched, and `NOT_AVAILABLE` (404 on the POST), `NO_PAYMENT_METHOD` (`serverCode`, with `recoveryAction: 'replace_payment_method'`), `INVALID_AMOUNT` (below the generated minimum; nothing sent). A `superseded` operation passes through as `SUPERSEDED`. 6. On `succeeded`: `capabilities.invalidate()` and a credits re-read; `creditsReconciled` compares it with the read taken before the POST. **`createHostedTopupCheckout({ amountCents, returnUrl, signal? })`** — the hosted route Workshop (`apps/website`) and Platform ship on (`POST /billing/topup/checkout`, a provider-hosted Checkout session with no operation; credits land through a webhook). Decodable since the ingest-types regen #17396 merged: 1. Input validated by the generated `zCreateTopupCheckoutRequest`; `INVALID_AMOUNT` / `INVALID_RETURN_URL` before anything is sent. 2. The same capability gate, then the pre-purchase balance is read. 3. One idempotency key per attempt, in the body and on the request; 404 → `NOT_AVAILABLE` so a host keeps its legacy path while `topup_checkout_enabled` is off. 4. `checkout_url` must be https (`validateActionUrl`, the rule every lifecycle continuation obeys), otherwise `MALFORMED_RESPONSE`; `session_id` passes through when present. 5. Nothing is adopted on the lifecycle and no operation id is invented: the result is `{ url, sessionId?, baselineMicros? }`. The host executes its `OpenUrlMode` on `url` (Workshop pre-opens a tab, Platform redirects) and on return arms `createBalanceWatch` with `baselineMicros`. `packages/account/src/core/billing/balanceWatch.ts` — `createBalanceWatch({ credits, baselineMicros? })`, the framework-free port of `src/composables/billing/topupBalanceRefresh.ts` (gaps `[0, 2, 5, 10, 20]s`, 15-minute lifetime, 5 scheduled runs, a single read per wake past the cap). No document listeners: the host calls `wake()` from its own focus/visibility signals. This is the completion path for the hosted command and the explicit fallback when no `billing_op_id` can be observed on the in-app one; the SDK never invents one. Raw server / Stripe text never reaches a result (asserted in the tests). Contract findings (generated contract wins; for FE-2211's TDD-correction list): - The ticket's `returnUrl` and "no `billing_op_id`" rows describe the hosted route, not `zCreateTopupRequest` (which has only `amount_cents`, `checkout_attempt_id`, `idempotency_key`). They are served by `createHostedTopupCheckout`. - `zCreateTopupResponse.billing_op_id` is required, so the in-app command's balance-watch fallback is tested against a `MALFORMED_RESPONSE` on the POST, not an invented id. - The plan's `credits.read({ forceRefresh })` does not exist: `CreditsReader.read` always requests, so it is called plainly. - `amount_cents` is `z.coerce.bigint()` on both request schemas; validated with `safeParse`, sent as the number. - `ErrorResponse.code` is `z.string()`, not an enum, so `NO_PAYMENT_METHOD` is an SDK-owned allowlist entry. Tests (`topup.test.ts`, `balanceWatch.test.ts`), one per ticket row for the in-app command: `can_top_up` false, saved payment method, needs 3DS (driven through PR 0's `driveEmbeddedChallenge`), no payment method, declined, unexpected error, payment received with credits pending, 404 → `NOT_AVAILABLE` (and a 404 while polling left to the lifecycle), fresh idempotency key per attempt, in the body and on the request, generated-schema rejection, invalidation on success, scope supersession passthrough, no-`billing_op_id` balance-watch fallback. For the hosted command: success shape with request body, idempotency key, and no lifecycle operation; `can_top_up` false without a POST; amount and return-URL rejection without a request; 404 → `NOT_AVAILABLE`; missing or non-https URL → `MALFORMED_RESPONSE`; optional session id and baseline omitted when unknown; baseline handed to a balance watch that reconciles on return; no server text on the failure path. Reload/resume, routing, timeout, and duplicate-poll coverage stays in the core suite. ## AS-IS / TO-BE No UI surface, no screenshots. - AS-IS: the SDK exposes the lifecycle but no command issues a top-up on it; the cloud app's `workspaceApi.createTopup` + `topupBalanceRefresh`, Workshop's `createTopUpCheckout` fetch with a hand-written schema, and Platform's own call remain the only paths. - TO-BE: `@comfyorg/account/billing` exports `createTopupCommand` (in-app and hosted top-up over the generated contract) and `createBalanceWatch`; each host adapter is a thin wrapper that reads a coded, text-free result. Consumer cutovers are separate slices (ComfyUI_frontend: #17665; Workshop and Platform: later). ## Stack (2026-09-15) Merge top-down. After a parent is squash-merged, rebase each child with `git rebase --onto origin/main <parent tip>` and force-push; GitHub retargets the base. Solid edges are code dependencies, dashed edges are sequencing. The hosted command (formerly #17689) is squashed into this PR. ```mermaid flowchart TD P12["Phase 1 + 2 merged<br/>#17436 · #17442 · ingest-types regen #17396"] --> C["FE-2227 Phase 3 core<br/>#17655 · base main"] C --> P0["PR 0 coded error bodies + 3DS driver<br/>#17656"] P0 --> A["FE-2214 top-up commands, in-app + hosted<br/>#17657"] P0 --> B1["FE-2223 B1 subscription commands<br/>#17658"] B1 --> B2["FE-2223 B2 eight-state projection<br/>#17659"] A --> I["Integration, do not merge<br/>#17660"] B2 --> I I --> V1["FE-2215 @comfyorg/account-ui composables<br/>#17662"] V1 --> V2["FE-2215 CheckoutSteps<br/>#17663"] I --> SES["core: narrowed BillingSession type<br/>#17664"] SES --> AD1["FE-2216 slice 1 top-up behind a flag<br/>#17665"] A -.-> WS["Workshop adapter over createHostedTopupCheckout<br/>consumer slice"] AD1 -.-> AD2["FE-2216 slice 2 subscription<br/>needs previewSubscribe (FE-2331)"] AD1 --> E["FE-2217 Phase 6 evidence"] BW["billing-web #17370 → #17574"] --> H["FE-2218 Phase 7 separate origin"] AD1 --> H V2 -.-> H H --> H8["FE-2331 Phase 8 hosted surfaces"] ```
Why
FE-2214's done-when says all three current top-up hosts can integrate the top-up command. #17657 covers ComfyUI_frontend's route (
POST /api/billing/topup, an operation to poll). Workshop (apps/website) and Platform ship on the other route,POST /api/billing/topup/checkout: a provider-hosted Checkout session with nobilling_op_id, credits landing through a webhook. That route could not be decoded with generated schemas until the ingest-types regen #17396 merged; it now carriesCreateTopupCheckoutRequest/CreateTopupCheckoutResponse, so this is the 3A-2 follow-up recorded on FE-2214.Stacked on #17657 (FE-2214 top-up command); merge after it.
How
createTopupCommandgains a second method on the same surface,createHostedTopupCheckout({ amountCents, returnUrl, signal? }):zCreateTopupCheckoutRequest;INVALID_AMOUNT/INVALID_RETURN_URLare returned before anything is sentACCESS_DENIEDcarrying the server's denial), then the pre-purchase balance is readNOT_AVAILABLEso a host keeps its legacy path whiletopup_checkout_enabledis offcheckout_urlmust be https (validateActionUrl, the same rule every lifecycle continuation obeys), otherwiseMALFORMED_RESPONSE;session_idpasses through when present{ url, sessionId?, baselineMicros? }. The host executes itsOpenUrlModeonurl(Workshop pre-opens a tab, Platform redirects) and on return arms the existingcreateBalanceWatchwithbaselineMicros, which is how the test proves completionreadTopupEligibility(from the fallow split on #17657) now returns the two failures it can actually produce, which is what lets the hosted result union excludeNO_PAYMENT_METHOD.AS-IS / TO-BE
AS-IS:
TopupCommandexposescreateTopupCheckoutonly; Workshop keeps its owncreateTopUpCheckoutfetch with a hand-writtenzTopUpCheckoutschema, and Platform its own.TO-BE:
TopupCommandexposescreateHostedTopupCheckoutover the generated contract; a host adapter is a thin wrapper (validate → gate → POST → open → balance watch). No UI in this PR, so no screenshots; the consumer cutover for Workshop is a separate slice.Testing
Eight new tests under
createHostedTopupCheckoutintopup.test.ts: success shape, request body and idempotency key, and no lifecycle operation;can_top_upfalse without a POST; amount and return-URL rejection without a request; 404 →NOT_AVAILABLE; missing or non-https URL →MALFORMED_RESPONSE; optional session id and baseline omitted when unknown; baseline handed to a balance watch that reconciles on return; no server or provider text on the failure path. Billing core suite 187 passing; oxlint, eslint, oxfmt,vue-tscclean.Stack (2026-09-15)
Merge top-down. After a parent is squash-merged, rebase each child with
git rebase --onto origin/main <parent tip>and force-push; GitHub retargets the base. Solid edges are code dependencies, dashed edges are sequencing.Design: Billing SDK implementation plan (V2). Linear: FE-2214.