Skip to content

feat(account): hosted top-up checkout command on the top-up surface (FE-2214) - #17689

Merged
dante01yoon merged 1 commit into
jaewon/fe-2214-phase-3a-top-up-command-mapping-on-the-shared-billingfrom
jaewon/fe-2214-hosted-topup-checkout
Sep 15, 2026
Merged

dante01yoon merged 1 commit into
jaewon/fe-2214-phase-3a-top-up-command-mapping-on-the-shared-billingfrom
jaewon/fe-2214-hosted-topup-checkout

Conversation

@dante01yoon

Copy link
Copy Markdown
Collaborator

Why

FE-2214's done-when says all three current top-up hosts can integrate the top-up command. #17657 covers ComfyUI_frontend's route (POST /api/billing/topup, an operation to poll). Workshop (apps/website) and Platform ship on the other route, POST /api/billing/topup/checkout: a provider-hosted Checkout session with no billing_op_id, credits landing through a webhook. That route could not be decoded with generated schemas until the ingest-types regen #17396 merged; it now carries CreateTopupCheckoutRequest / CreateTopupCheckoutResponse, so this is the 3A-2 follow-up recorded on FE-2214.

Stacked on #17657 (FE-2214 top-up command); merge after it.

How

createTopupCommand gains a second method on the same surface, createHostedTopupCheckout({ amountCents, returnUrl, signal? }):

  • input is validated by the generated zCreateTopupCheckoutRequest; INVALID_AMOUNT / INVALID_RETURN_URL are returned before anything is sent
  • the same capability gate as the in-app command (ACCESS_DENIED carrying the server's denial), then the pre-purchase balance is read
  • one idempotency key per attempt, in the body and on the request; a 404 maps to NOT_AVAILABLE so a host keeps its legacy path while topup_checkout_enabled is off
  • checkout_url must be https (validateActionUrl, the same rule every lifecycle continuation obeys), otherwise MALFORMED_RESPONSE; session_id passes through when present
  • nothing is adopted on the lifecycle and no operation id is invented (FE-2214 invariant): the result is { url, sessionId?, baselineMicros? }. The host executes its OpenUrlMode on url (Workshop pre-opens a tab, Platform redirects) and on return arms the existing createBalanceWatch with baselineMicros, which is how the test proves completion

readTopupEligibility (from the fallow split on #17657) now returns the two failures it can actually produce, which is what lets the hosted result union exclude NO_PAYMENT_METHOD.

AS-IS / TO-BE

AS-IS: TopupCommand exposes createTopupCheckout only; Workshop keeps its own createTopUpCheckout fetch with a hand-written zTopUpCheckout schema, and Platform its own.
TO-BE: TopupCommand exposes createHostedTopupCheckout over the generated contract; a host adapter is a thin wrapper (validate → gate → POST → open → balance watch). No UI in this PR, so no screenshots; the consumer cutover for Workshop is a separate slice.

Testing

Eight new tests under createHostedTopupCheckout in topup.test.ts: success shape, request body and idempotency key, and no lifecycle operation; can_top_up false without a POST; amount and return-URL rejection without a request; 404 → NOT_AVAILABLE; missing or non-https URL → MALFORMED_RESPONSE; optional session id and baseline omitted when unknown; baseline handed to a balance watch that reconciles on return; no server or provider text on the failure path. Billing core suite 187 passing; oxlint, eslint, oxfmt, vue-tsc clean.

Stack (2026-09-15)

Merge top-down. After a parent is squash-merged, rebase each child with git rebase --onto origin/main <parent tip> and force-push; GitHub retargets the base. Solid edges are code dependencies, dashed edges are sequencing.

flowchart TD
  P12["Phase 1 + 2 merged<br/>#17436 · #17442 · ingest-types regen #17396"] --> C["FE-2227 Phase 3 core<br/>#17655 · base main"]
  C --> P0["PR 0 coded error bodies + 3DS driver<br/>#17656"]
  P0 --> A["FE-2214 top-up command<br/>#17657"]
  A --> A2["FE-2214 3A-2 hosted top-up checkout<br/>this PR"]
  P0 --> B1["FE-2223 B1 subscription commands<br/>#17658"]
  B1 --> B2["FE-2223 B2 eight-state projection<br/>#17659"]
  A --> I["Integration, do not merge<br/>#17660"]
  B2 --> I
  I --> V1["FE-2215 @comfyorg/account-ui composables<br/>#17662"]
  V1 --> V2["FE-2215 CheckoutSteps<br/>#17663"]
  I --> SES["core: narrowed BillingSession type<br/>#17664"]
  SES --> AD1["FE-2216 slice 1 top-up behind a flag<br/>#17665"]
  A2 -.-> WS["Workshop adapter over createHostedTopupCheckout<br/>later slice"]
  AD1 -.-> AD2["FE-2216 slice 2 subscription<br/>needs previewSubscribe (FE-2331)"]
  AD1 --> E["FE-2217 Phase 6 evidence"]
  BW["billing-web #17370 → #17574"] --> H["FE-2218 Phase 7 separate origin"]
  AD1 --> H
  H --> H8["FE-2331 Phase 8 hosted surfaces"]
Loading

Design: Billing SDK implementation plan (V2). Linear: FE-2214.

…FE-2214)

Adds createHostedTopupCheckout to the top-up command: the POST /api/billing/topup/checkout route Workshop and Platform ship on, now decodable because the ingest-types regen (#17396) carries CreateTopupCheckoutRequest/Response.

- input validated by the generated request schema; INVALID_AMOUNT / INVALID_RETURN_URL before anything is sent
- same capability gate as the in-app command (ACCESS_DENIED with the server's denial), then the pre-purchase balance is read
- one idempotency key per attempt in the body and on the request; 404 maps to NOT_AVAILABLE so a host keeps its legacy path
- checkout_url must be https, else MALFORMED_RESPONSE; session_id passes through when present
- no operation is adopted or invented: the result is the session URL plus baselineMicros, the host executes its OpenUrlMode and arms createBalanceWatch on return

readTopupEligibility now returns the two failures it can actually produce.
@coderabbitai

coderabbitai Bot commented Sep 15, 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: Advanced

Run ID: e7d20ce3-5229-4f08-a637-d008cbbab600

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 Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

🎨 Storybook: ✅ Built — View Storybook

Details

⏰ Completed at: 09/15/2026, 01:38:27 AM UTC

Links

🌐 Website E2E

Tip

All tests passed.

Status ✅ Passed
Report View Report

🎭 Playwright: ✅ 1996 passed, 0 failed · 2 flaky

📊 Browser Reports
  • chromium: View Report (✅ 1975 / ❌ 0 / ⚠️ 2 / ⏭️ 13)
  • 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 · 70.5 MB heap
canvas-mouse-sweep: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 67.4 MB heap
canvas-zoom-sweep: · 60.0 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 61.5 MB heap
dom-widget-clipping: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 76.1 MB heap
large-graph-idle: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 74.2 MB heap
large-graph-pan: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 67.0 MB heap
large-graph-zoom: · 60.0 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 69.9 MB heap
legacy-node-drag: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 75.8 MB heap
minimap-idle: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 76.5 MB heap
subgraph-dom-widget-clipping: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 73.2 MB heap
subgraph-idle: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 55.1 MB heap
subgraph-mouse-sweep: · 60.0 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 63.7 MB heap
subgraph-transition-enter: · 60.0 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 106ms TBT · 97.7 MB heap
viewport-pan-sweep: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 78.5 MB heap
vue-large-graph-idle: · 59.0 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 168.9 MB heap
vue-large-graph-pan: · 60.0 avg FPS · 59.9 P5 FPS ✅ (target: ≥52) · 0ms TBT · 171.0 MB heap
vue-node-resize-workload: · 60.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 167.3 MB heap
vue-zoom-out-idle: · 59.0 avg FPS · 59.7 P5 FPS ✅ (target: ≥52) · 0ms TBT · 175.2 MB heap
workflow-execution: · 60.0 avg FPS · 59.5 P5 FPS ✅ (target: ≥52) · 0ms TBT · 62.9 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 5ms
canvas-idle: layout count 0
canvas-idle: style recalc count 9
canvas-idle: task duration 358ms
canvas-idle: script duration 6ms
canvas-idle: TBT 0ms
canvas-idle: heap used 70.5 MB
canvas-idle: DOM nodes -261
canvas-idle: event listeners -153
canvas-mouse-sweep: avg frame time 17ms
canvas-mouse-sweep: p95 frame time 17ms
canvas-mouse-sweep: layout duration 3ms
canvas-mouse-sweep: style recalc duration 17ms
canvas-mouse-sweep: layout count 14
canvas-mouse-sweep: style recalc count 74
canvas-mouse-sweep: task duration 601ms
canvas-mouse-sweep: script duration 104ms
canvas-mouse-sweep: TBT 0ms
canvas-mouse-sweep: heap used 67.4 MB
canvas-mouse-sweep: DOM nodes -259
canvas-mouse-sweep: event listeners -169
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 11ms
canvas-zoom-sweep: layout count 6
canvas-zoom-sweep: style recalc count 31
canvas-zoom-sweep: task duration 233ms
canvas-zoom-sweep: script duration 8ms
canvas-zoom-sweep: TBT 0ms
canvas-zoom-sweep: heap used 61.5 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 13
dom-widget-clipping: task duration 299ms
dom-widget-clipping: script duration 113ms
dom-widget-clipping: TBT 0ms
dom-widget-clipping: heap used 76.1 MB
dom-widget-clipping: DOM nodes 21
dom-widget-clipping: event listeners 1
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 5ms
large-graph-idle: layout count 0
large-graph-idle: style recalc count 9
large-graph-idle: task duration 468ms
large-graph-idle: script duration 20ms
large-graph-idle: TBT 0ms
large-graph-idle: heap used 74.2 MB
large-graph-idle: DOM nodes -247
large-graph-idle: event listeners -181
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 10ms
large-graph-pan: layout count 0
large-graph-pan: style recalc count 70
large-graph-pan: task duration 1110ms
large-graph-pan: script duration 556ms
large-graph-pan: TBT 0ms
large-graph-pan: heap used 67.0 MB
large-graph-pan: DOM nodes -232
large-graph-pan: event listeners -182
large-graph-zoom: avg frame time 17ms
large-graph-zoom: p95 frame time 17ms
large-graph-zoom: layout duration 8ms
large-graph-zoom: style recalc duration 9ms
large-graph-zoom: layout count 60
large-graph-zoom: style recalc count 65
large-graph-zoom: task duration 1180ms
large-graph-zoom: script duration 503ms
large-graph-zoom: TBT 0ms
large-graph-zoom: heap used 69.9 MB
large-graph-zoom: DOM nodes -119
large-graph-zoom: event listeners -85
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 7ms
legacy-node-drag: layout count 0
legacy-node-drag: style recalc count 48
legacy-node-drag: task duration 1312ms
legacy-node-drag: script duration 614ms
legacy-node-drag: TBT 0ms
legacy-node-drag: heap used 75.8 MB
legacy-node-drag: DOM nodes -245
legacy-node-drag: event listeners 0
minimap-idle: avg frame time 17ms
minimap-idle: p95 frame time 17ms
minimap-idle: layout duration 0ms
minimap-idle: style recalc duration 5ms
minimap-idle: layout count 0
minimap-idle: style recalc count 8
minimap-idle: task duration 477ms
minimap-idle: script duration 20ms
minimap-idle: TBT 0ms
minimap-idle: heap used 76.5 MB
minimap-idle: DOM nodes -249
minimap-idle: event listeners -182
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 8ms
subgraph-dom-widget-clipping: layout count 0
subgraph-dom-widget-clipping: style recalc count 48
subgraph-dom-widget-clipping: task duration 289ms
subgraph-dom-widget-clipping: script duration 97ms
subgraph-dom-widget-clipping: TBT 0ms
subgraph-dom-widget-clipping: heap used 73.2 MB
subgraph-dom-widget-clipping: DOM nodes 22
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 6ms
subgraph-idle: layout count 0
subgraph-idle: style recalc count 10
subgraph-idle: task duration 374ms
subgraph-idle: script duration 6ms
subgraph-idle: TBT 0ms
subgraph-idle: heap used 55.1 MB
subgraph-idle: DOM nodes -274
subgraph-idle: event listeners -230
subgraph-mouse-sweep: avg frame time 17ms
subgraph-mouse-sweep: p95 frame time 17ms
subgraph-mouse-sweep: layout duration 4ms
subgraph-mouse-sweep: style recalc duration 18ms
subgraph-mouse-sweep: layout count 18
subgraph-mouse-sweep: style recalc count 79
subgraph-mouse-sweep: task duration 566ms
subgraph-mouse-sweep: script duration 69ms
subgraph-mouse-sweep: TBT 0ms
subgraph-mouse-sweep: heap used 63.7 MB
subgraph-mouse-sweep: DOM nodes -273
subgraph-mouse-sweep: event listeners -214
subgraph-transition-enter: avg frame time 17ms
subgraph-transition-enter: p95 frame time 17ms
subgraph-transition-enter: layout duration 8ms
subgraph-transition-enter: style recalc duration 20ms
subgraph-transition-enter: layout count 5
subgraph-transition-enter: style recalc count 18
subgraph-transition-enter: task duration 538ms
subgraph-transition-enter: script duration 19ms
subgraph-transition-enter: TBT 106ms
subgraph-transition-enter: heap used 97.7 MB
subgraph-transition-enter: DOM nodes 13587
subgraph-transition-enter: event listeners 2385
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 23ms
viewport-pan-sweep: layout count 0
viewport-pan-sweep: style recalc count 250
viewport-pan-sweep: task duration 4091ms
viewport-pan-sweep: script duration 1888ms
viewport-pan-sweep: TBT 0ms
viewport-pan-sweep: heap used 78.5 MB
viewport-pan-sweep: DOM nodes -228
viewport-pan-sweep: event listeners -166
vue-large-graph-idle: avg frame time 17ms
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 8519ms
vue-large-graph-idle: script duration 98ms
vue-large-graph-idle: TBT 0ms
vue-large-graph-idle: heap used 168.9 MB
vue-large-graph-idle: DOM nodes -6543
vue-large-graph-idle: event listeners -7480
vue-large-graph-pan: avg frame time 17ms
vue-large-graph-pan: p95 frame time 17ms
vue-large-graph-pan: layout duration 0ms
vue-large-graph-pan: style recalc duration 8ms
vue-large-graph-pan: layout count 0
vue-large-graph-pan: style recalc count 68
vue-large-graph-pan: task duration 12236ms
vue-large-graph-pan: script duration 525ms
vue-large-graph-pan: TBT 0ms
vue-large-graph-pan: heap used 171.0 MB
vue-large-graph-pan: DOM nodes -6558
vue-large-graph-pan: event listeners -7486
vue-node-resize-workload: avg frame time 17ms
vue-node-resize-workload: p95 frame time 17ms
vue-node-resize-workload: layout duration 15ms
vue-node-resize-workload: style recalc duration 55ms
vue-node-resize-workload: layout count 20
vue-node-resize-workload: style recalc count 20
vue-node-resize-workload: task duration 3615ms
vue-node-resize-workload: script duration 49ms
vue-node-resize-workload: TBT 0ms
vue-node-resize-workload: heap used 167.3 MB
vue-node-resize-workload: DOM nodes -6543
vue-node-resize-workload: event listeners -7479
vue-zoom-out-idle: avg frame time 17ms
vue-zoom-out-idle: p95 frame time 17ms
vue-zoom-out-idle: layout duration 0ms
vue-zoom-out-idle: style recalc duration 0ms
vue-zoom-out-idle: layout count 0
vue-zoom-out-idle: style recalc count 1
vue-zoom-out-idle: task duration 4334ms
vue-zoom-out-idle: script duration 49ms
vue-zoom-out-idle: TBT 0ms
vue-zoom-out-idle: heap used 175.2 MB
vue-zoom-out-idle: DOM nodes 0
vue-zoom-out-idle: event listeners -7
workflow-execution: avg frame time 17ms
workflow-execution: p95 frame time 17ms
workflow-execution: layout duration 1ms
workflow-execution: style recalc duration 13ms
workflow-execution: layout count 4
workflow-execution: style recalc count 11
workflow-execution: task duration 70ms
workflow-execution: script duration 7ms
workflow-execution: TBT 0ms
workflow-execution: heap used 62.9 MB
workflow-execution: DOM nodes 128
workflow-execution: event listeners 57
Raw data
{
  "timestamp": "2026-09-15T01:45:06.122Z",
  "gitSha": "f62b1dfb7b7b19fe5c25923e7cf8006aa74e4490",
  "branch": "jaewon/fe-2214-hosted-topup-checkout",
  "measurements": [
    {
      "name": "canvas-idle",
      "durationMs": 1992.7189999999655,
      "styleRecalcs": 8,
      "styleRecalcDurationMs": 4.744,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 411.7289999999999,
      "heapDeltaBytes": 12994852,
      "heapUsedBytes": 74202064,
      "domNodes": -263,
      "jsHeapTotalBytes": 5758976,
      "scriptDurationMs": 6.256000000000001,
      "eventListeners": -154,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "canvas-idle",
      "durationMs": 1993.9170000000104,
      "styleRecalcs": 10,
      "styleRecalcDurationMs": 5.642999999999999,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 303.549,
      "heapDeltaBytes": 11635164,
      "heapUsedBytes": 73669768,
      "domNodes": -258,
      "jsHeapTotalBytes": 4972544,
      "scriptDurationMs": 6.284,
      "eventListeners": -152,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.699999999999818
    },
    {
      "name": "canvas-mouse-sweep",
      "durationMs": 1677.6399999999967,
      "styleRecalcs": 73,
      "styleRecalcDurationMs": 16.898000000000003,
      "layouts": 14,
      "layoutDurationMs": 2.999,
      "taskDurationMs": 597.92,
      "heapDeltaBytes": 18049704,
      "heapUsedBytes": 80086976,
      "domNodes": -260,
      "jsHeapTotalBytes": 4972544,
      "scriptDurationMs": 101.852,
      "eventListeners": -154,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333332,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "canvas-mouse-sweep",
      "durationMs": 1694.947999999954,
      "styleRecalcs": 74,
      "styleRecalcDurationMs": 16.45,
      "layouts": 14,
      "layoutDurationMs": 2.915,
      "taskDurationMs": 603.1220000000001,
      "heapDeltaBytes": -962576,
      "heapUsedBytes": 61331440,
      "domNodes": -258,
      "jsHeapTotalBytes": 5234688,
      "scriptDurationMs": 105.259,
      "eventListeners": -184,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "canvas-zoom-sweep",
      "durationMs": 1711.1019999999826,
      "styleRecalcs": 31,
      "styleRecalcDurationMs": 11.112,
      "layouts": 6,
      "layoutDurationMs": 0.835,
      "taskDurationMs": 252.85000000000002,
      "heapDeltaBytes": 2144560,
      "heapUsedBytes": 64323512,
      "domNodes": 76,
      "jsHeapTotalBytes": 5242880,
      "scriptDurationMs": 7.445000000000002,
      "eventListeners": 19,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "canvas-zoom-sweep",
      "durationMs": 1717.4280000000408,
      "styleRecalcs": 31,
      "styleRecalcDurationMs": 11.787,
      "layouts": 6,
      "layoutDurationMs": 0.8290000000000001,
      "taskDurationMs": 212.27300000000002,
      "heapDeltaBytes": 2163196,
      "heapUsedBytes": 64558928,
      "domNodes": 77,
      "jsHeapTotalBytes": 4718592,
      "scriptDurationMs": 7.743999999999999,
      "eventListeners": 19,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "dom-widget-clipping",
      "durationMs": 499.6810000000096,
      "styleRecalcs": 12,
      "styleRecalcDurationMs": 5.289000000000001,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 312.042,
      "heapDeltaBytes": 17932504,
      "heapUsedBytes": 80130756,
      "domNodes": 20,
      "jsHeapTotalBytes": 5505024,
      "scriptDurationMs": 113.32400000000001,
      "eventListeners": 0,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66666666666665,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "dom-widget-clipping",
      "durationMs": 442.21099999998614,
      "styleRecalcs": 13,
      "styleRecalcDurationMs": 5.997000000000001,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 285.998,
      "heapDeltaBytes": 17585720,
      "heapUsedBytes": 79547024,
      "domNodes": 22,
      "jsHeapTotalBytes": 6029312,
      "scriptDurationMs": 112.22300000000001,
      "eventListeners": 2,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.663333333333338,
      "p95FrameDurationMs": 16.700000000000273
    },
    {
      "name": "large-graph-idle",
      "durationMs": 2025.3749999999968,
      "styleRecalcs": 8,
      "styleRecalcDurationMs": 5.077999999999999,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 468.99899999999997,
      "heapDeltaBytes": -2550680,
      "heapUsedBytes": 76284700,
      "domNodes": -252,
      "jsHeapTotalBytes": -8192,
      "scriptDurationMs": 20.057,
      "eventListeners": -182,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333335,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "large-graph-idle",
      "durationMs": 2023.8630000000057,
      "styleRecalcs": 10,
      "styleRecalcDurationMs": 5.756000000000001,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 467.4320000000001,
      "heapDeltaBytes": -737308,
      "heapUsedBytes": 79383352,
      "domNodes": -241,
      "jsHeapTotalBytes": 778240,
      "scriptDurationMs": 19.323,
      "eventListeners": -180,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.699999999999818
    },
    {
      "name": "large-graph-pan",
      "durationMs": 2115.73599999997,
      "styleRecalcs": 69,
      "styleRecalcDurationMs": 11.325000000000001,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 1054.446,
      "heapDeltaBytes": -6467964,
      "heapUsedBytes": 74910152,
      "domNodes": -215,
      "jsHeapTotalBytes": 516096,
      "scriptDurationMs": 559.381,
      "eventListeners": -182,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66999999999998,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "large-graph-pan",
      "durationMs": 2145.1019999999517,
      "styleRecalcs": 70,
      "styleRecalcDurationMs": 9.549999999999997,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 1165.884,
      "heapDeltaBytes": -15456960,
      "heapUsedBytes": 65651596,
      "domNodes": -248,
      "jsHeapTotalBytes": 1302528,
      "scriptDurationMs": 551.9699999999999,
      "eventListeners": -182,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333332,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "large-graph-zoom",
      "durationMs": 3089.1340000000014,
      "styleRecalcs": 67,
      "styleRecalcDurationMs": 10.255,
      "layouts": 60,
      "layoutDurationMs": 7.867000000000001,
      "taskDurationMs": 1213.19,
      "heapDeltaBytes": -9404912,
      "heapUsedBytes": 72892352,
      "domNodes": -246,
      "jsHeapTotalBytes": -270336,
      "scriptDurationMs": 505.073,
      "eventListeners": -178,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.799999999999272
    },
    {
      "name": "large-graph-zoom",
      "durationMs": 3072.747999999933,
      "styleRecalcs": 63,
      "styleRecalcDurationMs": 8.155,
      "layouts": 60,
      "layoutDurationMs": 8.229000000000001,
      "taskDurationMs": 1146.4399999999998,
      "heapDeltaBytes": 7574220,
      "heapUsedBytes": 73770108,
      "domNodes": 8,
      "jsHeapTotalBytes": 0,
      "scriptDurationMs": 500.112,
      "eventListeners": 8,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "legacy-node-drag",
      "durationMs": 2152.1470000000136,
      "styleRecalcs": 47,
      "styleRecalcDurationMs": 6.001999999999997,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 1301.059,
      "heapDeltaBytes": -4993960,
      "heapUsedBytes": 79216764,
      "domNodes": -245,
      "jsHeapTotalBytes": -638976,
      "scriptDurationMs": 604.796,
      "eventListeners": 0,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "legacy-node-drag",
      "durationMs": 2165.80799999997,
      "styleRecalcs": 48,
      "styleRecalcDurationMs": 7.398999999999999,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 1323.819,
      "heapDeltaBytes": -4486364,
      "heapUsedBytes": 79721380,
      "domNodes": -245,
      "jsHeapTotalBytes": -376832,
      "scriptDurationMs": 622.773,
      "eventListeners": 0,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333335,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "minimap-idle",
      "durationMs": 2033.0000000000155,
      "styleRecalcs": 8,
      "styleRecalcDurationMs": 4.959999999999999,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 481.4440000000001,
      "heapDeltaBytes": -7221944,
      "heapUsedBytes": 81215168,
      "domNodes": -244,
      "jsHeapTotalBytes": 28672,
      "scriptDurationMs": 20.414,
      "eventListeners": -182,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "minimap-idle",
      "durationMs": 2034.104999999954,
      "styleRecalcs": 7,
      "styleRecalcDurationMs": 4.701999999999998,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 473.3930000000001,
      "heapDeltaBytes": -2624972,
      "heapUsedBytes": 79220992,
      "domNodes": -254,
      "jsHeapTotalBytes": -757760,
      "scriptDurationMs": 20.567,
      "eventListeners": -182,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66999999999998,
      "p95FrameDurationMs": 16.699999999999818
    },
    {
      "name": "subgraph-dom-widget-clipping",
      "durationMs": 443.2130000000143,
      "styleRecalcs": 48,
      "styleRecalcDurationMs": 7.6560000000000015,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 285.65200000000004,
      "heapDeltaBytes": 13374872,
      "heapUsedBytes": 76853424,
      "domNodes": 22,
      "jsHeapTotalBytes": 5767168,
      "scriptDurationMs": 95.04799999999999,
      "eventListeners": 8,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.663333333333338,
      "p95FrameDurationMs": 16.700000000000273
    },
    {
      "name": "subgraph-dom-widget-clipping",
      "durationMs": 462.4469999999974,
      "styleRecalcs": 48,
      "styleRecalcDurationMs": 7.405,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 291.598,
      "heapDeltaBytes": 13278740,
      "heapUsedBytes": 76581516,
      "domNodes": 22,
      "jsHeapTotalBytes": 5767168,
      "scriptDurationMs": 98.75800000000001,
      "eventListeners": 6,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000273
    },
    {
      "name": "subgraph-idle",
      "durationMs": 1994.0659999999752,
      "styleRecalcs": 10,
      "styleRecalcDurationMs": 6.04,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 371.54,
      "heapDeltaBytes": -4999540,
      "heapUsedBytes": 58406884,
      "domNodes": -273,
      "jsHeapTotalBytes": 4972544,
      "scriptDurationMs": 6.132999999999999,
      "eventListeners": -230,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.699999999999818
    },
    {
      "name": "subgraph-idle",
      "durationMs": 2010.1280000000088,
      "styleRecalcs": 10,
      "styleRecalcDurationMs": 5.679000000000002,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 376.94200000000006,
      "heapDeltaBytes": -5559140,
      "heapUsedBytes": 57211676,
      "domNodes": -274,
      "jsHeapTotalBytes": 4710400,
      "scriptDurationMs": 5.782000000000001,
      "eventListeners": -230,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.699999999999818
    },
    {
      "name": "subgraph-mouse-sweep",
      "durationMs": 1687.5650000000064,
      "styleRecalcs": 78,
      "styleRecalcDurationMs": 17.352,
      "layouts": 18,
      "layoutDurationMs": 3.526,
      "taskDurationMs": 561.061,
      "heapDeltaBytes": 9685304,
      "heapUsedBytes": 72965748,
      "domNodes": -272,
      "jsHeapTotalBytes": 6021120,
      "scriptDurationMs": 68.5,
      "eventListeners": -198,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "subgraph-mouse-sweep",
      "durationMs": 1670.5939999999941,
      "styleRecalcs": 79,
      "styleRecalcDurationMs": 17.956,
      "layouts": 18,
      "layoutDurationMs": 3.655,
      "taskDurationMs": 570.0970000000001,
      "heapDeltaBytes": -2824508,
      "heapUsedBytes": 60690388,
      "domNodes": -273,
      "jsHeapTotalBytes": 5496832,
      "scriptDurationMs": 69.62100000000001,
      "eventListeners": -230,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "subgraph-transition-enter",
      "durationMs": 816.0720000000197,
      "styleRecalcs": 18,
      "styleRecalcDurationMs": 20.19,
      "layouts": 5,
      "layoutDurationMs": 8.256000000000002,
      "taskDurationMs": 538.3359999999999,
      "heapDeltaBytes": 20048348,
      "heapUsedBytes": 102442500,
      "domNodes": 13587,
      "jsHeapTotalBytes": 11010048,
      "scriptDurationMs": 18.747,
      "eventListeners": 2385,
      "totalBlockingTimeMs": 106,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "viewport-pan-sweep",
      "durationMs": 8186.530000000004,
      "styleRecalcs": 250,
      "styleRecalcDurationMs": 25.253,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 4145.495999999999,
      "heapDeltaBytes": -12308764,
      "heapUsedBytes": 68306640,
      "domNodes": -242,
      "jsHeapTotalBytes": 4747264,
      "scriptDurationMs": 1928.7259999999999,
      "eventListeners": -166,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "viewport-pan-sweep",
      "durationMs": 8138.864000000012,
      "styleRecalcs": 250,
      "styleRecalcDurationMs": 20.766,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 4035.64,
      "heapDeltaBytes": 15570732,
      "heapUsedBytes": 96295944,
      "domNodes": -213,
      "jsHeapTotalBytes": 2351104,
      "scriptDurationMs": 1846.437,
      "eventListeners": -166,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333332,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "vue-large-graph-idle",
      "durationMs": 10563.744999999983,
      "styleRecalcs": 0,
      "styleRecalcDurationMs": 0,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 9843.065,
      "heapDeltaBytes": -13724472,
      "heapUsedBytes": 181381732,
      "domNodes": -6543,
      "jsHeapTotalBytes": 2871296,
      "scriptDurationMs": 107.02799999999998,
      "eventListeners": -7478,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 17.223333333333358,
      "p95FrameDurationMs": 16.80000000000291
    },
    {
      "name": "vue-large-graph-idle",
      "durationMs": 8333.800999999994,
      "styleRecalcs": 0,
      "styleRecalcDurationMs": 0,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 7194.696,
      "heapDeltaBytes": -26976128,
      "heapUsedBytes": 172829036,
      "domNodes": -6543,
      "jsHeapTotalBytes": 6569984,
      "scriptDurationMs": 89.61999999999999,
      "eventListeners": -7482,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.799999999999272
    },
    {
      "name": "vue-large-graph-pan",
      "durationMs": 12740.523999999994,
      "styleRecalcs": 68,
      "styleRecalcDurationMs": 7.829000000000002,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 12154.981000000002,
      "heapDeltaBytes": -37475796,
      "heapUsedBytes": 163647220,
      "domNodes": -6543,
      "jsHeapTotalBytes": -843776,
      "scriptDurationMs": 534.688,
      "eventListeners": -7478,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333326,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "vue-large-graph-pan",
      "durationMs": 12849.843999999961,
      "styleRecalcs": 67,
      "styleRecalcDurationMs": 8.189000000000002,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 12317.550000000001,
      "heapDeltaBytes": -18428044,
      "heapUsedBytes": 194998752,
      "domNodes": -6573,
      "jsHeapTotalBytes": 7491584,
      "scriptDurationMs": 516.1850000000001,
      "eventListeners": -7494,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "vue-node-resize-workload",
      "durationMs": 3727.8180000000134,
      "styleRecalcs": 20,
      "styleRecalcDurationMs": 54.82400000000001,
      "layouts": 20,
      "layoutDurationMs": 14.857999999999997,
      "taskDurationMs": 3597.079,
      "heapDeltaBytes": -21702852,
      "heapUsedBytes": 178325724,
      "domNodes": -6543,
      "jsHeapTotalBytes": 17317888,
      "scriptDurationMs": 49.428,
      "eventListeners": -7478,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333332,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "vue-node-resize-workload",
      "durationMs": 3763.328999999999,
      "styleRecalcs": 20,
      "styleRecalcDurationMs": 55.646,
      "layouts": 20,
      "layoutDurationMs": 15.038999999999996,
      "taskDurationMs": 3631.943,
      "heapDeltaBytes": -22403832,
      "heapUsedBytes": 172511008,
      "domNodes": -6543,
      "jsHeapTotalBytes": 18817024,
      "scriptDurationMs": 49.288000000000004,
      "eventListeners": -7480,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.66333333333332,
      "p95FrameDurationMs": 16.799999999999272
    },
    {
      "name": "vue-zoom-out-idle",
      "durationMs": 4230.416000000048,
      "styleRecalcs": 1,
      "styleRecalcDurationMs": 0.07199999999998874,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 3670.9479999999994,
      "heapDeltaBytes": 32171596,
      "heapUsedBytes": 199339836,
      "domNodes": 0,
      "jsHeapTotalBytes": -786432,
      "scriptDurationMs": 44.219999999999985,
      "eventListeners": -6,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.670000000000012,
      "p95FrameDurationMs": 16.700000000000728
    },
    {
      "name": "vue-zoom-out-idle",
      "durationMs": 5253.6700000000565,
      "styleRecalcs": 0,
      "styleRecalcDurationMs": 0,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 4996.352,
      "heapDeltaBytes": -18849080,
      "heapUsedBytes": 168176616,
      "domNodes": 0,
      "jsHeapTotalBytes": -9437184,
      "scriptDurationMs": 53.638999999999996,
      "eventListeners": -8,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 17.220000000000073,
      "p95FrameDurationMs": 16.799999999999272
    },
    {
      "name": "workflow-execution",
      "durationMs": 427.61500000000296,
      "styleRecalcs": 15,
      "styleRecalcDurationMs": 13.856,
      "layouts": 2,
      "layoutDurationMs": 0.496,
      "taskDurationMs": 78.827,
      "heapDeltaBytes": 4957400,
      "heapUsedBytes": 66867900,
      "domNodes": 126,
      "jsHeapTotalBytes": 262144,
      "scriptDurationMs": 8.094,
      "eventListeners": 81,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666682,
      "p95FrameDurationMs": 16.800000000000182
    },
    {
      "name": "workflow-execution",
      "durationMs": 79.90400000005593,
      "styleRecalcs": 6,
      "styleRecalcDurationMs": 11.299999999999999,
      "layouts": 5,
      "layoutDurationMs": 1.4220000000000002,
      "taskDurationMs": 60.657000000000004,
      "heapDeltaBytes": 3127412,
      "heapUsedBytes": 65059668,
      "domNodes": 130,
      "jsHeapTotalBytes": 0,
      "scriptDurationMs": 5.309999999999999,
      "eventListeners": 33,
      "totalBlockingTimeMs": 0,
      "frameDurationMs": 16.666666666666668,
      "p95FrameDurationMs": 16.800000000000182
    }
  ]
}

🔬 E2E Coverage

Metric Covered Total Pct
Lines 50783 76112 66.7% 🟡
Functions 0 0 — —
Branches 0 0 — —
Top 10 files by uncovered lines
File Coverage Missed
src/LGraphCanvas.ts 67.6% 1160
src/LGraphNode.ts 69.9% 388
src/extensions/core/cameraInfo/CameraInfoViewport.ts 2.0% 343
src/renderer/extensions/layerEditor/composables/useLayerEditorSession.ts 40.1% 332
src/platform/workspace/stores/workspaceAuthStore.ts 33.4% 327
src/platform/workspace/stores/billingOperationStore.ts 8.0% 311
src/LGraph.ts 79.1% 263
src/platform/workspace/stores/teamWorkspaceStore.ts 38.9% 256
src/scripts/app.ts 71.8% 251
src/scripts/pnginfo.ts 21.4% 221

@codecov

codecov Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@                                          Coverage Diff                                          @@
##           jaewon/fe-2214-phase-3a-top-up-command-mapping-on-the-shared-billing   #17689   +/-   ##
=====================================================================================================
  Coverage                                                                 82.72%   82.72%           
=====================================================================================================
  Files                                                                      2789     2789           
  Lines                                                                    140529   140560   +31     
  Branches                                                                  37753    37766   +13     
=====================================================================================================
+ Hits                                                                     116247   116278   +31     
  Misses                                                                    23195    23195           
  Partials                                                                   1087     1087           
Flag Coverage Δ
e2e 66.72% <ø> (-0.01%) ⬇️
unit 78.85% <100.00%> (+<0.01%) ⬆️
website-unit 74.28% <ø> (ø)

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

Files with missing lines Coverage Δ
packages/account/src/core/billing/topup.ts 96.87% <100.00%> (+1.56%) ⬆️

... and 11 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.

@github-actions github-actions Bot added the risk:high PR risk grade (advisory shadow check; grader-owned) label Sep 15, 2026
@dante01yoon
dante01yoon merged commit adee349 into jaewon/fe-2214-phase-3a-top-up-command-mapping-on-the-shared-billing Sep 15, 2026
96 checks passed
@dante01yoon
dante01yoon deleted the jaewon/fe-2214-hosted-topup-checkout branch September 15, 2026 02:22
dante01yoon added a commit that referenced this pull request Sep 15, 2026
…FE-2214) (#17689)

## Why

FE-2214's done-when says all three current top-up hosts can integrate
the top-up command. #17657 covers ComfyUI_frontend's route (`POST
/api/billing/topup`, an operation to poll). Workshop (`apps/website`)
and Platform ship on the other route, `POST
/api/billing/topup/checkout`: a provider-hosted Checkout session with no
`billing_op_id`, credits landing through a webhook. That route could not
be decoded with generated schemas until the ingest-types regen #17396
merged; it now carries `CreateTopupCheckoutRequest` /
`CreateTopupCheckoutResponse`, so this is the 3A-2 follow-up recorded on
FE-2214.

Stacked on #17657 (FE-2214 top-up command); merge after it.

## How

`createTopupCommand` gains a second method on the same surface,
`createHostedTopupCheckout({ amountCents, returnUrl, signal? })`:

- input is validated by the generated `zCreateTopupCheckoutRequest`;
`INVALID_AMOUNT` / `INVALID_RETURN_URL` are returned before anything is
sent
- the same capability gate as the in-app command (`ACCESS_DENIED`
carrying the server's denial), then the pre-purchase balance is read
- one idempotency key per attempt, in the body and on the request; a 404
maps to `NOT_AVAILABLE` so a host keeps its legacy path while
`topup_checkout_enabled` is off
- `checkout_url` must be https (`validateActionUrl`, the same rule every
lifecycle continuation obeys), otherwise `MALFORMED_RESPONSE`;
`session_id` passes through when present
- nothing is adopted on the lifecycle and no operation id is invented
(FE-2214 invariant): the result is `{ url, sessionId?, baselineMicros?
}`. The host executes its `OpenUrlMode` on `url` (Workshop pre-opens a
tab, Platform redirects) and on return arms the existing
`createBalanceWatch` with `baselineMicros`, which is how the test proves
completion

`readTopupEligibility` (from the fallow split on #17657) now returns the
two failures it can actually produce, which is what lets the hosted
result union exclude `NO_PAYMENT_METHOD`.

## AS-IS / TO-BE

AS-IS: `TopupCommand` exposes `createTopupCheckout` only; Workshop keeps
its own `createTopUpCheckout` fetch with a hand-written `zTopUpCheckout`
schema, and Platform its own.
TO-BE: `TopupCommand` exposes `createHostedTopupCheckout` over the
generated contract; a host adapter is a thin wrapper (validate → gate →
POST → open → balance watch). No UI in this PR, so no screenshots; the
consumer cutover for Workshop is a separate slice.

## Testing

Eight new tests under `createHostedTopupCheckout` in `topup.test.ts`:
success shape, request body and idempotency key, and no lifecycle
operation; `can_top_up` false without a POST; amount and return-URL
rejection without a request; 404 → `NOT_AVAILABLE`; missing or non-https
URL → `MALFORMED_RESPONSE`; optional session id and baseline omitted
when unknown; baseline handed to a balance watch that reconciles on
return; no server or provider text on the failure path. Billing core
suite 187 passing; oxlint, eslint, oxfmt, `vue-tsc` clean.

## Stack (2026-09-15)

Merge top-down. After a parent is squash-merged, rebase each child with
`git rebase --onto origin/main <parent tip>` and force-push; GitHub
retargets the base. Solid edges are code dependencies, dashed edges are
sequencing.

```mermaid
flowchart TD
  P12["Phase 1 + 2 merged<br/>#17436 · #17442 · ingest-types regen #17396"] --> C["FE-2227 Phase 3 core<br/>#17655 · base main"]
  C --> P0["PR 0 coded error bodies + 3DS driver<br/>#17656"]
  P0 --> A["FE-2214 top-up command<br/>#17657"]
  A --> A2["FE-2214 3A-2 hosted top-up checkout<br/>this PR"]
  P0 --> B1["FE-2223 B1 subscription commands<br/>#17658"]
  B1 --> B2["FE-2223 B2 eight-state projection<br/>#17659"]
  A --> I["Integration, do not merge<br/>#17660"]
  B2 --> I
  I --> V1["FE-2215 @comfyorg/account-ui composables<br/>#17662"]
  V1 --> V2["FE-2215 CheckoutSteps<br/>#17663"]
  I --> SES["core: narrowed BillingSession type<br/>#17664"]
  SES --> AD1["FE-2216 slice 1 top-up behind a flag<br/>#17665"]
  A2 -.-> WS["Workshop adapter over createHostedTopupCheckout<br/>later slice"]
  AD1 -.-> AD2["FE-2216 slice 2 subscription<br/>needs previewSubscribe (FE-2331)"]
  AD1 --> E["FE-2217 Phase 6 evidence"]
  BW["billing-web #17370 → #17574"] --> H["FE-2218 Phase 7 separate origin"]
  AD1 --> H
  H --> H8["FE-2331 Phase 8 hosted surfaces"]
```

Design: [Billing SDK implementation plan
(V2)](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8).
Linear: FE-2214.
dante01yoon added a commit that referenced this pull request Sep 15, 2026
…FE-2214) (#17689)

FE-2214's done-when says all three current top-up hosts can integrate
the top-up command. #17657 covers ComfyUI_frontend's route (`POST
/api/billing/topup`, an operation to poll). Workshop (`apps/website`)
and Platform ship on the other route, `POST
/api/billing/topup/checkout`: a provider-hosted Checkout session with no
`billing_op_id`, credits landing through a webhook. That route could not
be decoded with generated schemas until the ingest-types regen #17396
merged; it now carries `CreateTopupCheckoutRequest` /
`CreateTopupCheckoutResponse`, so this is the 3A-2 follow-up recorded on
FE-2214.

Stacked on #17657 (FE-2214 top-up command); merge after it.

`createTopupCommand` gains a second method on the same surface,
`createHostedTopupCheckout({ amountCents, returnUrl, signal? })`:

- input is validated by the generated `zCreateTopupCheckoutRequest`;
`INVALID_AMOUNT` / `INVALID_RETURN_URL` are returned before anything is
sent
- the same capability gate as the in-app command (`ACCESS_DENIED`
carrying the server's denial), then the pre-purchase balance is read
- one idempotency key per attempt, in the body and on the request; a 404
maps to `NOT_AVAILABLE` so a host keeps its legacy path while
`topup_checkout_enabled` is off
- `checkout_url` must be https (`validateActionUrl`, the same rule every
lifecycle continuation obeys), otherwise `MALFORMED_RESPONSE`;
`session_id` passes through when present
- nothing is adopted on the lifecycle and no operation id is invented
(FE-2214 invariant): the result is `{ url, sessionId?, baselineMicros?
}`. The host executes its `OpenUrlMode` on `url` (Workshop pre-opens a
tab, Platform redirects) and on return arms the existing
`createBalanceWatch` with `baselineMicros`, which is how the test proves
completion

`readTopupEligibility` (from the fallow split on #17657) now returns the
two failures it can actually produce, which is what lets the hosted
result union exclude `NO_PAYMENT_METHOD`.

AS-IS: `TopupCommand` exposes `createTopupCheckout` only; Workshop keeps
its own `createTopUpCheckout` fetch with a hand-written `zTopUpCheckout`
schema, and Platform its own.
TO-BE: `TopupCommand` exposes `createHostedTopupCheckout` over the
generated contract; a host adapter is a thin wrapper (validate → gate →
POST → open → balance watch). No UI in this PR, so no screenshots; the
consumer cutover for Workshop is a separate slice.

Eight new tests under `createHostedTopupCheckout` in `topup.test.ts`:
success shape, request body and idempotency key, and no lifecycle
operation; `can_top_up` false without a POST; amount and return-URL
rejection without a request; 404 → `NOT_AVAILABLE`; missing or non-https
URL → `MALFORMED_RESPONSE`; optional session id and baseline omitted
when unknown; baseline handed to a balance watch that reconciles on
return; no server or provider text on the failure path. Billing core
suite 187 passing; oxlint, eslint, oxfmt, `vue-tsc` clean.

Merge top-down. After a parent is squash-merged, rebase each child with
`git rebase --onto origin/main <parent tip>` and force-push; GitHub
retargets the base. Solid edges are code dependencies, dashed edges are
sequencing.

```mermaid
flowchart TD
  P12["Phase 1 + 2 merged<br/>#17436 · #17442 · ingest-types regen #17396"] --> C["FE-2227 Phase 3 core<br/>#17655 · base main"]
  C --> P0["PR 0 coded error bodies + 3DS driver<br/>#17656"]
  P0 --> A["FE-2214 top-up command<br/>#17657"]
  A --> A2["FE-2214 3A-2 hosted top-up checkout<br/>this PR"]
  P0 --> B1["FE-2223 B1 subscription commands<br/>#17658"]
  B1 --> B2["FE-2223 B2 eight-state projection<br/>#17659"]
  A --> I["Integration, do not merge<br/>#17660"]
  B2 --> I
  I --> V1["FE-2215 @comfyorg/account-ui composables<br/>#17662"]
  V1 --> V2["FE-2215 CheckoutSteps<br/>#17663"]
  I --> SES["core: narrowed BillingSession type<br/>#17664"]
  SES --> AD1["FE-2216 slice 1 top-up behind a flag<br/>#17665"]
  A2 -.-> WS["Workshop adapter over createHostedTopupCheckout<br/>later slice"]
  AD1 -.-> AD2["FE-2216 slice 2 subscription<br/>needs previewSubscribe (FE-2331)"]
  AD1 --> E["FE-2217 Phase 6 evidence"]
  BW["billing-web #17370 → #17574"] --> H["FE-2218 Phase 7 separate origin"]
  AD1 --> H
  H --> H8["FE-2331 Phase 8 hosted surfaces"]
```

Design: [Billing SDK implementation plan
(V2)](https://app.notion.com/p/3d86d73d36508152b92cdbdfdfe83ac8).
Linear: FE-2214.
dante01yoon added a commit that referenced this pull request Sep 15, 2026
…4) (#17657)

## Why

Stacked on PR 0 (`jaewon/fe-2227-core-error-codes-and-challenge-driver`,
#17656) → #17655 (FE-2227); merge after both.

Phase 3A of the billing SDK: the top-up command mapped onto the shared
operation lifecycle, covering both routes cloud exposes today. Only
request/response mapping lives here — the status-read gate,
single-flight, polling, routing, the pointer, failure meaning, and
telemetry all come from the lifecycle in #17655/#17656 and are not
duplicated.

- Linear: https://linear.app/comfyorg/issue/FE-2214

## How

`packages/account/src/core/billing/topup.ts` — `createTopupCommand({
transport, lifecycle, capabilities, credits, idempotencyKey? })`
returning two commands on one surface:

**`createTopupCheckout({ amountCents, signal? })`** — the in-app route
ComfyUI_frontend uses (`POST /billing/topup`, an operation to observe):

1. `capabilities.read()` → `can_top_up === false` ⇒ `{ status: 'error',
code: 'ACCESS_DENIED', denial? }` without a POST. The server flag is the
only gate; nothing is derived.
2. Amount validated with `zCreateTopupRequest`; the plain input object
is what travels (the schema coerces to bigint, which the transport
cannot serialize).
3. One fresh key per POST attempt, in the body (`idempotency_key`) and
as `idempotencyKey` on the `BillingRequest`. Supplying that key is what
makes the POST replayable at the transport's 401 gate (`replayable =
method === 'GET' || idempotencyKey !== undefined`): the single 401
replay is safe *because* the same key travels in both places for the
backend to deduplicate on. Backend dedup is load-bearing on this route,
not incidental. A fresh key is minted per attempt, so two user-initiated
top-ups never collide.
4. POST through `lifecycle.begin('topup', issue)`; the response is
decoded with `zCreateTopupResponse` and its `billing_op_id` adopted
regardless of `status`, so the first poll settles synchronous results
and carries the coded decline.
5. Command-level `TopupResult` union: `ok` (terminal `succeeded` state
embedded + `creditsReconciled`), `declined` (terminal `failed` state
embedded: `declineReason`, `recoveryAction`, `retryable`), `unsettled`
(`timed_out` / `reconciliation_needed` embedded), plus `error` codes —
the core `BillingErrorCode`s untouched, and `NOT_AVAILABLE` (404 on the
POST), `NO_PAYMENT_METHOD` (`serverCode`, with `recoveryAction:
'replace_payment_method'`), `INVALID_AMOUNT` (below the generated
minimum; nothing sent). A `superseded` operation passes through as
`SUPERSEDED`.
6. On `succeeded`: `capabilities.invalidate()` and a credits re-read;
`creditsReconciled` compares it with the read taken before the POST.

**`createHostedTopupCheckout({ amountCents, returnUrl, signal? })`** —
the hosted route Workshop (`apps/website`) and Platform ship on (`POST
/billing/topup/checkout`, a provider-hosted Checkout session with no
operation; credits land through a webhook). Decodable since the
ingest-types regen #17396 merged:

1. Input validated by the generated `zCreateTopupCheckoutRequest`;
`INVALID_AMOUNT` / `INVALID_RETURN_URL` before anything is sent.
2. The same capability gate, then the pre-purchase balance is read.
3. One idempotency key per attempt, in the body and on the request; 404
→ `NOT_AVAILABLE` so a host keeps its legacy path while
`topup_checkout_enabled` is off.
4. `checkout_url` must be https (`validateActionUrl`, the rule every
lifecycle continuation obeys), otherwise `MALFORMED_RESPONSE`;
`session_id` passes through when present.
5. Nothing is adopted on the lifecycle and no operation id is invented:
the result is `{ url, sessionId?, baselineMicros? }`. The host executes
its `OpenUrlMode` on `url` (Workshop pre-opens a tab, Platform
redirects) and on return arms `createBalanceWatch` with
`baselineMicros`.

`packages/account/src/core/billing/balanceWatch.ts` —
`createBalanceWatch({ credits, baselineMicros? })`, the framework-free
port of `src/composables/billing/topupBalanceRefresh.ts` (gaps `[0, 2,
5, 10, 20]s`, 15-minute lifetime, 5 scheduled runs, a single read per
wake past the cap). No document listeners: the host calls `wake()` from
its own focus/visibility signals. This is the completion path for the
hosted command and the explicit fallback when no `billing_op_id` can be
observed on the in-app one; the SDK never invents one.

Raw server / Stripe text never reaches a result (asserted in the tests).

Contract findings (generated contract wins; for FE-2211's TDD-correction
list):

- The ticket's `returnUrl` and "no `billing_op_id`" rows describe the
hosted route, not `zCreateTopupRequest` (which has only `amount_cents`,
`checkout_attempt_id`, `idempotency_key`). They are served by
`createHostedTopupCheckout`.
- `zCreateTopupResponse.billing_op_id` is required, so the in-app
command's balance-watch fallback is tested against a
`MALFORMED_RESPONSE` on the POST, not an invented id.
- The plan's `credits.read({ forceRefresh })` does not exist:
`CreditsReader.read` always requests, so it is called plainly.
- `amount_cents` is `z.coerce.bigint()` on both request schemas;
validated with `safeParse`, sent as the number.
- `ErrorResponse.code` is `z.string()`, not an enum, so
`NO_PAYMENT_METHOD` is an SDK-owned allowlist entry.

Tests (`topup.test.ts`, `balanceWatch.test.ts`), one per ticket row for
the in-app command: `can_top_up` false, saved payment method, needs 3DS
(driven through PR 0's `driveEmbeddedChallenge`), no payment method,
declined, unexpected error, payment received with credits pending, 404 →
`NOT_AVAILABLE` (and a 404 while polling left to the lifecycle), fresh
idempotency key per attempt, in the body and on the request,
generated-schema rejection, invalidation on success, scope supersession
passthrough, no-`billing_op_id` balance-watch fallback. For the hosted
command: success shape with request body, idempotency key, and no
lifecycle operation; `can_top_up` false without a POST; amount and
return-URL rejection without a request; 404 → `NOT_AVAILABLE`; missing
or non-https URL → `MALFORMED_RESPONSE`; optional session id and
baseline omitted when unknown; baseline handed to a balance watch that
reconciles on return; no server text on the failure path. Reload/resume,
routing, timeout, and duplicate-poll coverage stays in the core suite.

## AS-IS / TO-BE

No UI surface, no screenshots.

- AS-IS: the SDK exposes the lifecycle but no command issues a top-up on
it; the cloud app's `workspaceApi.createTopup` + `topupBalanceRefresh`,
Workshop's `createTopUpCheckout` fetch with a hand-written schema, and
Platform's own call remain the only paths.
- TO-BE: `@comfyorg/account/billing` exports `createTopupCommand`
(in-app and hosted top-up over the generated contract) and
`createBalanceWatch`; each host adapter is a thin wrapper that reads a
coded, text-free result. Consumer cutovers are separate slices
(ComfyUI_frontend: #17665; Workshop and Platform: later).

## Stack (2026-09-15)

Merge top-down. After a parent is squash-merged, rebase each child with
`git rebase --onto origin/main <parent tip>` and force-push; GitHub
retargets the base. Solid edges are code dependencies, dashed edges are
sequencing. The hosted command (formerly #17689) is squashed into this
PR.

```mermaid
flowchart TD
  P12["Phase 1 + 2 merged<br/>#17436 · #17442 · ingest-types regen #17396"] --> C["FE-2227 Phase 3 core<br/>#17655 · base main"]
  C --> P0["PR 0 coded error bodies + 3DS driver<br/>#17656"]
  P0 --> A["FE-2214 top-up commands, in-app + hosted<br/>#17657"]
  P0 --> B1["FE-2223 B1 subscription commands<br/>#17658"]
  B1 --> B2["FE-2223 B2 eight-state projection<br/>#17659"]
  A --> I["Integration, do not merge<br/>#17660"]
  B2 --> I
  I --> V1["FE-2215 @comfyorg/account-ui composables<br/>#17662"]
  V1 --> V2["FE-2215 CheckoutSteps<br/>#17663"]
  I --> SES["core: narrowed BillingSession type<br/>#17664"]
  SES --> AD1["FE-2216 slice 1 top-up behind a flag<br/>#17665"]
  A -.-> WS["Workshop adapter over createHostedTopupCheckout<br/>consumer slice"]
  AD1 -.-> AD2["FE-2216 slice 2 subscription<br/>needs previewSubscribe (FE-2331)"]
  AD1 --> E["FE-2217 Phase 6 evidence"]
  BW["billing-web #17370 → #17574"] --> H["FE-2218 Phase 7 separate origin"]
  AD1 --> H
  V2 -.-> H
  H --> H8["FE-2331 Phase 8 hosted surfaces"]
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:high PR risk grade (advisory shadow check; grader-owned)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant