Skip to content

feat(billing): show the top-up's real outcome in the dialog — receipt or decline reason - #16413

Open
comfydesigner wants to merge 12 commits into
comfydesigner/topup-cancel-statesfrom
comfydesigner/topup-outcome-states
Open

comfydesigner wants to merge 12 commits into
comfydesigner/topup-cancel-statesfrom
comfydesigner/topup-outcome-states

Conversation

@comfydesigner

@comfydesigner comfydesigner commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

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):

  • The receipt figures are observed, not predicted: the success screen renders after the balance refresh, "New balance" is the server's figure, and "Added" is the delta from the pre-charge snapshot. A recovered charge has no snapshot, so it shows the success screen without the breakdown.
  • Recovered operations now route to the outcome screens: the polling watcher reads the terminal operation by id when the selector drops it, so a charge resolved in another tab or after reopening lands on success/declined instead of the amount step.
  • Two deliberate side-effect changes, previously unstated: pending-topup tracking is cleared on success-screen close (the charge settled; nothing pending remains), and the settings destination keeps the isCloud ? 'workspace' : 'credits' branch — the hardcoded 'workspace' was accidental and is restored.
  • The cancel-outcome state machine is extracted to useCancelPendingPayment, consumed by both this dialog and the subscription checkout.

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.
@coderabbitai

coderabbitai Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Team

Run ID: f593126b-bd65-4b27-a4c8-899703175104

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

🎨 Storybook: ✅ Built — View Storybook

Details

⏰ Completed at: 09/03/2026, 01:59:57 AM UTC

Links

🎭 Playwright: ❌ 1895 passed, 1 failed

❌ Failed Tests

