Repository navigation
FE-3117 feat(billing-web): report the cancel flow's intent, abandoned and failed stages - #19945
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: Comfy-Org/ComfyUI_frontend/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
📦 Bundle Size
🌾 Fallow: ✅ PassedFallow audits the diff for duplication, complexity and dead code. It gates on new findings only, so when the audit completes, a red is something this PR introduced or moved — never inherited backlog. A red can also mean the audit itself did not finish; the details below say which happened. No new findings in the changed files. Reproduce locally# the base the gate compared against
npx fallow audit --root . --quiet --format json \
--changed-since e1ba9553940b6e975c503d10670bd9f6cd3b5e02
Full docs: ADR-DEVEX-LINT-0015 🧩 Custom Nodes Ecosystem Matrix: 🟡 Withheld — could not measureExecutes the frontend JS of every registry pack that ships any, against this change, in both renderers. The eight This candidate changes nothing the matrix measures, so every expensive stage was skipped. Reproduce locally# build one shard's fixture, then run it
python3 scripts/registry-census/build_matrix.py --shard 1/4
MATRIX_RENDERER=vue MATRIX_VUE=1 \
npx vitest run --config vitest.matrix.config.mts
Full docs: scripts/registry-census/README.md |
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## jaewon/fe-3115-cloud-entry-fidelity-and-datadog-parity-paywall-add-credits #19945 +/- ##
==============================================================================================================
+ Coverage 84.83% 85.66% +0.83%
==============================================================================================================
Files 3434 2501 -933
Lines 164556 140261 -24295
Branches 43195 36352 -6843
==============================================================================================================
- Hits 139603 120160 -19443
+ Misses 22998 19591 -3407
+ Partials 1955 510 -1445
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 941 files with indirect coverage changes 🚀 New features to boost your workflow:
|
🔧 Auto-fixes AppliedThis PR has been automatically updated to fix linting and formatting issues.
Changes made:
|
christian-byrne
left a comment
There was a problem hiding this comment.
Reviewed the exact head. The implementation and focused coverage match the stated contract; CI is settled green and no current review threads remain.
a7fa732
into
jaewon/fe-3115-cloud-entry-fidelity-and-datadog-parity-paywall-add-credits
…g screen (#19948) ## Summary Report an abandoned checkout and the ending screen on the billing web full-page checkout, and send the abandon to PostHog by beacon (E24, E25). ## Why customer_abandoned is the largest failure class on the backend, and the browser had no event for a customer who closes the tab or goes back with an unresolved checkout. The ending screen the customer saw was not reported either, so a funnel could not tell a success screen from a refusal. ## How The shared journey contract gains two phases, billing.checkout.abandoned (last_phase, exit) and billing.checkout.ended (ending_kind, attribution), as union lines in checkoutJourney.ts with their payload fields. They carry the journey context, so they join entered and operation_linked on checkout_journey_id and billing_op_id. useCheckoutJourney remembers the last progress phase, reports each new ending kind once, and reports abandoned once, only before any ending. The full-page checkout reports ended from its existing endingOf screen and terminal attribution. It reports abandoned with exit page_exit on pagehide, and with exit back from the Back control. It reports no abandon when the page handed itself to a hosted step or a method's own site. The billing web telemetry facade sends abandoned to PostHog with transport sendBeacon. PostHog drains its queue on its own pagehide listener, which runs before ours, so a plain capture there would be queued and lost. There is no user-visible change. ## Review Focus - Flush check: Datadog RUM 6.33 flushes by sendBeacon on visibilitychange hidden, freeze and beforeunload. It has no pagehide listener, but the browser fires visibilitychange after pagehide on unload, so an action added in pagehide is sent. PostHog 1.402 drains by beacon on pagehide, so only an event captured inside pagehide needs the sendBeacon option. - leftForPayment: a redirect to a hosted step or a non-card method's site is a redirect_started, not an abandon. - Existing journey tests now expect billing.checkout.ended after a preview failure and after a success. - Known gaps: the embedded billing web CheckoutView reports neither phase. The cloud app reports no abandoned event, because its journey is kept in session storage across dialogs and reloads, and whether a dialog close ends it needs a product decision. A tab closed while already in the background may not flush its RUM action, because visibilitychange already fired; the derived count of starts without terminals covers it (D8). ## AS IS / TO BE Telemetry change, so the evidence is the captured events instead of a screenshot: the real SDK lifecycle and the billing web checkout with only the network edge and the telemetry SDKs (Datadog RUM, posthog-js) stubbed. AS IS = origin/main, TO BE = this stack. | Path | AS IS | TO BE | | --- | --- | --- | | E24 tab closed at the quote | `entered`, `preview_ready` | adds `abandoned` (last_phase preview_ready, exit page_exit); PostHog copy sent with `{transport: 'sendBeacon'}` | | E24 Back control | `entered`, `preview_ready`, `web_return.clicked` | adds `abandoned` (exit back), once, even though the page then unloads | | E24 Alipay Pay leaving for its own site | no abandon | still no abandon (it is a redirect) | | E25 own payment succeeds | no ending event | `ended` (ending_kind success, attribution started); no abandon when the tab closes after it | | E25 refused workspace | no ending event | `ended` (ending_kind refused), no attribution | No payload carries an email, URL, client secret, promo code or provider id; every new field is a bounded enum. evidence-fe3119/as-is-billing-web.json shows the tab-close, Back, success and refusal paths with no abandoned or ended event on main, and to-be-billing-web.json shows abandoned with last_phase and exit to RUM and to PostHog with transport sendBeacon, ended with ending_kind and attribution, and no abandon for an Alipay Pay that left for its own site. ## Where this sits in the plan Linear: [FE-3119](https://linear.app/comfyorg/issue/FE-3119), part of [FE-3105](https://linear.app/comfyorg/issue/FE-3105/billing-web-and-sdk-rollout-telemetry-events-fixes-and-dashboards). Plan, event catalog and dependency graph: [action items](https://app.notion.com/p/3ea6d73d3650814ba248d4d1431b8a89). | Task | Ticket | What | Status | | --- | --- | --- | --- | | T1 | FE-3107 | Decide vocabulary and dimensions | done, in the SSOT | | T2 | FE-3108 | Decide RUM application and env mapping | decided | | T3 | FE-3109 | Billing web telemetry bootstrap (RUM and PostHog) | [PR 19688](#19688), merged | | T3+ | FE-3156 | Opaque RUM user id on billing web | [PR 19794](#19794), merged | | T4, F1 | FE-3106 | SDK-rail ownership | [PR 19620](#19620), merged | | T4, F2 | FE-3110 | Keep operation id and fields in the mapper | [PR 19623](#19623), merged | | T4, F3 | FE-3111 | Stamp billing_surface and billing_client | [PR 19685](#19685), merged | | T4, F5 | FE-3112 | SDK top-up terminals | [PR 19628](#19628), merged | | T4, F6 | FE-3113 | Downgrade reconciliation terminal | [PR 19622](#19622), merged | | T4, F7 | FE-3114 | Legacy personal-rail events, first slice | [PR 19627](#19627), merged | | T4, F7+ | FE-3131 | Legacy personal-rail events, remaining slices | [PR 19686](#19686), merged | | T4+ | FE-3140 | Move the billing event contract to a shared package | [PR 19798](#19798), merged | | T5 | FE-3115 | Cloud entry fidelity and Datadog parity | [PR 19815](#19815) (four parts), in review | | T6 | FE-3116 | Handoff contract and event | [PR 19687](#19687), merged | | T7 | FE-3117 | Billing web attempt lifecycle | [PR 19809](#19809), [PR 19810](#19810), [PR 19811](#19811) merged, billing web cancel [PR 19945](#19945) in review | | T8 | FE-3118 | Billing web journey and choices | [PR 19819](#19819) (three parts), merged | | T9 | FE-3119 | Payment friction events | this PR | | T10 | FE-3120 | Billing web entry, session and return | [PR 19804](#19804), [PR 19806](#19806) and [PR 19807](#19807), merged in [PR 19798](#19798) | | T11 | FE-3121 | Portal events | [PR 19944](#19944), in review | | T12 | FE-3122 | Flag coverage check | [PR 19942](#19942), in review | | T13 | FE-3123 | PostHog rollout dashboard | specified, blocked on PostHog key scopes | | T14 | FE-3124 | Datadog tiles in the Frontend RUM dashboard | [comfy-infra PR 1597](Comfy-Org/comfy-infra#1597), in review | | T4+ | FE-3162 | Move the payload-helper tests to account-core | [PR 19940](#19940), in review | | T10+ | FE-3158 | Billing web Try again after session creation fails | [PR 19941](#19941), in review | | T15 | FE-3125 | Verification per flow | todo | | T16 | FE-3126 | Rollout plan | todo | ```mermaid flowchart LR subgraph DEC["Decided"] T1["FE-3107 T1 vocabulary"] T2["FE-3108 T2 RUM app and env"] end subgraph FIX["Existing events (T4)"] F1["FE-3106 F1 SDK-rail ownership"] F2["FE-3110 F2 mapper fields"] F3["FE-3111 F3 surface and client"] F5["FE-3112 F5 top-up terminals"] F6["FE-3113 F6 downgrade terminal"] F7["FE-3114 F7 legacy personal, first slice"] F7B["FE-3131 F7 remaining slices"] C140["FE-3140 event contract to shared package"] end subgraph EMIT["New events"] T3["FE-3109 T3 billing web bootstrap"] T3b["FE-3156 T3+ opaque RUM user id"] T5["FE-3115 T5 cloud entry and parity"] T6["FE-3116 T6 handoff contract"] T7["FE-3117 T7 attempt lifecycle"] T8["FE-3118 T8 journey and choices"] T9["FE-3119 T9 friction"] T10["FE-3120 T10 entry, session, return"] T11["FE-3121 T11 portal"] T12["FE-3122 T12 flag coverage"] end subgraph DASH["Dashboards"] T13["FE-3123 T13 PostHog rollout"] T14["FE-3124 T14 Frontend RUM tiles"] end T15["FE-3125 T15 verification"] T16["FE-3126 T16 rollout plan"] T2 --> T3 T3 --> T3b F3 --> C140 T3 --> C140 C140 --> T7 C140 --> T8 C140 --> T10 C140 --> T11 T1 --> F3 T1 --> T5 T1 --> T6 T1 --> T13 T1 --> T14 T2 --> T14 F2 --> T7 T3 --> T7 T3 --> T8 T3 --> T10 T3 --> T11 T3 --> T12 T5 --> T11 T6 --> T8 T6 --> T10 T7 --> T9 T8 --> T9 F1 --> T13 F3 --> T13 FIX --> T15 T5 --> T15 T9 --> T15 T10 --> T15 T11 --> T15 T12 --> T15 T13 --> T15 T14 --> T15 T13 --> T16 T15 --> T16 style T9 stroke-width:3px ```
…nside a billing operation (Comfy-Org#19946) ## Summary Report 3DS challenges and retryable declines inside one billing operation, from the SDK lifecycle, on the cloud app and billing web (E22). ## Why The backend files most failed subscribes as customer_abandoned or expected payment failures, and the browser reported none of the friction behind them. The SDK already tracked the challenge, but the driver's verdict was thrown away and a retryable decline left no trace until the operation ended. ## Root cause usePaymentAttempt and the cloud SDK store call driveEmbeddedChallenge with void, and the lifecycle only emitted billing.operation.* for start and terminal. A pending operation could move through a challenge, its verdict and several declines without one event. ## How A new contract module checkoutChallengeEvent.ts adds billing.checkout.challenge_required, challenge_completed and challenge_failed to the BillingTelemetryEvent union (one line). All stages stay pending, so they never count as terminals. A pure function paymentFrictionBetween compares two states of one pending operation, and the lifecycle runs it on every transition and at adoption. challenge_required fires once per new client secret. challenge_completed and challenge_failed fire on this tab's driver verdict. Each new retryable decline reason fires challenge_failed with decline_reason, except the server's echo of a challenge this tab already saw fail. toBillingTelemetryEvent maps the three onto operation checkout. Billing web forwards them through the existing onTelemetry wiring. The cloud store forwards them for every operation, including an issued top-up whose start and terminal the dialog reports. Fields are decline_reason, presentation, operation_type, billing_op_id and resumed, all already in the allowlist. There is no user-visible change. ## Review Focus - paymentFrictionBetween: one required per client secret, no second required when a failed challenge returns from the hosted page, and the echo rule for a decline after a failed challenge. - The cloud reportTelemetry change: friction events skip the top-up and caller-started filters on purpose. - challenge_failed carries decline_reason only for a server decline. Without it, it is this tab's own verdict. - Known gap: the legacy cloud rail (billingOperationStore and the legacy subscribe path) reports no friction. Only the SDK rail does. ## AS IS / TO BE Telemetry change, so the evidence is the captured events instead of a screenshot: the real SDK lifecycle and the billing web checkout with only the network edge and the telemetry SDKs (Datadog RUM, posthog-js) stubbed. AS IS = origin/main, TO BE = this stack. | Path | AS IS | TO BE | | --- | --- | --- | | E22 embedded 3DS challenge completed / failed | `billing.operation.started` only | adds `billing.checkout.challenge_required`, then `challenge_completed` or `challenge_failed` (presentation embedded) | | E22 retryable declines in one hosted operation | `billing.operation.started` only | `challenge_failed` with `decline_reason: card_declined`, then `insufficient_funds` (presentation hosted) | | E22 billing web SDK, real client | `billing.operation.started` only | adds `challenge_failed` with `decline_reason`, to RUM and PostHog, `billing_surface: billing_web` | No payload carries an email, URL, client secret, promo code or provider id; every new field is a bounded enum. evidence-fe3119/as-is-lifecycle.json and to-be-lifecycle.json show the same embedded challenge and hosted decline scenarios emitting only billing.operation.started on main and the challenge events with presentation and decline_reason on the branch, for both cloud_app and billing_web payloads, and to-be-billing-web.json shows the billing web SDK sending challenge_failed with decline_reason to RUM and PostHog. ## Where this sits in the plan Linear: [FE-3119](https://linear.app/comfyorg/issue/FE-3119), part of [FE-3105](https://linear.app/comfyorg/issue/FE-3105/billing-web-and-sdk-rollout-telemetry-events-fixes-and-dashboards). Plan, event catalog and dependency graph: [action items](https://app.notion.com/p/3ea6d73d3650814ba248d4d1431b8a89). | Task | Ticket | What | Status | | --- | --- | --- | --- | | T1 | FE-3107 | Decide vocabulary and dimensions | done, in the SSOT | | T2 | FE-3108 | Decide RUM application and env mapping | decided | | T3 | FE-3109 | Billing web telemetry bootstrap (RUM and PostHog) | [PR 19688](Comfy-Org#19688), merged | | T3+ | FE-3156 | Opaque RUM user id on billing web | [PR 19794](Comfy-Org#19794), merged | | T4, F1 | FE-3106 | SDK-rail ownership | [PR 19620](Comfy-Org#19620), merged | | T4, F2 | FE-3110 | Keep operation id and fields in the mapper | [PR 19623](Comfy-Org#19623), merged | | T4, F3 | FE-3111 | Stamp billing_surface and billing_client | [PR 19685](Comfy-Org#19685), merged | | T4, F5 | FE-3112 | SDK top-up terminals | [PR 19628](Comfy-Org#19628), merged | | T4, F6 | FE-3113 | Downgrade reconciliation terminal | [PR 19622](Comfy-Org#19622), merged | | T4, F7 | FE-3114 | Legacy personal-rail events, first slice | [PR 19627](Comfy-Org#19627), merged | | T4, F7+ | FE-3131 | Legacy personal-rail events, remaining slices | [PR 19686](Comfy-Org#19686), merged | | T4+ | FE-3140 | Move the billing event contract to a shared package | [PR 19798](Comfy-Org#19798), merged | | T5 | FE-3115 | Cloud entry fidelity and Datadog parity | [PR 19815](Comfy-Org#19815) (four parts), in review | | T6 | FE-3116 | Handoff contract and event | [PR 19687](Comfy-Org#19687), merged | | T7 | FE-3117 | Billing web attempt lifecycle | [PR 19809](Comfy-Org#19809), [PR 19810](Comfy-Org#19810), [PR 19811](Comfy-Org#19811) merged, billing web cancel [PR 19945](Comfy-Org#19945) in review | | T8 | FE-3118 | Billing web journey and choices | [PR 19819](Comfy-Org#19819) (three parts), merged | | T9 | FE-3119 | Payment friction events | this PR | | T10 | FE-3120 | Billing web entry, session and return | [PR 19804](Comfy-Org#19804), [PR 19806](Comfy-Org#19806) and [PR 19807](Comfy-Org#19807), merged in [PR 19798](Comfy-Org#19798) | | T11 | FE-3121 | Portal events | [PR 19944](Comfy-Org#19944), in review | | T12 | FE-3122 | Flag coverage check | [PR 19942](Comfy-Org#19942), in review | | T13 | FE-3123 | PostHog rollout dashboard | specified, blocked on PostHog key scopes | | T14 | FE-3124 | Datadog tiles in the Frontend RUM dashboard | [comfy-infra PR 1597](Comfy-Org/comfy-infra#1597), in review | | T4+ | FE-3162 | Move the payload-helper tests to account-core | [PR 19940](Comfy-Org#19940), in review | | T10+ | FE-3158 | Billing web Try again after session creation fails | [PR 19941](Comfy-Org#19941), in review | | T15 | FE-3125 | Verification per flow | todo | | T16 | FE-3126 | Rollout plan | todo | ```mermaid flowchart LR subgraph DEC["Decided"] T1["FE-3107 T1 vocabulary"] T2["FE-3108 T2 RUM app and env"] end subgraph FIX["Existing events (T4)"] F1["FE-3106 F1 SDK-rail ownership"] F2["FE-3110 F2 mapper fields"] F3["FE-3111 F3 surface and client"] F5["FE-3112 F5 top-up terminals"] F6["FE-3113 F6 downgrade terminal"] F7["FE-3114 F7 legacy personal, first slice"] F7B["FE-3131 F7 remaining slices"] C140["FE-3140 event contract to shared package"] end subgraph EMIT["New events"] T3["FE-3109 T3 billing web bootstrap"] T3b["FE-3156 T3+ opaque RUM user id"] T5["FE-3115 T5 cloud entry and parity"] T6["FE-3116 T6 handoff contract"] T7["FE-3117 T7 attempt lifecycle"] T8["FE-3118 T8 journey and choices"] T9["FE-3119 T9 friction"] T10["FE-3120 T10 entry, session, return"] T11["FE-3121 T11 portal"] T12["FE-3122 T12 flag coverage"] end subgraph DASH["Dashboards"] T13["FE-3123 T13 PostHog rollout"] T14["FE-3124 T14 Frontend RUM tiles"] end T15["FE-3125 T15 verification"] T16["FE-3126 T16 rollout plan"] T2 --> T3 T3 --> T3b F3 --> C140 T3 --> C140 C140 --> T7 C140 --> T8 C140 --> T10 C140 --> T11 T1 --> F3 T1 --> T5 T1 --> T6 T1 --> T13 T1 --> T14 T2 --> T14 F2 --> T7 T3 --> T7 T3 --> T8 T3 --> T10 T3 --> T11 T3 --> T12 T5 --> T11 T6 --> T8 T6 --> T10 T7 --> T9 T8 --> T9 F1 --> T13 F3 --> T13 FIX --> T15 T5 --> T15 T9 --> T15 T10 --> T15 T11 --> T15 T12 --> T15 T13 --> T15 T14 --> T15 T13 --> T16 T15 --> T16 style T9 stroke-width:3px ```
… it (Comfy-Org#19947) ## Summary Report a hosted step the customer is sent to and the return from it, on the cloud app and billing web (E23). ## Why A hosted redirect unloads the page, so the operation's start stayed open with nothing to say the customer left for Stripe or the billing app. Without a start and a return, a customer who never came back looks the same as one the browser lost. ## How A new contract module checkoutRedirectEvent.ts adds billing.checkout.redirect_started and billing.checkout.returned (one union line). Fields are destination (stripe or billing_web), step (authentication, payment_method, invoice_payment or checkout, read from what the server waits on), navigation (redirect or new_tab) and optional method_kind. destination, step, navigation and method_kind join the allowlist. The lifecycle gains reportHostedStepOpened(operationId, navigation, methodKind?). It emits redirect_started. For a redirect it stores the step in the operation pointer, so the page the customer lands on reports returned once when it recovers the operation. Rewriting the pointer drops the marker, so a reload does not count it again. For a new tab it reports returned on the next wake. usePaymentAttempt reports the hosted step before it hands the URL to the host, so the event is queued before the page unloads. It also reports an embedded challenge as a redirect when the host says the method is not a card, because Stripe finishes Alipay and similar methods on their own site. The billing web full-page checkout passes the method of its own Pay. The cloud SDK store reports a hosted page it opened in a new tab. There is no user-visible change. ## Review Focus - The redirect marker in the operation pointer schema, and that adoption rewrites the pointer without it. - Reporting before openUrl is deliberate. Datadog RUM flushes on beforeunload and visibilitychange, and PostHog drains its queue by beacon on pagehide, so an event queued before location.assign is sent. - The off-site challenge rule in usePaymentAttempt: a required challenge plus a non-card method kind is reported as a redirect. - BillingOperationTelemetryEvent is now a discriminated union, so a redirect event cannot be built without destination, step and navigation. - Known gaps: method_kind is only known for a non-card Pay on the billing web full-page checkout. The legacy cloud subscribe path that calls window.open directly is not covered. A return after a same-tab redirect that lands on a page with no pointer storage is not reported. ## AS IS / TO BE Telemetry change, so the evidence is the captured events instead of a screenshot: the real SDK lifecycle and the billing web checkout with only the network edge and the telemetry SDKs (Datadog RUM, posthog-js) stubbed. AS IS = origin/main, TO BE = this stack. | Path | AS IS | TO BE | | --- | --- | --- | | E23 same-tab redirect | page that left: `started`; page it came back to: `started`, `succeeded` | left: `redirect_started` (destination stripe, step payment_method, navigation redirect, method_kind alipay); came back: `returned` with the same fields, `resumed: true` | | E23 new tab | `started` only | `redirect_started` then `returned` on the next wake (navigation new_tab) | No payload carries an email, URL, client secret, promo code or provider id; every new field is a bounded enum. evidence-fe3119/as-is-lifecycle.json shows the redirect and new-tab scenarios sending only billing.operation.started and succeeded on main, and to-be-lifecycle.json shows redirect_started on the page that left, returned with the same step and method on the page it came back to, and the new-tab pair, for both surfaces. ## Where this sits in the plan Linear: [FE-3119](https://linear.app/comfyorg/issue/FE-3119), part of [FE-3105](https://linear.app/comfyorg/issue/FE-3105/billing-web-and-sdk-rollout-telemetry-events-fixes-and-dashboards). Plan, event catalog and dependency graph: [action items](https://app.notion.com/p/3ea6d73d3650814ba248d4d1431b8a89). | Task | Ticket | What | Status | | --- | --- | --- | --- | | T1 | FE-3107 | Decide vocabulary and dimensions | done, in the SSOT | | T2 | FE-3108 | Decide RUM application and env mapping | decided | | T3 | FE-3109 | Billing web telemetry bootstrap (RUM and PostHog) | [PR 19688](Comfy-Org#19688), merged | | T3+ | FE-3156 | Opaque RUM user id on billing web | [PR 19794](Comfy-Org#19794), merged | | T4, F1 | FE-3106 | SDK-rail ownership | [PR 19620](Comfy-Org#19620), merged | | T4, F2 | FE-3110 | Keep operation id and fields in the mapper | [PR 19623](Comfy-Org#19623), merged | | T4, F3 | FE-3111 | Stamp billing_surface and billing_client | [PR 19685](Comfy-Org#19685), merged | | T4, F5 | FE-3112 | SDK top-up terminals | [PR 19628](Comfy-Org#19628), merged | | T4, F6 | FE-3113 | Downgrade reconciliation terminal | [PR 19622](Comfy-Org#19622), merged | | T4, F7 | FE-3114 | Legacy personal-rail events, first slice | [PR 19627](Comfy-Org#19627), merged | | T4, F7+ | FE-3131 | Legacy personal-rail events, remaining slices | [PR 19686](Comfy-Org#19686), merged | | T4+ | FE-3140 | Move the billing event contract to a shared package | [PR 19798](Comfy-Org#19798), merged | | T5 | FE-3115 | Cloud entry fidelity and Datadog parity | [PR 19815](Comfy-Org#19815) (four parts), in review | | T6 | FE-3116 | Handoff contract and event | [PR 19687](Comfy-Org#19687), merged | | T7 | FE-3117 | Billing web attempt lifecycle | [PR 19809](Comfy-Org#19809), [PR 19810](Comfy-Org#19810), [PR 19811](Comfy-Org#19811) merged, billing web cancel [PR 19945](Comfy-Org#19945) in review | | T8 | FE-3118 | Billing web journey and choices | [PR 19819](Comfy-Org#19819) (three parts), merged | | T9 | FE-3119 | Payment friction events | this PR | | T10 | FE-3120 | Billing web entry, session and return | [PR 19804](Comfy-Org#19804), [PR 19806](Comfy-Org#19806) and [PR 19807](Comfy-Org#19807), merged in [PR 19798](Comfy-Org#19798) | | T11 | FE-3121 | Portal events | [PR 19944](Comfy-Org#19944), in review | | T12 | FE-3122 | Flag coverage check | [PR 19942](Comfy-Org#19942), in review | | T13 | FE-3123 | PostHog rollout dashboard | specified, blocked on PostHog key scopes | | T14 | FE-3124 | Datadog tiles in the Frontend RUM dashboard | [comfy-infra PR 1597](Comfy-Org/comfy-infra#1597), in review | | T4+ | FE-3162 | Move the payload-helper tests to account-core | [PR 19940](Comfy-Org#19940), in review | | T10+ | FE-3158 | Billing web Try again after session creation fails | [PR 19941](Comfy-Org#19941), in review | | T15 | FE-3125 | Verification per flow | todo | | T16 | FE-3126 | Rollout plan | todo | ```mermaid flowchart LR subgraph DEC["Decided"] T1["FE-3107 T1 vocabulary"] T2["FE-3108 T2 RUM app and env"] end subgraph FIX["Existing events (T4)"] F1["FE-3106 F1 SDK-rail ownership"] F2["FE-3110 F2 mapper fields"] F3["FE-3111 F3 surface and client"] F5["FE-3112 F5 top-up terminals"] F6["FE-3113 F6 downgrade terminal"] F7["FE-3114 F7 legacy personal, first slice"] F7B["FE-3131 F7 remaining slices"] C140["FE-3140 event contract to shared package"] end subgraph EMIT["New events"] T3["FE-3109 T3 billing web bootstrap"] T3b["FE-3156 T3+ opaque RUM user id"] T5["FE-3115 T5 cloud entry and parity"] T6["FE-3116 T6 handoff contract"] T7["FE-3117 T7 attempt lifecycle"] T8["FE-3118 T8 journey and choices"] T9["FE-3119 T9 friction"] T10["FE-3120 T10 entry, session, return"] T11["FE-3121 T11 portal"] T12["FE-3122 T12 flag coverage"] end subgraph DASH["Dashboards"] T13["FE-3123 T13 PostHog rollout"] T14["FE-3124 T14 Frontend RUM tiles"] end T15["FE-3125 T15 verification"] T16["FE-3126 T16 rollout plan"] T2 --> T3 T3 --> T3b F3 --> C140 T3 --> C140 C140 --> T7 C140 --> T8 C140 --> T10 C140 --> T11 T1 --> F3 T1 --> T5 T1 --> T6 T1 --> T13 T1 --> T14 T2 --> T14 F2 --> T7 T3 --> T7 T3 --> T8 T3 --> T10 T3 --> T11 T3 --> T12 T5 --> T11 T6 --> T8 T6 --> T10 T7 --> T9 T8 --> T9 F1 --> T13 F3 --> T13 FIX --> T15 T5 --> T15 T9 --> T15 T10 --> T15 T11 --> T15 T12 --> T15 T13 --> T15 T14 --> T15 T13 --> T16 T15 --> T16 style T9 stroke-width:3px ```
…ilures and returns (Comfy-Org#19973) ## Summary The payment recovery portal that checkout opens after a failed or outstanding payment now reports billing.portal.opened, billing.portal.failed and billing.portal.returned with the new target payment_recovery. ## Why FE-3121 instrumented Manage subscription, Invoice history and the billing web portal, but left out the portal that useSubscriptionCheckout opens when a plan change is refused for an unpaid invoice. That trip is the only way a customer in payment_failed or paused can get unstuck, and it reached error reporting only on failure and nothing at all on success. The Datadog Billing UI tab and the PostHog rollout dashboard could not count it. ## How recoverOutstandingPayment now uses createBillingPortalReporter, the same reporter as the other cloud portal entries. readPaymentPortalUrl returns which client served the URL, so opened, failed and returned carry billing_client sdk or legacy once that is known. A thrown request failure omits billing_client, as the workspace Manage subscription path does. A blocked tab is failed with redirect and payment_popup_blocked. When the toast's Try again then opens the tab, that click is the open and waits for one return. A URL that fails the origin check is failed with unknown. The contract gains one bounded value, payment_recovery, in BillingPortalTarget. None of the existing values fits: payment_methods is the voluntary card management panel on billing web, and folding recovery into it would hide how often checkout blocks on an unpaid invoice. target is already allowlisted as a required payload field, so the allowlist needs no new key. There is no user-visible change. Toasts, the Try again action, the return refresh and the reportError calls are unchanged. ## Review Focus - billing_client is set only after the URL came back. A rail error or a refused workspace request omits it, matching useWorkspaceBilling; a URL rejected by the origin check keeps it. - The toast's Try again now checks the window.open result to report opened or blocked. It still arms the return refresh either way, as before. - A stale attempt (isCurrent false) reports nothing, the same way it shows nothing. - payment_recovery is a new BillingPortalTarget value. Dashboards that list portal targets need the fourth value (T13 PostHog, T14 Datadog tiles). - Comfy-Org#19921 is untouched: the WORKSPACE_BILLING_REQUIRED rethrow lives in useSubscription, not in this path. ## AS IS / TO BE Captured through the real telemetry providers in the component and composable tests (Datadog RUM action and PostHog event carry identical payloads, `billing_surface` per host). AS IS = base branch, TO BE = this branch. | Path | Host | AS IS | TO BE | | --- | --- | --- | --- | | reports the recovery portal opening from the legacy client and one return | cloud_app | nothing | `billing.portal.opened` (target: payment_recovery, billing_client: legacy)<br>`billing.portal.returned` (target: payment_recovery, billing_client: legacy) | | reports the recovery portal opening from the SDK rail and one return | cloud_app | nothing | `billing.portal.opened` (target: payment_recovery, billing_client: sdk)<br>`billing.portal.returned` (target: payment_recovery, billing_client: sdk) | | reports the recovery portal opening from the legacy client when the rail route i… and one return | cloud_app | nothing | `billing.portal.opened` (target: payment_recovery, billing_client: legacy)<br>`billing.portal.returned` (target: payment_recovery, billing_client: legacy) | | reports a blocked recovery tab as a failed open and the retry as the open | cloud_app | nothing | `billing.portal.failed` (target: payment_recovery, billing_client: legacy, failure_category: redirect, error_code: payment_popup_blocked)<br>`billing.portal.opened` (target: payment_recovery, billing_client: legacy)<br>`billing.portal.returned` (target: payment_recovery, billing_client: legacy) | | reports a refused legacy portal request as a failed open and keeps the error report | cloud_app | nothing | `billing.portal.failed` (target: payment_recovery, failure_category: api_rejected) | | reports a legacy portal request that never reac… as a failed open and keeps the error report | cloud_app | nothing | `billing.portal.failed` (target: payment_recovery, failure_category: network) | | reports a rail portal failure as a failed open and keeps the error report | cloud_app | nothing | `billing.portal.failed` (target: payment_recovery, failure_category: api_rejected) | | reports a portal address that fails validation as a failed open and keeps the error report | cloud_app | nothing | `billing.portal.failed` (target: payment_recovery, billing_client: legacy, failure_category: unknown) | | reports nothing when the rejection needs no payment recovery | cloud_app | nothing | nothing | Captured RUM actions and PostHog events for each recovery path show nothing on the FE-3115 base and the matching billing.portal.* event with target payment_recovery, client and failure category on this branch, with identical reportError calls (evidence-fe3121-recovery/). ## Where this sits in the plan Linear: [FE-3121](https://linear.app/comfyorg/issue/FE-3121), part of [FE-3105](https://linear.app/comfyorg/issue/FE-3105/billing-web-and-sdk-rollout-telemetry-events-fixes-and-dashboards). Plan, event catalog and dependency graph: [action items](https://app.notion.com/p/3ea6d73d3650814ba248d4d1431b8a89). | Task | Ticket | What | Status | | --- | --- | --- | --- | | T1 | FE-3107 | Decide vocabulary and dimensions | done, in the SSOT | | T2 | FE-3108 | Decide RUM application and env mapping | decided | | T3 | FE-3109 | Billing web telemetry bootstrap (RUM and PostHog) | [PR 19688](Comfy-Org#19688), merged | | T3+ | FE-3156 | Opaque RUM user id on billing web | [PR 19794](Comfy-Org#19794), merged | | T4, F1 | FE-3106 | SDK-rail ownership | [PR 19620](Comfy-Org#19620), merged | | T4, F2 | FE-3110 | Keep operation id and fields in the mapper | [PR 19623](Comfy-Org#19623), merged | | T4, F3 | FE-3111 | Stamp billing_surface and billing_client | [PR 19685](Comfy-Org#19685), merged | | T4, F5 | FE-3112 | SDK top-up terminals | [PR 19628](Comfy-Org#19628), merged | | T4, F6 | FE-3113 | Downgrade reconciliation terminal | [PR 19622](Comfy-Org#19622), merged | | T4, F7 | FE-3114 | Legacy personal-rail events, first slice | [PR 19627](Comfy-Org#19627), merged | | T4, F7+ | FE-3131 | Legacy personal-rail events, remaining slices | [PR 19686](Comfy-Org#19686), merged | | T4+ | FE-3140 | Move the billing event contract to a shared package | [PR 19798](Comfy-Org#19798), merged | | T5 | FE-3115 | Cloud entry fidelity and Datadog parity | [PR 19815](Comfy-Org#19815) (four parts), in review | | T6 | FE-3116 | Handoff contract and event | [PR 19687](Comfy-Org#19687), merged | | T7 | FE-3117 | Billing web attempt lifecycle | [PR 19809](Comfy-Org#19809), [PR 19810](Comfy-Org#19810), [PR 19811](Comfy-Org#19811) merged, billing web cancel [PR 19945](Comfy-Org#19945) in review | | T8 | FE-3118 | Billing web journey and choices | [PR 19819](Comfy-Org#19819) (three parts), merged | | T9 | FE-3119 | Payment friction events | [PR 19946](Comfy-Org#19946), [PR 19947](Comfy-Org#19947), [PR 19948](Comfy-Org#19948), in review | | T10 | FE-3120 | Billing web entry, session and return | [PR 19804](Comfy-Org#19804), [PR 19806](Comfy-Org#19806) and [PR 19807](Comfy-Org#19807), merged in [PR 19798](Comfy-Org#19798) | | T11 | FE-3121 | Portal events | this PR | | T12 | FE-3122 | Flag coverage check | [PR 19942](Comfy-Org#19942), in review | | T13 | FE-3123 | PostHog rollout dashboard | [first cut](https://us.posthog.com/project/204330/dashboard/2164447) created | | T14 | FE-3124 | Datadog tiles in the Frontend RUM dashboard | [comfy-infra PR 1597](Comfy-Org/comfy-infra#1597), in review | | T4+ | FE-3162 | Move the payload-helper tests to account-core | [PR 19940](Comfy-Org#19940), in review | | T10+ | FE-3158 | Billing web Try again after session creation fails | [PR 19941](Comfy-Org#19941), in review | | T15 | FE-3125 | Verification per flow | todo | | T16 | FE-3126 | Rollout plan | todo | ```mermaid flowchart LR subgraph DEC["Decided"] T1["FE-3107 T1 vocabulary"] T2["FE-3108 T2 RUM app and env"] end subgraph FIX["Existing events (T4)"] F1["FE-3106 F1 SDK-rail ownership"] F2["FE-3110 F2 mapper fields"] F3["FE-3111 F3 surface and client"] F5["FE-3112 F5 top-up terminals"] F6["FE-3113 F6 downgrade terminal"] F7["FE-3114 F7 legacy personal, first slice"] F7B["FE-3131 F7 remaining slices"] C140["FE-3140 event contract to shared package"] end subgraph EMIT["New events"] T3["FE-3109 T3 billing web bootstrap"] T3b["FE-3156 T3+ opaque RUM user id"] T5["FE-3115 T5 cloud entry and parity"] T6["FE-3116 T6 handoff contract"] T7["FE-3117 T7 attempt lifecycle"] T8["FE-3118 T8 journey and choices"] T9["FE-3119 T9 friction"] T10["FE-3120 T10 entry, session, return"] T11["FE-3121 T11 portal"] T12["FE-3122 T12 flag coverage"] end subgraph DASH["Dashboards"] T13["FE-3123 T13 PostHog rollout"] T14["FE-3124 T14 Frontend RUM tiles"] end T15["FE-3125 T15 verification"] T16["FE-3126 T16 rollout plan"] T2 --> T3 T3 --> T3b F3 --> C140 T3 --> C140 C140 --> T7 C140 --> T8 C140 --> T10 C140 --> T11 T1 --> F3 T1 --> T5 T1 --> T6 T1 --> T13 T1 --> T14 T2 --> T14 F2 --> T7 T3 --> T7 T3 --> T8 T3 --> T10 T3 --> T11 T3 --> T12 T5 --> T11 T6 --> T8 T6 --> T10 T7 --> T9 T8 --> T9 F1 --> T13 F3 --> T13 FIX --> T15 T5 --> T15 T9 --> T15 T10 --> T15 T11 --> T15 T12 --> T15 T13 --> T15 T14 --> T15 T13 --> T16 T15 --> T16 style T11 stroke-width:3px ``` --------- Co-authored-by: GitHub Action <action@github.com>
…urney with no operation (Comfy-Org#19975) ## Summary Report where a customer left a cloud app checkout dialog when the journey has no operation yet (E24, cloud app follow-up). ## Why Billing web reports billing.checkout.abandoned, but the cloud app did not. A customer who closed the subscription or top-up dialog, or closed the tab with it open, left no trace of where they stopped. The abandon KPI itself is derived on the dashboard from journeys that never link an operation. This event only says where the customer left. ## How A new module, checkoutJourneyTelemetry.ts, becomes the one way the cloud app reports a journey phase. It remembers the last progress phase this tab reported on the active journey. reportCheckoutJourneyExit reports billing.checkout.abandoned with last_phase and exit only when the active journey has no billing_op_id, and only once per stretch of new progress. A close and a later pagehide therefore report once, and a reopened journey reports again only after a new phase. useCheckoutJourneyExit wires it into useSubscriptionCheckout and the top-up dialog: scope dispose reports exit dialog_close, and pagehide while the dialog is open reports exit page_exit. A hand-off to the hosted billing web checkout marks the journey as accounted for, so that close reports nothing. The shared CheckoutExit enum gains dialog_close. The cloud PostHog provider sends an abandoned page_exit with transport sendBeacon and send_instantly, through its existing teardown capture. Everything else stays batched. billing_surface cloud_app comes from the existing cloud journey payload. There is no user-visible change. ## Review Focus - Base: the -3 branch was squash-merged into -2 (8814fe1), so this branch is cut from -2 and merges origin/main. Its PR targets -2. - The event is an exit observation with no outcome. Once an operation is bound, the cloud app reports nothing. The operation events and the server own the end. - The last phase is tab-scoped, module-level state. A journey resumed after a reload with no new phase in this tab reports no exit. - The three call sites (useSubscriptionCheckout, SubscriptionAddPaymentPreviewWorkspace, TopUpCreditsDialogContentWorkspace) now go through trackCheckoutJourneyPhase. Their existing journey tests pass unchanged. - Known gaps: the brief says later phase events carry resumed: true, but cloud journey events have no resumed field, and this branch does not add one. A tab closed while it was already in the background may not flush its RUM action. PostHog events captured before it loads are not queued for page_exit, the same as the agent panel teardown event. The hosted handoff for the subscription intent (manage plan) is not a checkout journey and is untouched. ## AS IS / TO BE Telemetry change, so the evidence is the captured events instead of a screenshot: the real cloud dialogs and journey module with the Datadog RUM and PostHog providers, only the network edge and the telemetry SDKs stubbed. AS IS = origin/main, TO BE = this branch. | Scenario | AS IS | TO BE | | --- | --- | --- | | T1 top-up dialog closed after `entered` | `entered` | adds `abandoned` (last_phase entered, exit dialog_close) | | T2 tab closed with the top-up dialog open | `entered` | adds `abandoned` (exit page_exit); PostHog sends with `{transport: 'sendBeacon', send_instantly: true}` | | T3 top-up closed after a submit that bound no operation | `entered`, `submitted` | adds `abandoned` (last_phase submitted, exit dialog_close) | | T4 top-up closed, then tab closed, after the operation was bound | `entered`, `submitted`, `operation_linked` | unchanged, no abandon | | T5 top-up closed, then tab closed | `entered` | one `abandoned` (dialog_close), no second report on pagehide | | T6 top-up closed, reopened (journey resumed), closed | `entered` | one `abandoned`; the reopen made no new phase, so its close reports nothing | | S1 subscription dialog closed at the quote | `entered`, `preview_ready` | adds `abandoned` (last_phase preview_ready, exit dialog_close) | | S2 tab closed at the quote | `entered`, `preview_ready` | adds `abandoned` (exit page_exit), PostHog by sendBeacon | | S3 subscription closed after the quote failed | `entered`, `preview_failed` | adds `abandoned` (last_phase preview_failed) | | S4 subscription closed, then tab closed, after the operation was bound | through `operation_linked` | unchanged, no abandon | | S5 dialog closed because the hosted checkout tab opened | `entered` | unchanged, no abandon (billing web continues the journey) | | S6 closed at the quote, reopened idle and closed, tab hidden, reopened to the quote and closed | 2x `preview_ready` | one `abandoned` per stretch of new progress: 2, not 4 | The event is an exit observation (decision D13 in the plan): the headline abandon count is derived on the dashboard from journeys with no `operation_linked` within the journey TTL. evidence-fe3119-cloud-abandon/as-is.json shows no abandoned event on origin/main for any path, and to-be.json shows abandoned with last_phase and exit to RUM and PostHog on dialog close at entered, submitted, preview_ready and preview_failed, sendBeacon on page exit, one report for close plus pagehide and for reopen without progress, and nothing after a bound operation or a hosted handoff. ## Where this sits in the plan Linear: [FE-3119](https://linear.app/comfyorg/issue/FE-3119), part of [FE-3105](https://linear.app/comfyorg/issue/FE-3105/billing-web-and-sdk-rollout-telemetry-events-fixes-and-dashboards). Plan, event catalog and dependency graph: [action items](https://app.notion.com/p/3ea6d73d3650814ba248d4d1431b8a89). | Task | Ticket | What | Status | | --- | --- | --- | --- | | T1 | FE-3107 | Decide vocabulary and dimensions | done, in the SSOT | | T2 | FE-3108 | Decide RUM application and env mapping | decided | | T3 | FE-3109 | Billing web telemetry bootstrap (RUM and PostHog) | [PR 19688](Comfy-Org#19688), merged | | T3+ | FE-3156 | Opaque RUM user id on billing web | [PR 19794](Comfy-Org#19794), merged | | T4, F1 | FE-3106 | SDK-rail ownership | [PR 19620](Comfy-Org#19620), merged | | T4, F2 | FE-3110 | Keep operation id and fields in the mapper | [PR 19623](Comfy-Org#19623), merged | | T4, F3 | FE-3111 | Stamp billing_surface and billing_client | [PR 19685](Comfy-Org#19685), merged | | T4, F5 | FE-3112 | SDK top-up terminals | [PR 19628](Comfy-Org#19628), merged | | T4, F6 | FE-3113 | Downgrade reconciliation terminal | [PR 19622](Comfy-Org#19622), merged | | T4, F7 | FE-3114 | Legacy personal-rail events, first slice | [PR 19627](Comfy-Org#19627), merged | | T4, F7+ | FE-3131 | Legacy personal-rail events, remaining slices | [PR 19686](Comfy-Org#19686), merged | | T4+ | FE-3140 | Move the billing event contract to a shared package | [PR 19798](Comfy-Org#19798), merged | | T5 | FE-3115 | Cloud entry fidelity and Datadog parity | [PR 19815](Comfy-Org#19815) (four parts), in review | | T6 | FE-3116 | Handoff contract and event | [PR 19687](Comfy-Org#19687), merged | | T7 | FE-3117 | Billing web attempt lifecycle | [PR 19809](Comfy-Org#19809), [PR 19810](Comfy-Org#19810), [PR 19811](Comfy-Org#19811) merged, billing web cancel [PR 19945](Comfy-Org#19945) in review | | T8 | FE-3118 | Billing web journey and choices | [PR 19819](Comfy-Org#19819) (three parts), merged | | T9 | FE-3119 | Payment friction events | this PR | | T10 | FE-3120 | Billing web entry, session and return | [PR 19804](Comfy-Org#19804), [PR 19806](Comfy-Org#19806) and [PR 19807](Comfy-Org#19807), merged in [PR 19798](Comfy-Org#19798) | | T11 | FE-3121 | Portal events | [PR 19944](Comfy-Org#19944), in review | | T12 | FE-3122 | Flag coverage check | [PR 19942](Comfy-Org#19942), in review | | T13 | FE-3123 | PostHog rollout dashboard | [first cut](https://us.posthog.com/project/204330/dashboard/2164447) created | | T14 | FE-3124 | Datadog tiles in the Frontend RUM dashboard | [comfy-infra PR 1597](Comfy-Org/comfy-infra#1597), in review | | T4+ | FE-3162 | Move the payload-helper tests to account-core | [PR 19940](Comfy-Org#19940), in review | | T10+ | FE-3158 | Billing web Try again after session creation fails | [PR 19941](Comfy-Org#19941), in review | | T15 | FE-3125 | Verification per flow | todo | | T16 | FE-3126 | Rollout plan | todo | ```mermaid flowchart LR subgraph DEC["Decided"] T1["FE-3107 T1 vocabulary"] T2["FE-3108 T2 RUM app and env"] end subgraph FIX["Existing events (T4)"] F1["FE-3106 F1 SDK-rail ownership"] F2["FE-3110 F2 mapper fields"] F3["FE-3111 F3 surface and client"] F5["FE-3112 F5 top-up terminals"] F6["FE-3113 F6 downgrade terminal"] F7["FE-3114 F7 legacy personal, first slice"] F7B["FE-3131 F7 remaining slices"] C140["FE-3140 event contract to shared package"] end subgraph EMIT["New events"] T3["FE-3109 T3 billing web bootstrap"] T3b["FE-3156 T3+ opaque RUM user id"] T5["FE-3115 T5 cloud entry and parity"] T6["FE-3116 T6 handoff contract"] T7["FE-3117 T7 attempt lifecycle"] T8["FE-3118 T8 journey and choices"] T9["FE-3119 T9 friction"] T10["FE-3120 T10 entry, session, return"] T11["FE-3121 T11 portal"] T12["FE-3122 T12 flag coverage"] end subgraph DASH["Dashboards"] T13["FE-3123 T13 PostHog rollout"] T14["FE-3124 T14 Frontend RUM tiles"] end T15["FE-3125 T15 verification"] T16["FE-3126 T16 rollout plan"] T2 --> T3 T3 --> T3b F3 --> C140 T3 --> C140 C140 --> T7 C140 --> T8 C140 --> T10 C140 --> T11 T1 --> F3 T1 --> T5 T1 --> T6 T1 --> T13 T1 --> T14 T2 --> T14 F2 --> T7 T3 --> T7 T3 --> T8 T3 --> T10 T3 --> T11 T3 --> T12 T5 --> T11 T6 --> T8 T6 --> T10 T7 --> T9 T8 --> T9 F1 --> T13 F3 --> T13 FIX --> T15 T5 --> T15 T9 --> T15 T10 --> T15 T11 --> T15 T12 --> T15 T13 --> T15 T14 --> T15 T13 --> T16 T15 --> T16 style T9 stroke-width:3px ```
…embedded checkout (Comfy-Org#19974) ## Summary Report an abandoned checkout and the ending screen on the billing web embedded checkout, the same way the full-page checkout does (E24, E25). ## Why The full-page checkout reports billing.checkout.abandoned and billing.checkout.ended since Comfy-Org#19948, but the embedded CheckoutView reported neither. A customer who closed the tab or went back from the embedded checkout left no trace, and its success and refusal screens could not be told apart in a funnel. ## How CheckoutView reuses the journey's abandoned and ended methods from useCheckoutJourney and the beacon transport the facade already applies to abandoned. No shared composable was extracted, because the two views share only the journey, which is already shared, and their ending screens differ. It reports abandoned with exit page_exit on pagehide, and with exit back or close from those controls. It reports no abandon after the page handed itself to a hosted step, or while a Pay with a non-card method is in flight, since that method pays on its own site. It reports ended with ending_kind success when the success step shows: attribution started when this page's Pay returned the result, followed when the page recovered an operation it did not send. It reports ended when the quote failure screen shows, right after preview_failed: refused for ACCESS_DENIED, plan_unavailable for the server code INVALID_PLAN, and load_failed otherwise. The journey keeps its existing rules: abandoned at most once and never after an ending, and each ending kind once. There is no user-visible change. ## Review Focus - quoteFailureEndingOf maps the embedded quote failure screen onto the full-page ending kinds. The embedded view has no capability read, so refused comes from ACCESS_DENIED on the quote, not from a denial reason. - payingOnOwnSite is true only between the Pay press and the command settling, for a method type other than card. A card Pay in flight when the tab closes is still an abandon, as on the full page. - Success attribution reads checkout.result: an ok result means this page's own Pay, and none means a recovered operation. - Two existing tests now expect billing.checkout.ended: the full journey test, and the stream ordering test, where ended lands before billing.subscription_checkout.succeeded because the success step shows before the attempt reports its terminal. - Known gaps: a quote that allows no change (allowed false) shows no ending screen on the embedded view, so it reports preview_failed and no ended. A saved non-card method carries no method type, so a redirect from it would count as an abandon. That matches the full page. The background-tab flush gap from Comfy-Org#19948 applies here too. ## AS IS / TO BE Telemetry change, so the evidence is the captured events instead of a screenshot: the real `CheckoutView` with the billing web telemetry facade and PostHog started, only the fake billing client and the telemetry SDKs stubbed. AS IS = origin/main, TO BE = this branch. | Path | AS IS | TO BE | | --- | --- | --- | | Tab closed at the quote | `entered`, `preview_ready` | adds `abandoned` (last_phase preview_ready, exit page_exit). The PostHog copy is sent with `{transport: 'sendBeacon'}` | | Back control, then the page unloads | `entered`, `preview_ready`, `web_return.clicked` | adds `abandoned` (exit back) once. The later pagehide adds nothing | | Close control, then the page unloads | `entered`, `preview_ready`, `web_return.clicked` | adds `abandoned` (exit close) once | | Hosted redirect (server offers a continuation) | `entered`, `preview_ready` | unchanged. No abandon, because the page handed itself to the hosted step | | Alipay Pay leaving for its own site | no abandon | unchanged. No abandon while a non-card Pay is in flight | | Own payment succeeds, then the tab closes | no ending event | `ended` (ending_kind success, attribution started, billing_op_id op_9). No abandon after it | | Quote refused (ACCESS_DENIED), then Back | `entered`, `preview_failed`, `web_return.clicked` | adds `ended` (ending_kind refused), with no attribution. Back after it adds no abandon | No new field carries an email, URL, client secret, promo code or provider id; every new field is a bounded enum. evidence-fe3119-embedded/as-is.json shows no abandoned or ended event on the embedded checkout on main. to-be.json shows abandoned with last_phase and exit for tab close, Back and Close, sent to RUM and to PostHog with transport sendBeacon. It shows no abandon for a hosted redirect or an Alipay Pay, and ended with ending_kind and attribution for the success and refusal screens. ## Where this sits in the plan Linear: [FE-3119](https://linear.app/comfyorg/issue/FE-3119), part of [FE-3105](https://linear.app/comfyorg/issue/FE-3105/billing-web-and-sdk-rollout-telemetry-events-fixes-and-dashboards). Plan, event catalog and dependency graph: [action items](https://app.notion.com/p/3ea6d73d3650814ba248d4d1431b8a89). | Task | Ticket | What | Status | | --- | --- | --- | --- | | T1 | FE-3107 | Decide vocabulary and dimensions | done, in the SSOT | | T2 | FE-3108 | Decide RUM application and env mapping | decided | | T3 | FE-3109 | Billing web telemetry bootstrap (RUM and PostHog) | [PR 19688](Comfy-Org#19688), merged | | T3+ | FE-3156 | Opaque RUM user id on billing web | [PR 19794](Comfy-Org#19794), merged | | T4, F1 | FE-3106 | SDK-rail ownership | [PR 19620](Comfy-Org#19620), merged | | T4, F2 | FE-3110 | Keep operation id and fields in the mapper | [PR 19623](Comfy-Org#19623), merged | | T4, F3 | FE-3111 | Stamp billing_surface and billing_client | [PR 19685](Comfy-Org#19685), merged | | T4, F5 | FE-3112 | SDK top-up terminals | [PR 19628](Comfy-Org#19628), merged | | T4, F6 | FE-3113 | Downgrade reconciliation terminal | [PR 19622](Comfy-Org#19622), merged | | T4, F7 | FE-3114 | Legacy personal-rail events, first slice | [PR 19627](Comfy-Org#19627), merged | | T4, F7+ | FE-3131 | Legacy personal-rail events, remaining slices | [PR 19686](Comfy-Org#19686), merged | | T4+ | FE-3140 | Move the billing event contract to a shared package | [PR 19798](Comfy-Org#19798), merged | | T5 | FE-3115 | Cloud entry fidelity and Datadog parity | [PR 19815](Comfy-Org#19815) (four parts), in review | | T6 | FE-3116 | Handoff contract and event | [PR 19687](Comfy-Org#19687), merged | | T7 | FE-3117 | Billing web attempt lifecycle | [PR 19809](Comfy-Org#19809), [PR 19810](Comfy-Org#19810), [PR 19811](Comfy-Org#19811) merged, billing web cancel [PR 19945](Comfy-Org#19945) in review | | T8 | FE-3118 | Billing web journey and choices | [PR 19819](Comfy-Org#19819) (three parts), merged | | T9 | FE-3119 | Payment friction events | this PR | | T10 | FE-3120 | Billing web entry, session and return | [PR 19804](Comfy-Org#19804), [PR 19806](Comfy-Org#19806) and [PR 19807](Comfy-Org#19807), merged in [PR 19798](Comfy-Org#19798) | | T11 | FE-3121 | Portal events | [PR 19944](Comfy-Org#19944), in review | | T12 | FE-3122 | Flag coverage check | [PR 19942](Comfy-Org#19942), in review | | T13 | FE-3123 | PostHog rollout dashboard | [first cut](https://us.posthog.com/project/204330/dashboard/2164447) created | | T14 | FE-3124 | Datadog tiles in the Frontend RUM dashboard | [comfy-infra PR 1597](Comfy-Org/comfy-infra#1597), in review | | T4+ | FE-3162 | Move the payload-helper tests to account-core | [PR 19940](Comfy-Org#19940), in review | | T10+ | FE-3158 | Billing web Try again after session creation fails | [PR 19941](Comfy-Org#19941), in review | | T15 | FE-3125 | Verification per flow | todo | | T16 | FE-3126 | Rollout plan | todo | ```mermaid flowchart LR subgraph DEC["Decided"] T1["FE-3107 T1 vocabulary"] T2["FE-3108 T2 RUM app and env"] end subgraph FIX["Existing events (T4)"] F1["FE-3106 F1 SDK-rail ownership"] F2["FE-3110 F2 mapper fields"] F3["FE-3111 F3 surface and client"] F5["FE-3112 F5 top-up terminals"] F6["FE-3113 F6 downgrade terminal"] F7["FE-3114 F7 legacy personal, first slice"] F7B["FE-3131 F7 remaining slices"] C140["FE-3140 event contract to shared package"] end subgraph EMIT["New events"] T3["FE-3109 T3 billing web bootstrap"] T3b["FE-3156 T3+ opaque RUM user id"] T5["FE-3115 T5 cloud entry and parity"] T6["FE-3116 T6 handoff contract"] T7["FE-3117 T7 attempt lifecycle"] T8["FE-3118 T8 journey and choices"] T9["FE-3119 T9 friction"] T10["FE-3120 T10 entry, session, return"] T11["FE-3121 T11 portal"] T12["FE-3122 T12 flag coverage"] end subgraph DASH["Dashboards"] T13["FE-3123 T13 PostHog rollout"] T14["FE-3124 T14 Frontend RUM tiles"] end T15["FE-3125 T15 verification"] T16["FE-3126 T16 rollout plan"] T2 --> T3 T3 --> T3b F3 --> C140 T3 --> C140 C140 --> T7 C140 --> T8 C140 --> T10 C140 --> T11 T1 --> F3 T1 --> T5 T1 --> T6 T1 --> T13 T1 --> T14 T2 --> T14 F2 --> T7 T3 --> T7 T3 --> T8 T3 --> T10 T3 --> T11 T3 --> T12 T5 --> T11 T6 --> T8 T6 --> T10 T7 --> T9 T8 --> T9 F1 --> T13 F3 --> T13 FIX --> T15 T5 --> T15 T9 --> T15 T10 --> T15 T11 --> T15 T12 --> T15 T13 --> T15 T14 --> T15 T13 --> T16 T15 --> T16 style T9 stroke-width:3px ```
…tion switch rewrites the operation pointer (Comfy-Org#20004) ## Summary Keep the saved hosted redirect when a presentation switch rewrites the operation pointer, so billing.checkout.returned (E23) is still reported on the page the customer comes back to. ## Why CodeRabbit found this on Comfy-Org#19975 (Comfy-Org#19975 (comment)). A same-tab hosted redirect is only reported as returned if the tab's operation pointer still carries the redirect when the next page recovers the operation. A presentation switch after the redirect erased it, so that return was never reported. ## Root cause writePointer rebuilds the pointer from the operation state and only includes redirect when the caller passes one. reportHostedStepOpened passes it, but switchPresentation rewrites the pointer for the same operation without it, so the saved redirect is dropped. ## How A small savedRedirect helper reads the current pointer and returns its redirect only when its operationId is the operation being written. switchPresentation passes that to writePointer. The adopt write is deliberately left unchanged: adoption is where a saved redirect is turned into billing.checkout.returned, so it must consume the redirect. Carrying it forward there would report returned again on every reload, which the existing 'reports the return once' test catches. There is no user-visible change. ## Review Focus - The carry-forward lives at the switchPresentation call site, not inside writePointer. A generic carry-forward in writePointer also hits the adopt write and breaks the 'reports the return once' contract. This was checked: that test fails with the generic version. - The operationId guard matters when two operations are live in one scope. The new 'reports no return for an operation that never redirected, though another one did' test fails if the guard is removed. - leftScope writes a fresh pointer for a newly issued operation through pointers.write directly. It has no redirect to keep and is unchanged. ## AS IS / TO BE Telemetry change, so the evidence is the captured lifecycle events instead of a screenshot. Scenario: embedded 3DS top-up, hosted redirect, `switchPresentation('op-1', 'hosted')`, unload, then recover on a new page. | | Pointer after the rewrite | Events on the page the customer returns to | | --- | --- | --- | | AS IS (main) | `redirect` dropped | `billing.operation.started`, `billing.operation.succeeded` | | TO BE | `redirect` kept | adds `billing.checkout.returned` (navigation redirect, step authentication, method_kind card, presentation hosted, resumed true) on both the cloud app and billing web payloads | evidence-fe3119-pointer/as-is.json shows the pointer losing redirect after the same-operation rewrite and no billing.checkout.returned on the page returned to, and to-be.json shows redirect kept and billing.checkout.returned reported to both cloud app and billing web payloads. ## Where this sits in the plan Linear: [FE-3119](https://linear.app/comfyorg/issue/FE-3119), part of [FE-3105](https://linear.app/comfyorg/issue/FE-3105/billing-web-and-sdk-rollout-telemetry-events-fixes-and-dashboards). Plan, event catalog and dependency graph: [action items](https://app.notion.com/p/3ea6d73d3650814ba248d4d1431b8a89). | Task | Ticket | What | Status | | --- | --- | --- | --- | | T1 | FE-3107 | Decide vocabulary and dimensions | done, in the SSOT | | T2 | FE-3108 | Decide RUM application and env mapping | decided | | T3 | FE-3109 | Billing web telemetry bootstrap (RUM and PostHog) | [PR 19688](Comfy-Org#19688), merged | | T3+ | FE-3156 | Opaque RUM user id on billing web | [PR 19794](Comfy-Org#19794), merged | | T4, F1 | FE-3106 | SDK-rail ownership | [PR 19620](Comfy-Org#19620), merged | | T4, F2 | FE-3110 | Keep operation id and fields in the mapper | [PR 19623](Comfy-Org#19623), merged | | T4, F3 | FE-3111 | Stamp billing_surface and billing_client | [PR 19685](Comfy-Org#19685), merged | | T4, F5 | FE-3112 | SDK top-up terminals | [PR 19628](Comfy-Org#19628), merged | | T4, F6 | FE-3113 | Downgrade reconciliation terminal | [PR 19622](Comfy-Org#19622), merged | | T4, F7 | FE-3114 | Legacy personal-rail events, first slice | [PR 19627](Comfy-Org#19627), merged | | T4, F7+ | FE-3131 | Legacy personal-rail events, remaining slices | [PR 19686](Comfy-Org#19686), merged | | T4+ | FE-3140 | Move the billing event contract to a shared package | [PR 19798](Comfy-Org#19798), merged | | T5 | FE-3115 | Cloud entry fidelity and Datadog parity | [PR 19815](Comfy-Org#19815), merged | | T6 | FE-3116 | Handoff contract and event | [PR 19687](Comfy-Org#19687), merged | | T7 | FE-3117 | Billing web attempt lifecycle | [PR 19809](Comfy-Org#19809), [PR 19810](Comfy-Org#19810), [PR 19811](Comfy-Org#19811) merged, billing web cancel [PR 19945](Comfy-Org#19945) in review | | T8 | FE-3118 | Billing web journey and choices | [PR 19819](Comfy-Org#19819) (three parts), merged | | T9 | FE-3119 | Payment friction events | this PR | | T10 | FE-3120 | Billing web entry, session and return | [PR 19804](Comfy-Org#19804), [PR 19806](Comfy-Org#19806) and [PR 19807](Comfy-Org#19807), merged in [PR 19798](Comfy-Org#19798) | | T11 | FE-3121 | Portal events | [PR 19944](Comfy-Org#19944), in review | | T12 | FE-3122 | Flag coverage check | [PR 19942](Comfy-Org#19942), in review | | T13 | FE-3123 | PostHog rollout dashboard | [first cut](https://us.posthog.com/project/204330/dashboard/2164447) created | | T14 | FE-3124 | Datadog tiles in the Frontend RUM dashboard | [comfy-infra PR 1597](Comfy-Org/comfy-infra#1597), in review | | T4+ | FE-3162 | Move the payload-helper tests to account-core | [PR 19940](Comfy-Org#19940), in review | | T10+ | FE-3158 | Billing web Try again after session creation fails | [PR 19941](Comfy-Org#19941), in review | | T15 | FE-3125 | Verification per flow | todo | | T16 | FE-3126 | Rollout plan | todo | ```mermaid flowchart LR subgraph DEC["Decided"] T1["FE-3107 T1 vocabulary"] T2["FE-3108 T2 RUM app and env"] end subgraph FIX["Existing events (T4)"] F1["FE-3106 F1 SDK-rail ownership"] F2["FE-3110 F2 mapper fields"] F3["FE-3111 F3 surface and client"] F5["FE-3112 F5 top-up terminals"] F6["FE-3113 F6 downgrade terminal"] F7["FE-3114 F7 legacy personal, first slice"] F7B["FE-3131 F7 remaining slices"] C140["FE-3140 event contract to shared package"] end subgraph EMIT["New events"] T3["FE-3109 T3 billing web bootstrap"] T3b["FE-3156 T3+ opaque RUM user id"] T5["FE-3115 T5 cloud entry and parity"] T6["FE-3116 T6 handoff contract"] T7["FE-3117 T7 attempt lifecycle"] T8["FE-3118 T8 journey and choices"] T9["FE-3119 T9 friction"] T10["FE-3120 T10 entry, session, return"] T11["FE-3121 T11 portal"] T12["FE-3122 T12 flag coverage"] end subgraph DASH["Dashboards"] T13["FE-3123 T13 PostHog rollout"] T14["FE-3124 T14 Frontend RUM tiles"] end T15["FE-3125 T15 verification"] T16["FE-3126 T16 rollout plan"] T2 --> T3 T3 --> T3b F3 --> C140 T3 --> C140 C140 --> T7 C140 --> T8 C140 --> T10 C140 --> T11 T1 --> F3 T1 --> T5 T1 --> T6 T1 --> T13 T1 --> T14 T2 --> T14 F2 --> T7 T3 --> T7 T3 --> T8 T3 --> T10 T3 --> T11 T3 --> T12 T5 --> T11 T6 --> T8 T6 --> T10 T7 --> T9 T8 --> T9 F1 --> T13 F3 --> T13 FIX --> T15 T5 --> T15 T9 --> T15 T10 --> T15 T11 --> T15 T12 --> T15 T13 --> T15 T14 --> T15 T13 --> T16 T15 --> T16 style T9 stroke-width:3px ```
Summary
Billing web reports its cancel flow as billing.cancel.intent, billing.cancel.abandoned and billing.cancel.failed, using the cancel contract from FE-3115.
Why
E14 needs the cancel flow on both hosts. The cloud app gets it in FE-3115. Billing web reported nothing for its cancel flow: a customer who opened the confirmation and kept the plan, and a cancel the server refused before any operation existed, were invisible. A refusal before an operation exists is also invisible to the SDK stream, because the SDK only reports operations.
How
createCancelFlowTelemetry in apps/billing-web/src/telemetry/cancelTelemetry.ts reports intent when the confirmation opens, abandoned when the customer picks Keep my plan or the surface unmounts with the confirmation still open, and failed only when the cancel command returns a refusal (status error), classified through the shared outcomeOfCommandResult. Once the customer confirms, the flow is no longer abandoned, and a cancel that issued an operation ends in the SDK's billing.operation.* events with operation_type cancel, so this flow adds no terminal of its own. Each event carries billing_client sdk and the current plan's tier and cycle, which SubscriptionPanel passes down from the plan catalog. checkoutTierOf is exported from subscriptionCheckoutTelemetry.ts so both flows map server tiers the same way. There is no user-visible change.
Review Focus
AS IS / TO BE
Captured through the real telemetry providers in the component and composable tests (Datadog RUM action and PostHog event carry identical payloads,
billing_surfaceper host). AS IS = base branch, TO BE = this branch.billing.cancel.intent(billing_client: sdk, current_tier: pro, cycle: yearly)billing.cancel.abandoned(billing_client: sdk, current_tier: pro, cycle: yearly)billing.cancel.intent(billing_client: sdk, current_tier: pro, cycle: yearly)billing.cancel.abandoned(billing_client: sdk, current_tier: pro, cycle: yearly)billing.cancel.intent(billing_client: sdk, current_tier: pro, cycle: yearly)billing.cancel.intent(billing_client: sdk, current_tier: pro, cycle: yearly)billing.cancel.intent(billing_client: sdk, current_tier: pro, cycle: yearly)billing.cancel.intent(billing_client: sdk, current_tier: pro, cycle: yearly)billing.cancel.failed(billing_client: sdk, current_tier: pro, cycle: yearly, failure_category: network)billing.cancel.intent(billing_client: sdk, current_tier: pro, cycle: yearly)billing.cancel.failed(billing_client: sdk, current_tier: pro, cycle: yearly, failure_category: api_rejected)billing.cancel.intent(billing_client: sdk, current_tier: pro, cycle: yearly)billing.cancel.failed(billing_client: sdk, current_tier: pro, cycle: yearly, failure_category: api_rejected, error_code: operation_already_pending)Captured RUM actions and PostHog events for eight cancel paths on billing web show nothing on the FE-3115 base and intent, abandoned or failed with tier, cycle and failure category on this branch (evidence-fe3117-web-cancel/).
Where this sits in the plan
Linear: FE-3117, part of FE-3105. Plan, event catalog and dependency graph: action items.
flowchart LR subgraph DEC["Decided"] T1["FE-3107 T1 vocabulary"] T2["FE-3108 T2 RUM app and env"] end subgraph FIX["Existing events (T4)"] F1["FE-3106 F1 SDK-rail ownership"] F2["FE-3110 F2 mapper fields"] F3["FE-3111 F3 surface and client"] F5["FE-3112 F5 top-up terminals"] F6["FE-3113 F6 downgrade terminal"] F7["FE-3114 F7 legacy personal, first slice"] F7B["FE-3131 F7 remaining slices"] C140["FE-3140 event contract to shared package"] end subgraph EMIT["New events"] T3["FE-3109 T3 billing web bootstrap"] T3b["FE-3156 T3+ opaque RUM user id"] T5["FE-3115 T5 cloud entry and parity"] T6["FE-3116 T6 handoff contract"] T7["FE-3117 T7 attempt lifecycle"] T8["FE-3118 T8 journey and choices"] T9["FE-3119 T9 friction"] T10["FE-3120 T10 entry, session, return"] T11["FE-3121 T11 portal"] T12["FE-3122 T12 flag coverage"] end subgraph DASH["Dashboards"] T13["FE-3123 T13 PostHog rollout"] T14["FE-3124 T14 Frontend RUM tiles"] end T15["FE-3125 T15 verification"] T16["FE-3126 T16 rollout plan"] T2 --> T3 T3 --> T3b F3 --> C140 T3 --> C140 C140 --> T7 C140 --> T8 C140 --> T10 C140 --> T11 T1 --> F3 T1 --> T5 T1 --> T6 T1 --> T13 T1 --> T14 T2 --> T14 F2 --> T7 T3 --> T7 T3 --> T8 T3 --> T10 T3 --> T11 T3 --> T12 T5 --> T11 T6 --> T8 T6 --> T10 T7 --> T9 T8 --> T9 F1 --> T13 F3 --> T13 FIX --> T15 T5 --> T15 T9 --> T15 T10 --> T15 T11 --> T15 T12 --> T15 T13 --> T15 T14 --> T15 T13 --> T16 T15 --> T16 style T7 stroke-width:3px