Repository navigation
feat(billing): show the top-up's real outcome in the dialog — receipt or decline reason - #16413
comfydesigner wants to merge 12 commits into
Conversation
Replace the success toast plus redirect into settings with the designed success screen, showing previous balance, credits added, and new balance. Replace the decline toast with the declined screen, which carries the Stripe reason when the operation reports one and offers a way back to the charge or on to the billing portal.
|
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: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
🎨 Storybook: ✅ Built — View Storybook🎭 Playwright: ❌ 1895 passed, 1 failed❌ Failed Tests📊 Browser Reports
📦 Bundle Size
⚡ Performance Report
Absolute values
Raw data{
"timestamp": "2026-09-03T02:11:38.188Z",
"gitSha": "6395df48ae2789085efa0af9294e4e061d5cc72c",
"branch": "comfydesigner/topup-outcome-states",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 2113.8540000000035,
"styleRecalcs": 9,
"styleRecalcDurationMs": 10.305000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 614.085,
"heapDeltaBytes": -12031228,
"heapUsedBytes": 57704896,
"domNodes": -282,
"jsHeapTotalBytes": 4448256,
"scriptDurationMs": 12.545999999999998,
"eventListeners": -157,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-idle",
"durationMs": 2038.972000000058,
"styleRecalcs": 8,
"styleRecalcDurationMs": 7.252999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 507.61,
"heapDeltaBytes": -11383060,
"heapUsedBytes": 59138220,
"domNodes": -281,
"jsHeapTotalBytes": 4972544,
"scriptDurationMs": 9.089,
"eventListeners": -155,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1905.3559999999834,
"styleRecalcs": 79,
"styleRecalcDurationMs": 40.748999999999995,
"layouts": 14,
"layoutDurationMs": 4.834,
"taskDurationMs": 893.5719999999999,
"heapDeltaBytes": 3228740,
"heapUsedBytes": 73138108,
"domNodes": -280,
"jsHeapTotalBytes": 6021120,
"scriptDurationMs": 149.995,
"eventListeners": -187,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1897.2949999999855,
"styleRecalcs": 78,
"styleRecalcDurationMs": 41.315000000000005,
"layouts": 14,
"layoutDurationMs": 4.600999999999999,
"taskDurationMs": 908.8159999999999,
"heapDeltaBytes": 5958284,
"heapUsedBytes": 76521224,
"domNodes": -281,
"jsHeapTotalBytes": 6021120,
"scriptDurationMs": 150.54600000000002,
"eventListeners": -185,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1738.228999999933,
"styleRecalcs": 31,
"styleRecalcDurationMs": 17.356999999999996,
"layouts": 6,
"layoutDurationMs": 1.1650000000000003,
"taskDurationMs": 363.41100000000006,
"heapDeltaBytes": 4654992,
"heapUsedBytes": 75221200,
"domNodes": 77,
"jsHeapTotalBytes": 5767168,
"scriptDurationMs": 11.354,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1684.7380000000385,
"styleRecalcs": 29,
"styleRecalcDurationMs": 16.602999999999998,
"layouts": 6,
"layoutDurationMs": 1.1019999999999999,
"taskDurationMs": 368.34400000000005,
"heapDeltaBytes": 4436140,
"heapUsedBytes": 74900296,
"domNodes": 76,
"jsHeapTotalBytes": 5505024,
"scriptDurationMs": 11.592000000000002,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "dom-widget-clipping",
"durationMs": 684.5590000000357,
"styleRecalcs": 9,
"styleRecalcDurationMs": 5.6099999999999985,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 436.288,
"heapDeltaBytes": 17841376,
"heapUsedBytes": 88037152,
"domNodes": 14,
"jsHeapTotalBytes": 5505024,
"scriptDurationMs": 151.13199999999998,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "dom-widget-clipping",
"durationMs": 668.2140000000345,
"styleRecalcs": 9,
"styleRecalcDurationMs": 6.460999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 453.285,
"heapDeltaBytes": -7755312,
"heapUsedBytes": 62868320,
"domNodes": 14,
"jsHeapTotalBytes": 6291456,
"scriptDurationMs": 159.581,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-idle",
"durationMs": 2049.270999999976,
"styleRecalcs": 4,
"styleRecalcDurationMs": 3.241000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 613.729,
"heapDeltaBytes": -13789184,
"heapUsedBytes": 86878432,
"domNodes": -273,
"jsHeapTotalBytes": -1622016,
"scriptDurationMs": 35.379000000000005,
"eventListeners": -155,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-idle",
"durationMs": 2035.3320000000394,
"styleRecalcs": 5,
"styleRecalcDurationMs": 4.369999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 613.9409999999998,
"heapDeltaBytes": -13865272,
"heapUsedBytes": 86788648,
"domNodes": -269,
"jsHeapTotalBytes": -835584,
"scriptDurationMs": 39.24100000000001,
"eventListeners": -153,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-pan",
"durationMs": 2193.2800000000725,
"styleRecalcs": 67,
"styleRecalcDurationMs": 17.686,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1607.061,
"heapDeltaBytes": 2829944,
"heapUsedBytes": 79373348,
"domNodes": -274,
"jsHeapTotalBytes": -122880,
"scriptDurationMs": 746.887,
"eventListeners": -185,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-pan",
"durationMs": 2197.981000000027,
"styleRecalcs": 64,
"styleRecalcDurationMs": 10.470999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1575.385,
"heapDeltaBytes": 17430512,
"heapUsedBytes": 83618092,
"domNodes": 4,
"jsHeapTotalBytes": 487424,
"scriptDurationMs": 763.352,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-zoom",
"durationMs": 3635.3729999999587,
"styleRecalcs": 60,
"styleRecalcDurationMs": 10.924999999999997,
"layouts": 60,
"layoutDurationMs": 13.459,
"taskDurationMs": 1754.298,
"heapDeltaBytes": 9283360,
"heapUsedBytes": 76915872,
"domNodes": 0,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 805.79,
"eventListeners": 10,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-zoom",
"durationMs": 3510.3020000000242,
"styleRecalcs": 61,
"styleRecalcDurationMs": 11.757999999999997,
"layouts": 60,
"layoutDurationMs": 13.238999999999999,
"taskDurationMs": 1712.201,
"heapDeltaBytes": 8150908,
"heapUsedBytes": 75836388,
"domNodes": 2,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 754.984,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.80000000000109
},
{
"name": "legacy-node-drag",
"durationMs": 3078.6900000000514,
"styleRecalcs": 41,
"styleRecalcDurationMs": 6.305999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1874.4110000000003,
"heapDeltaBytes": 20830940,
"heapUsedBytes": 87517184,
"domNodes": 2,
"jsHeapTotalBytes": 417792,
"scriptDurationMs": 907.6189999999999,
"eventListeners": 188,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "legacy-node-drag",
"durationMs": 3033.8239999999814,
"styleRecalcs": 40,
"styleRecalcDurationMs": 5.126999999999996,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1929.8099999999997,
"heapDeltaBytes": 21917180,
"heapUsedBytes": 89568104,
"domNodes": 0,
"jsHeapTotalBytes": 417792,
"scriptDurationMs": 954.939,
"eventListeners": 188,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "minimap-idle",
"durationMs": 2031.2779999999293,
"styleRecalcs": 1,
"styleRecalcDurationMs": 0.7659999999999993,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 555.044,
"heapDeltaBytes": 22099676,
"heapUsedBytes": 87862016,
"domNodes": -275,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 39.419999999999995,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "minimap-idle",
"durationMs": 1998.6770000000433,
"styleRecalcs": 1,
"styleRecalcDurationMs": 0.564000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 611.6619999999999,
"heapDeltaBytes": 21777848,
"heapUsedBytes": 87592656,
"domNodes": -275,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 34.734999999999985,
"eventListeners": -185,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 603.8790000000063,
"styleRecalcs": 45,
"styleRecalcDurationMs": 10.328000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 428.64199999999994,
"heapDeltaBytes": 14808380,
"heapUsedBytes": 87403240,
"domNodes": 16,
"jsHeapTotalBytes": 4718592,
"scriptDurationMs": 145.961,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 596.847999999909,
"styleRecalcs": 46,
"styleRecalcDurationMs": 10.233999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 399.266,
"heapDeltaBytes": 14779540,
"heapUsedBytes": 87468296,
"domNodes": 18,
"jsHeapTotalBytes": 4718592,
"scriptDurationMs": 139.723,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-idle",
"durationMs": 2023.461999999995,
"styleRecalcs": 9,
"styleRecalcDurationMs": 7.688000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 498.62899999999996,
"heapDeltaBytes": 2917992,
"heapUsedBytes": 75614360,
"domNodes": -296,
"jsHeapTotalBytes": 5758976,
"scriptDurationMs": 8.491000000000001,
"eventListeners": -231,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-idle",
"durationMs": 2006.35699999998,
"styleRecalcs": 9,
"styleRecalcDurationMs": 8.088000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 490.28400000000005,
"heapDeltaBytes": 8471052,
"heapUsedBytes": 79991836,
"domNodes": -297,
"jsHeapTotalBytes": 5234688,
"scriptDurationMs": 7.455,
"eventListeners": -231,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1735.5759999999236,
"styleRecalcs": 78,
"styleRecalcDurationMs": 38.36000000000001,
"layouts": 18,
"layoutDurationMs": 5.496,
"taskDurationMs": 839.86,
"heapDeltaBytes": -10668048,
"heapUsedBytes": 61578352,
"domNodes": -294,
"jsHeapTotalBytes": 4710400,
"scriptDurationMs": 108.707,
"eventListeners": -201,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1791.9120000000248,
"styleRecalcs": 79,
"styleRecalcDurationMs": 41.101,
"layouts": 18,
"layoutDurationMs": 6.07,
"taskDurationMs": 871.6510000000001,
"heapDeltaBytes": -13735728,
"heapUsedBytes": 58673956,
"domNodes": -295,
"jsHeapTotalBytes": 5496832,
"scriptDurationMs": 110.353,
"eventListeners": -201,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-transition-enter",
"durationMs": 1400.574000000006,
"styleRecalcs": 19,
"styleRecalcDurationMs": 30.517000000000003,
"layouts": 15,
"layoutDurationMs": 14.693999999999999,
"taskDurationMs": 954.83,
"heapDeltaBytes": 21067484,
"heapUsedBytes": 108541476,
"domNodes": 13751,
"jsHeapTotalBytes": 10747904,
"scriptDurationMs": 30.63,
"eventListeners": 2381,
"totalBlockingTimeMs": 123,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 8398.071999999956,
"styleRecalcs": 245,
"styleRecalcDurationMs": 38.185,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 5685.676,
"heapDeltaBytes": -16254396,
"heapUsedBytes": 84457148,
"domNodes": -270,
"jsHeapTotalBytes": -1134592,
"scriptDurationMs": 2535.5130000000004,
"eventListeners": -139,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.80000000000109
},
{
"name": "viewport-pan-sweep",
"durationMs": 8401.346999999987,
"styleRecalcs": 247,
"styleRecalcDurationMs": 39.013000000000005,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 5785.144,
"heapDeltaBytes": -15939596,
"heapUsedBytes": 84807604,
"domNodes": -269,
"jsHeapTotalBytes": -1396736,
"scriptDurationMs": 2598.161,
"eventListeners": -139,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-idle",
"durationMs": 18026.368999999933,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 17343.918999999998,
"heapDeltaBytes": -34334120,
"heapUsedBytes": 175495428,
"domNodes": -6552,
"jsHeapTotalBytes": -5111808,
"scriptDurationMs": 294.285,
"eventListeners": -7473,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-idle",
"durationMs": 17979.169999999955,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 17558.521,
"heapDeltaBytes": -33396912,
"heapUsedBytes": 176065992,
"domNodes": -6548,
"jsHeapTotalBytes": -3276800,
"scriptDurationMs": 297.242,
"eventListeners": -7471,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.776666666666763,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-pan",
"durationMs": 22169.15999999992,
"styleRecalcs": 160,
"styleRecalcDurationMs": 22.116000000000025,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 21960.395,
"heapDeltaBytes": -36478772,
"heapUsedBytes": 166441584,
"domNodes": -6552,
"jsHeapTotalBytes": 2379776,
"scriptDurationMs": 918.325,
"eventListeners": -7469,
"totalBlockingTimeMs": 48,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-pan",
"durationMs": 21971.681999999986,
"styleRecalcs": 164,
"styleRecalcDurationMs": 20.988000000000007,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 21689.076999999997,
"heapDeltaBytes": -37964116,
"heapUsedBytes": 166620872,
"domNodes": -6548,
"jsHeapTotalBytes": -167936,
"scriptDurationMs": 883.7679999999999,
"eventListeners": -7469,
"totalBlockingTimeMs": 123,
"frameDurationMs": 18.890000000000025,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "vue-node-resize-workload",
"durationMs": 6369.655999999964,
"styleRecalcs": 20,
"styleRecalcDurationMs": 73.48199999999999,
"layouts": 20,
"layoutDurationMs": 24.065000000000005,
"taskDurationMs": 6298.3640000000005,
"heapDeltaBytes": -20667548,
"heapUsedBytes": 184373868,
"domNodes": -6548,
"jsHeapTotalBytes": 17768448,
"scriptDurationMs": 115.734,
"eventListeners": -7473,
"totalBlockingTimeMs": 445,
"frameDurationMs": 17.776666666666703,
"p95FrameDurationMs": 16.80000000000109
},
{
"name": "vue-node-resize-workload",
"durationMs": 6481.331000000068,
"styleRecalcs": 20,
"styleRecalcDurationMs": 75.936,
"layouts": 20,
"layoutDurationMs": 25.656,
"taskDurationMs": 6373.357,
"heapDeltaBytes": -35004560,
"heapUsedBytes": 174849136,
"domNodes": -6548,
"jsHeapTotalBytes": 4849664,
"scriptDurationMs": 166.425,
"eventListeners": -7469,
"totalBlockingTimeMs": 381,
"frameDurationMs": 17.776666666666703,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "workflow-execution",
"durationMs": 105.99700000000212,
"styleRecalcs": 8,
"styleRecalcDurationMs": 15.862999999999998,
"layouts": 2,
"layoutDurationMs": 0.659,
"taskDurationMs": 75.00699999999999,
"heapDeltaBytes": 3150508,
"heapUsedBytes": 71836584,
"domNodes": 110,
"jsHeapTotalBytes": 262144,
"scriptDurationMs": 5.768999999999998,
"eventListeners": 49,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "workflow-execution",
"durationMs": 479.7219999998106,
"styleRecalcs": 12,
"styleRecalcDurationMs": 18.105000000000004,
"layouts": 3,
"layoutDurationMs": 0.93,
"taskDurationMs": 104.04999999999998,
"heapDeltaBytes": 5051020,
"heapUsedBytes": 73543136,
"domNodes": 121,
"jsHeapTotalBytes": 0,
"scriptDurationMs": 8.06,
"eventListeners": 99,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
}
]
}🔬 E2E Coverage
Top 10 files by uncovered lines
|
Back moves into the header on the declined screen, leaving one call to action. The success screen links Billing & invoices and marks the new balance with the credits coin. Adds stories for all four steps, driven through the flow the way a customer reaches them.
Both outcome screens use Button/Default in the design, which maps to the secondary fill, not primary. Adds coverage for the challenged paths: a cleared challenge reaches success, a refused one names the reason, and a canceled one is not treated as a decline.
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## comfydesigner/topup-cancel-states #16413 +/- ##
=====================================================================
+ Coverage 82.29% 82.30% +0.01%
=====================================================================
Files 2019 2020 +1
Lines 116797 116868 +71
Branches 32488 31368 -1120
=====================================================================
+ Hits 96118 96190 +72
+ Misses 20500 20499 -1
Partials 179 179
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 7 files with indirect coverage changes 🚀 New features to boost your workflow:
|
…opup-outcome-states
…opup-outcome-states
…opup-outcome-states
There was a problem hiding this comment.
🔍 Cursor Review — Consolidated panel
Triggered by @comfydesigner.
Found 10 finding(s).
| Severity | Count |
|---|---|
| 🟠 High | 1 |
| 🟡 Medium | 5 |
| 🟢 Low | 4 |
Panel: 8/8 reviewers contributed findings.
| .then((operation) => { | ||
| paymentSubmitted.value = false | ||
| if (operation.status === 'succeeded') { | ||
| showSuccess() |
There was a problem hiding this comment.
🟠 High — This showSuccess() is unreachable on the pending/bank-challenge path: billingOperationStore.handleSuccess closes the top-up-credits dialog and opens the settings dialog before resolveTerminal(opId) settles the promise this .then awaits, so the component is already unmounted when the callback runs. Every 3DS/SCA-challenged charge therefore keeps the old close-and-open-settings behaviour instead of the new receipt, and the new test can't catch it because settleChallenge stubs startOperation wholesale. Raised by 6 of 8 reviewers (claude-opus-5-thinking-max adversarial, gpt-5.6-sol-max adversarial, kimi-k3-max adversarial, claude-opus-5-thinking-max edge-case, gpt-5.6-sol-max edge-case, kimi-k3-max edge-case).
There was a problem hiding this comment.
Real, and it defeated the PR's purpose on the 3DS path. Fixed in 8e56573: the store now checks whether the top-up dialog is open when the operation resolves — open means the dialog renders the outcome (no settings navigation, no toast), closed keeps the legacy delivery. Tests cover both.
| paymentSubmitted.value = false | ||
| if (operation.status === 'succeeded') { | ||
| showSuccess() | ||
| } else if (operation.status === 'failed') { |
There was a problem hiding this comment.
🟡 Medium — A terminal failed operation is not necessarily a card decline — the operation store also uses that status for superseded operations and for network/upstream/system failures, which it categorizes separately from provider declines. This branch nevertheless tells every such customer their card was refused and offers "Update payment method"; gate the declined screen on an actual provider-decline category and route other failures to a generic error. Raised by 2 of 8 reviewers (gpt-5.6-sol-max adversarial, gpt-5.6-sol-max edge-case).
There was a problem hiding this comment.
The superseded case can't reach this screen (supersession requires a replacement operation to have taken over as the watched one). System failures do land here with the mapped generic copy; the class split into a separate processing-error treatment exists on the subscription side (#16571) and follows here once the stacks converge. Unknown-code-means-the-charge is the deliberate default.
|
|
||
| function openBillingAndInvoices() { | ||
| handleClose() | ||
| settingsDialog.show('workspace') |
There was a problem hiding this comment.
🟡 Medium — Hardcoding 'workspace' drops the isCloud ? 'workspace' : 'credits' branch that the now-removed isCloud import and the deleted "opens Credits settings after a completed local top-up" test covered, so on non-cloud distributions the success screen's "Billing and invoices" link opens a settings panel that doesn't exist there. billingOperationStore.handleSuccess still uses the conditional target, so the two success paths now disagree. Raised by 2 of 8 reviewers (kimi-k3-max adversarial, kimi-k3-max edge-case).
There was a problem hiding this comment.
Fixed in d40cfd3 — the isCloud branch is restored; the hardcode was accidental.
|
|
||
| function currentBalanceCredits(): number { | ||
| return centsToCredits( | ||
| balance.value?.effectiveBalanceMicros ?? balance.value?.amountMicros ?? 0 |
There was a problem hiding this comment.
🟡 Medium — balance is null until fetchBalance() has resolved, and this dialog can be opened straight from the insufficient-credits prompt without that guarantee, so ?? 0 makes the receipt report "Previous balance 0" and a "New balance" equal to just the purchase for a customer who actually holds credits. The storybook mock's own balanceCents: null default documents that this state is reachable — suppress the breakdown when no balance is loaded rather than defaulting to 0. Raised by 4 of 8 reviewers (claude-opus-5-thinking-max adversarial, claude-opus-5-thinking-max edge-case, gpt-5.6-sol-max edge-case, kimi-k3-max edge-case).
There was a problem hiding this comment.
Fixed in 8e56573 — if the balance was never read before Pay, the snapshot is null and the receipt withholds the breakdown instead of claiming 'Previous balance 0'.
| const declineReason = ref<string | null>(null) | ||
|
|
||
| const newBalanceCredits = computed( | ||
| () => balanceBeforeCharge.value + creditsAdded.value |
There was a problem hiding this comment.
🟡 Medium — "New balance" is client-side arithmetic over a pre-charge snapshot plus the requested amount, never reconciled with response.amount_cents or with the authoritative balance that fetchBalance() retrieves on the very next line. On the pending path the snapshot can be hours stale, so credits spent in another tab, promo grants, or any server-side amount difference get presented as a settled figure; render the refreshed balance once the fetch resolves and keep only "Previous balance" as a snapshot. Raised by 5 of 8 reviewers (claude-opus-5-thinking-max adversarial, gpt-5.6-sol-max adversarial, kimi-k3-max adversarial, claude-opus-5-thinking-max edge-case, gpt-5.6-sol-max edge-case).
There was a problem hiding this comment.
Fixed in d40cfd3 — the success screen renders after the balance refresh; New balance is the server's figure, Added the observed delta.
| }) | ||
| showDeclined(null) | ||
| } | ||
| } catch (error) { |
There was a problem hiding this comment.
🟡 Medium — paymentSubmitted is only cleared in the pending .then, so on the synchronous decline (showDeclined(null)) and in this catch it stays true; the newly enabled Back button then returns the user to confirm, where paymentLocked leaves Pay disabled and handleBuy early-returns, with no way to retry short of reopening the dialog. Clear it when entering the declined step — the new "offers a way back to the charge after a decline" test can't catch this because getByRole matches a disabled button. Raised by 1 of 8 reviewers (gemini-3.1-pro adversarial).
There was a problem hiding this comment.
Stale on the current revision: the synchronous decline and the catch both reset paymentSubmitted before showing the outcome (lines in handleBuy and reportPurchaseError).
| class="mx-8 mt-6 flex flex-col gap-1 rounded-xl bg-secondary-background p-4" | ||
| > | ||
| <span class="text-sm text-muted-foreground"> | ||
| {{ $t('credits.topUp.declinedReasonLabel') }} |
There was a problem hiding this comment.
🟢 Low — operation.errorMessage is not Stripe's reasoning: handleFailure stores billingFailureDetail(...) ?? failureMessage(...), a mapped localized generic that for topups falls back to credits.topUp.unknownError, and it is never null — so this panel always renders on a challenged decline and attributes app-authored copy to the payment provider, while the synchronous decline passes null and shows no reason at all. Relabel it or render only when a genuine provider message is present. Raised by 4 of 8 reviewers (claude-opus-5-thinking-max adversarial, kimi-k3-max adversarial, claude-opus-5-thinking-max edge-case, kimi-k3-max edge-case).
There was a problem hiding this comment.
Fixed in 8e56573 — the label reads 'What your bank said', matching what the box actually carries (our mapped rendering of the decline code) and the subscription-side declined screen.
| summary: t('credits.topUp.purchaseError'), | ||
| detail: t('credits.topUp.unknownError') | ||
| }) | ||
| showDeclined(null) |
There was a problem hiding this comment.
🟢 Low — The synchronous path traded its error toast for the declined screen, but the asynchronous one did not: handleFailure still adds a "Top-up failed" error toast for every non-cancel operation, so a challenged decline is now reported twice (toast plus declined screen) while a synchronous decline is reported once. Suppress the store's topup failure toast now that the dialog owns the declined state. Raised by 4 of 8 reviewers (claude-opus-5-thinking-max adversarial, kimi-k3-max adversarial, claude-opus-5-thinking-max edge-case, kimi-k3-max edge-case).
There was a problem hiding this comment.
Fixed in 8e56573 together with the success-path High above: an open top-up dialog now suppresses the store's failure toast too — one delivery per outcome, dialog first.
| variant="secondary" | ||
| size="lg" | ||
| class="h-10 w-full justify-center" | ||
| @click="() => handleClose()" |
There was a problem hiding this comment.
🟢 Low — The removed success path called handleClose(false) specifically to preserve the pending_topup_timestamp marker; both new exits from the success screen (this Close button and openBillingAndInvoices) use the default clearTracking = true and delete it. Consumers that key a post-purchase balance refresh off that marker (e.g. CreditsTile) lose their trigger for a balance that hasn't propagated yet. Raised by 1 of 8 reviewers (claude-opus-5-thinking-max adversarial).
There was a problem hiding this comment.
Deliberate, now stated in the PR description: after a settled success there is nothing pending left to track.
| })) | ||
|
|
||
| vi.mock('@/base/credits/comfyCredits', () => ({ | ||
| centsToCredits: (cents: number) => cents, |
There was a problem hiding this comment.
🟢 Low — Stubbing centsToCredits as identity leaves the only unit conversion in the new balance math unverified — two reviewers read effectiveBalanceMicros/amountMicros literally and called this a 10,000× error, which suggests the field names are worth double-checking even if they do carry cents. Assert the breakdown through the real helper so a wrong-rate or missing conversion fails the test. Raised by 3 of 8 reviewers (gemini-3.1-pro edge-case, gemini-3.1-pro adversarial, claude-opus-5-thinking-max edge-case).
There was a problem hiding this comment.
Fair on principle, but the conversion has its own unit home (comfyCredits); these component tests assert routing and sourcing of the figures, not arithmetic. The identity stub keeps them from becoming change detectors on the rate.
dante01yoon
left a comment
There was a problem hiding this comment.
Replacing the toast-and-redirect with real outcome screens is a clear improvement — the old success path genuinely told the customer nothing, and the declined toast even less. The screens themselves look right against the Figma frames.
Two blocking issues, both about where the numbers and the routing come from rather than about the UI.
- The success screen's figures are computed on the client from a hardcoded exchange rate, while the authoritative balance is fetched on the very next line and discarded.
- The re-entry path never reaches either screen, which the description says it does.
One question about a behavior change on the success path.
I checked and cleared one thing that looked wrong: centsToCredits(effectiveBalanceMicros) reads like a unit error, but the _micros fields hold cents — CurrentUserPopoverWorkspace.vue:335 documents the API naming inconsistency and does the same conversion. Your usage is consistent with the codebase; no action needed. A one-line comment pointing at that would save the next reader the same detour.
| const balanceBeforeCharge = ref(0) | ||
| const creditsAdded = ref(0) | ||
| const declineReason = ref<string | null>(null) | ||
|
|
||
| const newBalanceCredits = computed( | ||
| () => balanceBeforeCharge.value + creditsAdded.value | ||
| ) |
There was a problem hiding this comment.
issue (blocking): The success screen states three figures about the customer's money, and two of them are client-side predictions rather than server facts.
Previous balance balanceBeforeCharge captured client-side pre-charge
Added +creditsAdded = usdToCredits(payAmount)
New balance newBalanceCredits = balanceBeforeCharge + creditsAdded
usdToCredits is Math.round(usd * CREDITS_PER_USD) with CREDITS_PER_USD = 211 hardcoded in src/base/credits/comfyCredits.ts:31. So "Added" is what the frontend believes $N buys, and "New balance" is frontend arithmetic on top of that — neither is what the server credited.
They diverge whenever anything sits between the amount typed and the credits granted:
- a promotion or bonus credits applied to the top-up (the promo-code path exists elsewhere in this flow)
- the rate changing server-side while
CREDITS_PER_USDlags in a deployed bundle - tax, currency conversion, or a partial capture
- any concurrent spend — a running job consuming credits between capture and render makes "New balance" simply wrong, and it's the figure with the coin icon that customers will screenshot
What makes this straightforward to fix is that the real number is already in hand. Line 761 awaits fetchBalance() immediately after showSuccess(), so balance.value holds the authoritative post-charge balance — the screen just doesn't read it. Deriving after the refresh gives you both figures honestly:
await Promise.allSettled([fetchBalance(), fetchStatus()])
const after = currentBalanceCredits()
creditsAdded.value = after - balanceBeforeCharge.value
showSuccess() // after the refresh, not beforeThat keeps your pre-capture snapshot (which is the right call, and the comment explaining why is good) and makes "Added" and "New balance" observed rather than predicted. Better still if the top-up response carries the credited amount — then "Added" is the server's own number and doesn't depend on the subtraction being uncontended.
I'd rather not ship client-computed balance arithmetic on a receipt screen; if the two ever disagree, the customer believes this screen and we have no record of what it showed.
There was a problem hiding this comment.
Taken exactly as prescribed (d40cfd3): the success screen renders after fetchBalance() resolves, "New balance" is currentBalanceCredits() read from the refreshed context, and "Added" is the observed delta from the pre-charge snapshot — usdToCredits no longer feeds the receipt. The updated test moves the mocked balance by a different amount than the typed $50 converts to and asserts the screen shows the observed figure. Agreed the response carrying the credited amount would be better still — worth folding into the BE ask we're drafting for the missing cancel endpoint.
| .then((operation) => { | ||
| paymentSubmitted.value = false | ||
| if (operation.status === 'succeeded') { | ||
| showSuccess() | ||
| } else if (operation.status === 'failed') { | ||
| showDeclined(operation.errorMessage) | ||
| } |
There was a problem hiding this comment.
issue (blocking): The description says
Both terminal statuses of the async (3DS) path route to the same two screens, so a charge that resolves after a bank challenge ends where a synchronous one does.
That holds only for a charge started in this dialog session. Every route into the outcome screens — lines 760, 771, 773, 799 — is inside handleBuy. There is no route from a recovered operation.
On re-entry (the case #16408's verifying step exists to serve): the dialog opens at 'verifying' from topupOperation, no handleBuy promise is in flight, and when the operation reaches a terminal status it stops matching the topupActionOperation selector. topupOperation goes undefined and the watcher at line 592 fires:
if (step.value === 'verifying' && !polling && !operation) {
step.value = 'amount'So the customer who completed a bank challenge in another tab, or reopened the dialog after one, is dropped on the amount step — no success screen, no balance breakdown, no decline reason. Exactly the "never saw what the charge did" problem this PR is fixing, still present on the path most likely to hit 3DS.
balanceBeforeCharge corroborates it: on re-entry it's never assigned, so it would render "Previous balance 0" if that path did reach the screen.
Could the terminal transition be driven off the operation status rather than off the handleBuy promise? Extending that watcher to route succeeded → showSuccess() and failed → showDeclined(errorMessage) would cover both paths with one rule — and would want the balance-derived figures from my other comment, since on re-entry there's no captured pre-charge snapshot to add to.
There was a problem hiding this comment.
Right — the promise-driven routing only ever served the session that created it. The polling watcher now reads the terminal operation by id when the selector drops it (the operation outlives the selector in the store map), routing succeeded → success and failed → declined with the reason; in-flight charges still route through handleBuy's own resolution, guarded by paymentSubmitted. And as you anticipated, a recovered success has no pre-charge snapshot — it shows the success screen with the breakdown withheld rather than reconstructed. Two new tests cover recovered success (no breakdown) and recovered decline (reason shown).
| function openBillingAndInvoices() { | ||
| handleClose() | ||
| settingsDialog.show('workspace') | ||
| } |
There was a problem hiding this comment.
question: Two side effects of the success path changed here and I want to check both are deliberate, since neither is mentioned in the description.
Destination. The old code was settingsDialog.show(isCloud ? 'workspace' : 'credits'); this hardcodes 'workspace' and the isCloud import was dropped. If this dialog is cloud-only in practice the branch was dead and removing it is a cleanup — but if it can render outside cloud, non-cloud users now land on a panel that may not be the one they wanted.
Tracking. The old success path called handleClose(false), explicitly not clearing pending-topup tracking. Both new exits — this one and the success screen's Close button (@click="() => handleClose()") — use the default clearTracking = true.
Clearing on success reads like the more correct behavior to me, since the charge has settled and there's nothing pending left to track. But it's a real change to usePendingTopup state on the happy path, and it arrives as a side effect of a screen-layout PR rather than as a stated decision. If it's intended, worth a line in the description; if it's incidental, handleClose(false) preserves the previous semantics.
There was a problem hiding this comment.
Half deliberate, half accidental — thanks for making me say which. Tracking: intended; clearing on success is correct since nothing pending remains, and it's now stated in the description. Destination: accidental — the isCloud branch is restored (local top-up is real; the store's own success path still routes non-cloud to Credits, and this now matches).
…opup-outcome-states # Conflicts: # src/locales/en/main.json
…opup-outcome-states # Conflicts: # src/platform/workspace/composables/useSubscriptionCheckout.ts
dante01yoon
left a comment
There was a problem hiding this comment.
Re-reviewed at 8e56573a (was 8e52cab1). Both blocking findings are resolved, and the fixes went further than what I asked for. Verified in code:
Receipt figures now come from the server. showSuccess() reads currentBalanceCredits() after the balance refresh for "New balance", and "Added" is the observed delta from the pre-charge snapshot. usdToCredits no longer feeds the receipt — it's left where it belongs, on the input affordances. The test moving the mocked balance by a different amount than $50 converts to is the right shape for pinning that, since it fails if the arithmetic creeps back.
The balanceBeforeCharge === null case is handled the way I'd hoped: the whole breakdown box is behind v-if="balanceBeforeCharge !== null", so a receipt with no snapshot withholds all three figures rather than reconstructing or zeroing them. That also means the recovered-success path can't display a stale "New balance", which was the follow-on I was going to raise.
Recovered operations reach the outcome screens. The [isPolling, topupOperation] watcher reads the terminal operation by remembered id once the selector drops it and routes succeeded → success, failed → declined with the reason, guarded on !paymentSubmitted so in-flow charges keep handleBuy's own resolution. observedTopupOpId surviving the selector is the right mechanism — the operation outliving the selector in the store map is what makes it readable at all.
One delivery per outcome. The store checking whether the dialog is open, for both the success navigation and the failure toast, is a better fix than anything scoped to this component. It fixes the case where the dialog and the store both spoke.
Also confirmed: isCloud restored at line 715, decline label now "What your bank said".
Agreed on the two deferrals — the response carrying the credited amount belongs in the BE ask alongside the cancel endpoint, and the failure-class split follows here once the stacks converge. And fair point on the conversion stub; asserting arithmetic here would make these change detectors on the rate.
Approving.
…opup-outcome-states
| summary: t('credits.topUp.purchaseSuccess'), | ||
| life: 5000 | ||
| }) | ||
| await Promise.allSettled([fetchBalance(), fetchStatus()]) |
There was a problem hiding this comment.
Severity: Major
What: Promise.allSettled swallows a rejected balance refresh and showSuccess() then reads the unchanged balance, so the receipt prints "Added +0" and a "New balance" equal to the previous one; a concurrent spend renders "+-N" through the hardcoded sign at :154.
Why this is an issue: The receipt states figures the client did not observe, on the screen whose purpose is to state observed figures; the test at :670-687 drives this rejection and asserts telemetry only.
Proposed Fix: Read the allSettled result and null balanceBeforeCharge when the balance read rejected or the observed delta is not positive, so the screen falls into the tested breakdown-less state; assert that state in the refresh-fails test.
| // itself: the top-up dialog stays put for its success step, and no toast | ||
| // repeats what the screen already says. With the dialog closed, the old | ||
| // delivery stands — settings surface the result and the toast carries it. | ||
| const topupDialogAttending = |
There was a problem hiding this comment.
Severity: Major
What: The store skips settings and both toasts whenever a 'top-up-credits' dialog is open, but the dialog renders an outcome only for a charge it started or a challenge-bearing operation (topupActionOperation :171-179; watcher gate at the component's :594).
Why this is an issue: Close and reopen the dialog while a challenge-free charge is processing and the settled outcome reaches nothing: no screen, no toast, no settings; before this change every such case delivered settings plus a toast.
Proposed Fix: Gate on attendance of the specific operation (a store-held set the dialog registers its opId into, checked in both handlers through one helper) and fall back to the old delivery otherwise; add the reopen-mid-charge test.
| </p> | ||
| </div> | ||
|
|
||
| <div |
There was a problem hiding this comment.
Severity: Major
What: The block labeled "What your bank said" renders the store's errorMessage, which is always mapped app copy ("Top-up failed", "An unknown error occurred", or a localized decline sentence; store :766, :1013-1026, :457-469), never the provider's reason, and its v-if is never false on the async path.
Why this is an issue: App copy is attributed to the bank; the raw decline_reason (workspaceApi.ts:129, read at store:342) is mapped before storage and never carried; the tests inject "Insufficient funds", a string no writer produces, so they cannot catch it.
Proposed Fix: Carry declineReason on the operation from the poll's decline_reason and render the block only when it is non-null, or drop the bank attribution and show the store's message as unattributed subtext.
| showDeclined(settled.errorMessage ?? null) | ||
| return | ||
| } | ||
| step.value = 'amount' |
There was a problem hiding this comment.
Severity: Minor
What: On the 3DS success path the store writes 'succeeded' (:636) before it awaits the refresh, the pending-only selector drops the operation, and the watcher runs with paymentSubmitted still true, so it skips both outcome branches and sets the amount step until the .then at :787-790 shows the receipt.
Why this is an issue: After a bank challenge the customer sees the amount form with pay locked for the length of the refresh, then the receipt; the fall-through predates this change but the outcome screens make it visible.
Proposed Fix: Return from the watcher without touching step while paymentSubmitted.value is true, and let the catch path move a 'verifying' step to 'amount'; make the challenge tests drop the operation at resolution so the ordering is exercised.
Second half of the #14526 replant. Adds the two designed outcome screens to the top-up dialog (Figma 5631:32731, Top Up / 4 Success and Top Up / 5 Declined).
A completed charge previously showed a toast, closed the dialog, and redirected into settings — the customer never saw what the charge did to their balance. It now lands on the success screen with previous balance, credits added, and new balance. The previous figure is captured before the charge because the refresh that follows a success overwrites it.
A declined charge previously showed an error toast with no way forward. It now lands on the declined screen, which carries the provider's reason when the operation reports one, and offers a way back to the charge or on to the billing portal.
Both terminal statuses of the async (3DS) path route to the same two screens, so a charge that resolves after a bank challenge ends where a synchronous one does.
Stacked on #16408.
Review updates (Sep 2):
isCloud ? 'workspace' : 'credits'branch — the hardcoded 'workspace' was accidental and is restored.useCancelPendingPayment, consumed by both this dialog and the subscription checkout.