📊 Browser Reports
  • chromium: View Report (✅ 1874 / ❌ 1 / ⚠️ 0 / ⏭️ 4)
  • chromium-2x: View Report (✅ 2 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • chromium-0.5x: View Report (✅ 1 / ❌ 0 / ⚠️ 0 / ⏭️ 0)
  • mobile-chrome: View Report (✅ 18 / ❌ 0 / ⚠️ 0 / ⏭️ 0)

📦 Bundle Size

⏳ Size data collection in progress…

⚡ Performance Report

canvas-idle: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 55.7 MB heap
canvas-mouse-sweep: · 60.0 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 71.4 MB heap
canvas-zoom-sweep: · 60.0 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 71.6 MB heap
dom-widget-clipping: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 72.0 MB heap
large-graph-idle: · 60.0 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 82.8 MB heap
large-graph-pan: · 60.0 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 77.7 MB heap
large-graph-zoom: · 60.0 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 72.8 MB heap
legacy-node-drag: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 84.4 MB heap
minimap-idle: · 60.0 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 83.7 MB heap
subgraph-dom-widget-clipping: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 83.4 MB heap
subgraph-idle: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 74.2 MB heap
subgraph-mouse-sweep: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 57.3 MB heap
subgraph-transition-enter: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 123ms TBT · 103.5 MB heap
viewport-pan-sweep: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 80.7 MB heap
vue-large-graph-idle: · 56.3 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 167.6 MB heap
vue-large-graph-pan: · 54.5 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 86ms TBT · 158.8 MB heap
vue-node-resize-workload: · 56.3 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 413ms TBT · 171.3 MB heap
workflow-execution: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 69.3 MB heap

ℹ️ No baseline found — significance unavailable.

Absolute values
Metric Value
canvas-idle: avg frame time 17ms
canvas-idle: p95 frame time 17ms
canvas-idle: layout duration 0ms
canvas-idle: style recalc duration 9ms
canvas-idle: layout count 0
canvas-idle: style recalc count 9
canvas-idle: task duration 561ms
canvas-idle: script duration 11ms
canvas-idle: TBT 0ms
canvas-idle: heap used 55.7 MB
canvas-idle: DOM nodes -282
canvas-idle: event listeners -156
canvas-mouse-sweep: avg frame time 17ms
canvas-mouse-sweep: p95 frame time 17ms
canvas-mouse-sweep: layout duration 5ms
canvas-mouse-sweep: style recalc duration 41ms
canvas-mouse-sweep: layout count 14
canvas-mouse-sweep: style recalc count 79
canvas-mouse-sweep: task duration 901ms
canvas-mouse-sweep: script duration 150ms
canvas-mouse-sweep: TBT 0ms
canvas-mouse-sweep: heap used 71.4 MB
canvas-mouse-sweep: DOM nodes -281
canvas-mouse-sweep: event listeners -186
canvas-zoom-sweep: avg frame time 17ms
canvas-zoom-sweep: p95 frame time 17ms
canvas-zoom-sweep: layout duration 1ms
canvas-zoom-sweep: style recalc duration 17ms
canvas-zoom-sweep: layout count 6
canvas-zoom-sweep: style recalc count 30
canvas-zoom-sweep: task duration 366ms
canvas-zoom-sweep: script duration 11ms
canvas-zoom-sweep: TBT 0ms
canvas-zoom-sweep: heap used 71.6 MB
canvas-zoom-sweep: DOM nodes 77
canvas-zoom-sweep: event listeners 19
dom-widget-clipping: avg frame time 17ms
dom-widget-clipping: p95 frame time 17ms
dom-widget-clipping: layout duration 0ms
dom-widget-clipping: style recalc duration 6ms
dom-widget-clipping: layout count 0
dom-widget-clipping: style recalc count 9
dom-widget-clipping: task duration 445ms
dom-widget-clipping: script duration 155ms
dom-widget-clipping: TBT 0ms
dom-widget-clipping: heap used 72.0 MB
dom-widget-clipping: DOM nodes 14
dom-widget-clipping: event listeners 2
large-graph-idle: avg frame time 17ms
large-graph-idle: p95 frame time 17ms
large-graph-idle: layout duration 0ms
large-graph-idle: style recalc duration 4ms
large-graph-idle: layout count 0
large-graph-idle: style recalc count 5
large-graph-idle: task duration 614ms
large-graph-idle: script duration 37ms
large-graph-idle: TBT 0ms
large-graph-idle: heap used 82.8 MB
large-graph-idle: DOM nodes -271
large-graph-idle: event listeners -154
large-graph-pan: avg frame time 17ms
large-graph-pan: p95 frame time 17ms
large-graph-pan: layout duration 0ms
large-graph-pan: style recalc duration 14ms
large-graph-pan: layout count 0
large-graph-pan: style recalc count 66
large-graph-pan: task duration 1591ms
large-graph-pan: script duration 755ms
large-graph-pan: TBT 0ms
large-graph-pan: heap used 77.7 MB
large-graph-pan: DOM nodes -135
large-graph-pan: event listeners -90
large-graph-zoom: avg frame time 17ms
large-graph-zoom: p95 frame time 17ms
large-graph-zoom: layout duration 13ms
large-graph-zoom: style recalc duration 11ms
large-graph-zoom: layout count 60
large-graph-zoom: style recalc count 61
large-graph-zoom: task duration 1733ms
large-graph-zoom: script duration 780ms
large-graph-zoom: TBT 0ms
large-graph-zoom: heap used 72.8 MB
large-graph-zoom: DOM nodes 1
large-graph-zoom: event listeners 9
legacy-node-drag: avg frame time 17ms
legacy-node-drag: p95 frame time 17ms
legacy-node-drag: layout duration 0ms
legacy-node-drag: style recalc duration 6ms
legacy-node-drag: layout count 0
legacy-node-drag: style recalc count 41
legacy-node-drag: task duration 1902ms
legacy-node-drag: script duration 931ms
legacy-node-drag: TBT 0ms
legacy-node-drag: heap used 84.4 MB
legacy-node-drag: DOM nodes 1
legacy-node-drag: event listeners 188
minimap-idle: avg frame time 17ms
minimap-idle: p95 frame time 17ms
minimap-idle: layout duration 0ms
minimap-idle: style recalc duration 1ms
minimap-idle: layout count 0
minimap-idle: style recalc count 1
minimap-idle: task duration 583ms
minimap-idle: script duration 37ms
minimap-idle: TBT 0ms
minimap-idle: heap used 83.7 MB
minimap-idle: DOM nodes -275
minimap-idle: event listeners -91
subgraph-dom-widget-clipping: avg frame time 17ms
subgraph-dom-widget-clipping: p95 frame time 17ms
subgraph-dom-widget-clipping: layout duration 0ms
subgraph-dom-widget-clipping: style recalc duration 10ms
subgraph-dom-widget-clipping: layout count 0
subgraph-dom-widget-clipping: style recalc count 46
subgraph-dom-widget-clipping: task duration 414ms
subgraph-dom-widget-clipping: script duration 143ms
subgraph-dom-widget-clipping: TBT 0ms
subgraph-dom-widget-clipping: heap used 83.4 MB
subgraph-dom-widget-clipping: DOM nodes 17
subgraph-dom-widget-clipping: event listeners 7
subgraph-idle: avg frame time 17ms
subgraph-idle: p95 frame time 17ms
subgraph-idle: layout duration 0ms
subgraph-idle: style recalc duration 8ms
subgraph-idle: layout count 0
subgraph-idle: style recalc count 9
subgraph-idle: task duration 494ms
subgraph-idle: script duration 8ms
subgraph-idle: TBT 0ms
subgraph-idle: heap used 74.2 MB
subgraph-idle: DOM nodes -297
subgraph-idle: event listeners -231
subgraph-mouse-sweep: avg frame time 17ms
subgraph-mouse-sweep: p95 frame time 17ms
subgraph-mouse-sweep: layout duration 6ms
subgraph-mouse-sweep: style recalc duration 40ms
subgraph-mouse-sweep: layout count 18
subgraph-mouse-sweep: style recalc count 79
subgraph-mouse-sweep: task duration 856ms
subgraph-mouse-sweep: script duration 110ms
subgraph-mouse-sweep: TBT 0ms
subgraph-mouse-sweep: heap used 57.3 MB
subgraph-mouse-sweep: DOM nodes -295
subgraph-mouse-sweep: event listeners -201
subgraph-transition-enter: avg frame time 17ms
subgraph-transition-enter: p95 frame time 17ms
subgraph-transition-enter: layout duration 15ms
subgraph-transition-enter: style recalc duration 31ms
subgraph-transition-enter: layout count 15
subgraph-transition-enter: style recalc count 19
subgraph-transition-enter: task duration 955ms
subgraph-transition-enter: script duration 31ms
subgraph-transition-enter: TBT 123ms
subgraph-transition-enter: heap used 103.5 MB
subgraph-transition-enter: DOM nodes 13751
subgraph-transition-enter: event listeners 2381
viewport-pan-sweep: avg frame time 17ms
viewport-pan-sweep: p95 frame time 17ms
viewport-pan-sweep: layout duration 0ms
viewport-pan-sweep: style recalc duration 39ms
viewport-pan-sweep: layout count 0
viewport-pan-sweep: style recalc count 246
viewport-pan-sweep: task duration 5735ms
viewport-pan-sweep: script duration 2567ms
viewport-pan-sweep: TBT 0ms
viewport-pan-sweep: heap used 80.7 MB
viewport-pan-sweep: DOM nodes -270
viewport-pan-sweep: event listeners -139
vue-large-graph-idle: avg frame time 18ms
vue-large-graph-idle: p95 frame time 17ms
vue-large-graph-idle: layout duration 0ms
vue-large-graph-idle: style recalc duration 0ms
vue-large-graph-idle: layout count 0
vue-large-graph-idle: style recalc count 0
vue-large-graph-idle: task duration 17451ms
vue-large-graph-idle: script duration 296ms
vue-large-graph-idle: TBT 0ms
vue-large-graph-idle: heap used 167.6 MB
vue-large-graph-idle: DOM nodes -6550
vue-large-graph-idle: event listeners -7472
vue-large-graph-pan: avg frame time 18ms
vue-large-graph-pan: p95 frame time 17ms
vue-large-graph-pan: layout duration 0ms
vue-large-graph-pan: style recalc duration 22ms
vue-large-graph-pan: layout count 0
vue-large-graph-pan: style recalc count 162
vue-large-graph-pan: task duration 21825ms
vue-large-graph-pan: script duration 901ms
vue-large-graph-pan: TBT 86ms
vue-large-graph-pan: heap used 158.8 MB
vue-large-graph-pan: DOM nodes -6550
vue-large-graph-pan: event listeners -7469
vue-node-resize-workload: avg frame time 18ms
vue-node-resize-workload: p95 frame time 17ms
vue-node-resize-workload: layout duration 25ms
vue-node-resize-workload: style recalc duration 75ms
vue-node-resize-workload: layout count 20
vue-node-resize-workload: style recalc count 20
vue-node-resize-workload: task duration 6336ms
vue-node-resize-workload: script duration 141ms
vue-node-resize-workload: TBT 413ms
vue-node-resize-workload: heap used 171.3 MB
vue-node-resize-workload: DOM nodes -6548
vue-node-resize-workload: event listeners -7471
workflow-execution: avg frame time 17ms
workflow-execution: p95 frame time 17ms
workflow-execution: layout duration 1ms
workflow-execution: style recalc duration 17ms
workflow-execution: layout count 3
workflow-execution: style recalc count 10
workflow-execution: task duration 90ms
workflow-execution: script duration 7ms
workflow-execution: TBT 0ms
workflow-execution: heap used 69.3 MB
workflow-execution: DOM nodes 116
workflow-execution: event listeners 74
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

Metric Covered Total Pct
Lines 48020 70613 68.0% 🟡
Functions 0 0 — —
Branches 0 0 — —
Top 10 files by uncovered lines
File Coverage Missed
src/LGraphCanvas.ts 67.1% 1188
src/LGraphNode.ts 69.4% 397
src/extensions/core/cameraInfo/CameraInfoViewport.ts 2.0% 343
src/platform/workspace/stores/billingOperationStore.ts 7.8% 321
src/platform/workspace/stores/workspaceAuthStore.ts 36.0% 288
src/platform/workspace/stores/teamWorkspaceStore.ts 37.7% 261
src/LGraph.ts 78.4% 258
src/scripts/app.ts 71.6% 250
src/scripts/pnginfo.ts 21.4% 221
src/stores/assetsStore.ts 44.7% 204

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.
@github-actions github-actions Bot added the risk:R3 PR risk grade (advisory shadow check; grader-owned) label Aug 31, 2026
@codecov

codecov Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.21622% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
.../components/TopUpCreditsDialogContentWorkspace.vue 93.54% 6 Missing ⚠️
src/storybook/mocks/useBillingContext.ts 0.00% 4 Missing ⚠️
...platform/workspace/stores/billingOperationStore.ts 87.50% 2 Missing ⚠️
...m/workspace/composables/useCancelPendingPayment.ts 96.77% 1 Missing ⚠️
@@                          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              
Flag Coverage Δ
e2e 68.02% <0.00%> (-0.01%) ⬇️
unit 76.65% <93.75%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...m/workspace/composables/useSubscriptionCheckout.ts 89.11% <100.00%> (+0.39%) ⬆️
...m/workspace/composables/useCancelPendingPayment.ts 96.77% <96.77%> (ø)
...platform/workspace/stores/billingOperationStore.ts 93.09% <87.50%> (-0.11%) ⬇️
src/storybook/mocks/useBillingContext.ts 0.00% <0.00%> (ø)
.../components/TopUpCreditsDialogContentWorkspace.vue 88.42% <93.54%> (+1.71%) ⬆️

... and 7 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@comfydesigner
comfydesigner marked this pull request as ready for review September 1, 2026 00:14
@comfydesigner comfydesigner added the cursor-review Trigger multi-model Cursor agent review on this PR label Sep 2, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 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()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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') {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in d40cfd3 — the isCloud branch is restored; the hardcode was accidental.


function currentBalanceCredits(): number {
return centsToCredits(
balance.value?.effectiveBalanceMicros ?? balance.value?.amountMicros ?? 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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') }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@huang47 huang47 added the risk:xhigh PR risk grade (advisory shadow check; grader-owned) label Sep 2, 2026 — with ChatGPT Codex Connector
@huang47 huang47 removed the risk:R3 PR risk grade (advisory shadow check; grader-owned) label Sep 2, 2026

@dante01yoon dante01yoon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

  1. 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.
  2. 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.

Comment on lines +536 to +542
const balanceBeforeCharge = ref(0)
const creditsAdded = ref(0)
const declineReason = ref<string | null>(null)

const newBalanceCredits = computed(
() => balanceBeforeCharge.value + creditsAdded.value
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_USD lags 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 before

That 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +768 to +774
.then((operation) => {
paymentSubmitted.value = false
if (operation.status === 'succeeded') {
showSuccess()
} else if (operation.status === 'failed') {
showDeclined(operation.errorMessage)
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Comment on lines +693 to +696
function openBillingAndInvoices() {
handleClose()
settingsDialog.show('workspace')
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@github-actions github-actions Bot added the risk:R3 PR risk grade (advisory shadow check; grader-owned) label Sep 2, 2026
…opup-outcome-states

# Conflicts:
#	src/platform/workspace/composables/useSubscriptionCheckout.ts
@huang47 huang47 removed the risk:R3 PR risk grade (advisory shadow check; grader-owned) label Sep 2, 2026
@github-actions github-actions Bot added the risk:R3 PR risk grade (advisory shadow check; grader-owned) label Sep 2, 2026

@dante01yoon dante01yoon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@comfydesigner comfydesigner changed the title feat(billing): top-up success and declined outcome states feat(billing): show the top-up's real outcome in the dialog — receipt or decline reason Sep 3, 2026

@CodeJuggernaut CodeJuggernaut left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Three Majors inline.

summary: t('credits.topUp.purchaseSuccess'),
life: 5000
})
await Promise.allSettled([fetchBalance(), fetchStatus()])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@CodeJuggernaut CodeJuggernaut removed their assignment Sep 17, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cursor-review Trigger multi-model Cursor agent review on this PR risk:R3 PR risk grade (advisory shadow check; grader-owned) risk:xhigh PR risk grade (advisory shadow check; grader-owned)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants