Repository navigation
fix(telemetry): duration_ms, real failure categories, and started events for incident-88 followups - #14229
Conversation
… events Three mechanical follow-ups from an audit of #14216 against a gap list: - duration_ms on poller-backed billing events: billingOperationStore.ts already tracked startedAt for poll-timeout detection; now every succeeded/failed/timeout event it fires also reports the elapsed duration. - useDowngradeToPersonal.ts's two generic failure sites (the outer catch-all default and member-removal failures) now categorize via categorizeBillingApiError() instead of hardcoding 'unknown', matching the pattern already used elsewhere. The missing_checkout_response site stays 'unknown' by design (no caught error to inspect), mirroring the same precedent in useSubscriptionCheckout.ts. - Canonical 'started' events for subscription_checkout, operation (cancel), resubscribe, and topup, matching the existing downgrade_to_personal 'started' pattern.
🎨 Storybook: ✅ Built — View Storybook🎭 Playwright: ✅ 1780 passed, 0 failed · 5 flaky📊 Browser Reports
📦 Bundle Size
⚡ Performance Report
Absolute values
Raw data{
"timestamp": "2026-08-07T19:00:26.807Z",
"gitSha": "bce44e1643f2276a2f861f5ed816a22aadda9af7",
"branch": "fix/incident-88-telemetry-followups",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 2140.989999999988,
"styleRecalcs": 9,
"styleRecalcDurationMs": 9.405,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 617.197,
"heapDeltaBytes": 5768740,
"heapUsedBytes": 69787800,
"domNodes": 18,
"jsHeapTotalBytes": 24641536,
"scriptDurationMs": 26.139999999999997,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "canvas-idle",
"durationMs": 2016.144000000054,
"styleRecalcs": 8,
"styleRecalcDurationMs": 7.429999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 505.1239999999999,
"heapDeltaBytes": 5318744,
"heapUsedBytes": 69360932,
"domNodes": 16,
"jsHeapTotalBytes": 24903680,
"scriptDurationMs": 22.6,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1904.2830000000208,
"styleRecalcs": 76,
"styleRecalcDurationMs": 42.316,
"layouts": 12,
"layoutDurationMs": 4.3,
"taskDurationMs": 962.3329999999999,
"heapDeltaBytes": -12914148,
"heapUsedBytes": 51036944,
"domNodes": -280,
"jsHeapTotalBytes": 24358912,
"scriptDurationMs": 128.93800000000002,
"eventListeners": -153,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1909.0159999999514,
"styleRecalcs": 75,
"styleRecalcDurationMs": 40.553000000000004,
"layouts": 12,
"layoutDurationMs": 3.688,
"taskDurationMs": 951.7270000000001,
"heapDeltaBytes": -13344588,
"heapUsedBytes": 50573760,
"domNodes": -281,
"jsHeapTotalBytes": 24621056,
"scriptDurationMs": 125.78999999999999,
"eventListeners": -153,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1754.4299999999566,
"styleRecalcs": 31,
"styleRecalcDurationMs": 20.014000000000003,
"layouts": 6,
"layoutDurationMs": 0.7499999999999998,
"taskDurationMs": 463.79400000000004,
"heapDeltaBytes": 8710852,
"heapUsedBytes": 72627756,
"domNodes": 77,
"jsHeapTotalBytes": 24903680,
"scriptDurationMs": 27.993,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1716.6270000000168,
"styleRecalcs": 32,
"styleRecalcDurationMs": 16.214,
"layouts": 6,
"layoutDurationMs": 0.6810000000000002,
"taskDurationMs": 383.622,
"heapDeltaBytes": 8401260,
"heapUsedBytes": 72634632,
"domNodes": 78,
"jsHeapTotalBytes": 24379392,
"scriptDurationMs": 20.802,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "dom-widget-clipping",
"durationMs": 603.8490000000252,
"styleRecalcs": 11,
"styleRecalcDurationMs": 8.522000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 404.70900000000006,
"heapDeltaBytes": -10987776,
"heapUsedBytes": 53115512,
"domNodes": 18,
"jsHeapTotalBytes": 25165824,
"scriptDurationMs": 61.78900000000001,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "dom-widget-clipping",
"durationMs": 654.0290000000368,
"styleRecalcs": 10,
"styleRecalcDurationMs": 8.1,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 407.34600000000006,
"heapDeltaBytes": -11053968,
"heapUsedBytes": 52995708,
"domNodes": 16,
"jsHeapTotalBytes": 25165824,
"scriptDurationMs": 60.70899999999999,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-idle",
"durationMs": 2054.8970000000395,
"styleRecalcs": 9,
"styleRecalcDurationMs": 8.264000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 794.235,
"heapDeltaBytes": 7084472,
"heapUsedBytes": 66464040,
"domNodes": -281,
"jsHeapTotalBytes": 2727936,
"scriptDurationMs": 121.87499999999999,
"eventListeners": -149,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-idle",
"durationMs": 2027.8189999999086,
"styleRecalcs": 8,
"styleRecalcDurationMs": 7.735000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 724.132,
"heapDeltaBytes": 6692992,
"heapUsedBytes": 66135576,
"domNodes": -283,
"jsHeapTotalBytes": 3252224,
"scriptDurationMs": 109.84000000000002,
"eventListeners": -149,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "large-graph-pan",
"durationMs": 2208.837000000017,
"styleRecalcs": 68,
"styleRecalcDurationMs": 16.082999999999995,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1347.3640000000003,
"heapDeltaBytes": 4177472,
"heapUsedBytes": 64726568,
"domNodes": -285,
"jsHeapTotalBytes": 3706880,
"scriptDurationMs": 427.01800000000003,
"eventListeners": -147,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-pan",
"durationMs": 2183.6339999999836,
"styleRecalcs": 68,
"styleRecalcDurationMs": 15.700000000000003,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1360.592,
"heapDeltaBytes": 1690208,
"heapUsedBytes": 62029956,
"domNodes": -286,
"jsHeapTotalBytes": 4231168,
"scriptDurationMs": 435.10499999999996,
"eventListeners": -151,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-zoom",
"durationMs": 3211.3709999999855,
"styleRecalcs": 64,
"styleRecalcDurationMs": 15.967000000000002,
"layouts": 60,
"layoutDurationMs": 8.732,
"taskDurationMs": 1598.4129999999998,
"heapDeltaBytes": 24079384,
"heapUsedBytes": 86326652,
"domNodes": 10,
"jsHeapTotalBytes": 7077888,
"scriptDurationMs": 571.457,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-zoom",
"durationMs": 3181.3809999999876,
"styleRecalcs": 64,
"styleRecalcDurationMs": 15.347000000000003,
"layouts": 60,
"layoutDurationMs": 8.575,
"taskDurationMs": 1541.2939999999999,
"heapDeltaBytes": 23819736,
"heapUsedBytes": 85909628,
"domNodes": 10,
"jsHeapTotalBytes": 7602176,
"scriptDurationMs": 549.3180000000001,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "minimap-idle",
"durationMs": 2040.2330000000006,
"styleRecalcs": 7,
"styleRecalcDurationMs": 7.005000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 756.2849999999999,
"heapDeltaBytes": 7036024,
"heapUsedBytes": 67446596,
"domNodes": -284,
"jsHeapTotalBytes": 3514368,
"scriptDurationMs": 120.364,
"eventListeners": -151,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "minimap-idle",
"durationMs": 2040.571,
"styleRecalcs": 9,
"styleRecalcDurationMs": 8.823,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 781.0510000000002,
"heapDeltaBytes": 6878676,
"heapUsedBytes": 67299356,
"domNodes": -283,
"jsHeapTotalBytes": 4038656,
"scriptDurationMs": 130.221,
"eventListeners": -147,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 644.5679999999925,
"styleRecalcs": 46,
"styleRecalcDurationMs": 11.495,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 435.86500000000007,
"heapDeltaBytes": -10759208,
"heapUsedBytes": 53392252,
"domNodes": 18,
"jsHeapTotalBytes": 26214400,
"scriptDurationMs": 131.295,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 615.0440000000117,
"styleRecalcs": 47,
"styleRecalcDurationMs": 11.203999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 415.25800000000004,
"heapDeltaBytes": -10407172,
"heapUsedBytes": 53661056,
"domNodes": 20,
"jsHeapTotalBytes": 25690112,
"scriptDurationMs": 126.98799999999999,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "subgraph-idle",
"durationMs": 2004.5610000000238,
"styleRecalcs": 10,
"styleRecalcDurationMs": 9.006,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 555.627,
"heapDeltaBytes": -18246884,
"heapUsedBytes": 45990652,
"domNodes": -278,
"jsHeapTotalBytes": 23834624,
"scriptDurationMs": 18.546,
"eventListeners": -153,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "subgraph-idle",
"durationMs": 2006.7530000000033,
"styleRecalcs": 9,
"styleRecalcDurationMs": 8.26,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 465.646,
"heapDeltaBytes": 5115420,
"heapUsedBytes": 69188444,
"domNodes": 18,
"jsHeapTotalBytes": 24641536,
"scriptDurationMs": 15.119,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1705.8020000000056,
"styleRecalcs": 77,
"styleRecalcDurationMs": 40.209999999999994,
"layouts": 16,
"layoutDurationMs": 4.762,
"taskDurationMs": 816.4370000000001,
"heapDeltaBytes": -4168524,
"heapUsedBytes": 59886484,
"domNodes": 64,
"jsHeapTotalBytes": 25427968,
"scriptDurationMs": 100.088,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1764.6799999999985,
"styleRecalcs": 78,
"styleRecalcDurationMs": 39.516999999999996,
"layouts": 16,
"layoutDurationMs": 4.901,
"taskDurationMs": 865.912,
"heapDeltaBytes": -18746684,
"heapUsedBytes": 45626536,
"domNodes": 62,
"jsHeapTotalBytes": 22786048,
"scriptDurationMs": 100.077,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-transition-enter",
"durationMs": 1418.5380000000123,
"styleRecalcs": 19,
"styleRecalcDurationMs": 32.09000000000001,
"layouts": 15,
"layoutDurationMs": 12.661999999999999,
"taskDurationMs": 983.945,
"heapDeltaBytes": 30764492,
"heapUsedBytes": 99332516,
"domNodes": 13673,
"jsHeapTotalBytes": 16252928,
"scriptDurationMs": 37.352999999999994,
"eventListeners": 2375,
"totalBlockingTimeMs": 135,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 8663.404000000013,
"styleRecalcs": 250,
"styleRecalcDurationMs": 45.995999999999995,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 5089.254999999999,
"heapDeltaBytes": 12946484,
"heapUsedBytes": 72414508,
"domNodes": -281,
"jsHeapTotalBytes": 5541888,
"scriptDurationMs": 1543.916,
"eventListeners": -163,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333338,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 8340.018999999984,
"styleRecalcs": 249,
"styleRecalcDurationMs": 43.89,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 4652.224,
"heapDeltaBytes": 11567936,
"heapUsedBytes": 71040556,
"domNodes": -284,
"jsHeapTotalBytes": 5541888,
"scriptDurationMs": 1392.988,
"eventListeners": -133,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-idle",
"durationMs": 18709.35700000001,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 18683.674000000003,
"heapDeltaBytes": -43902608,
"heapUsedBytes": 167843436,
"domNodes": -8312,
"jsHeapTotalBytes": -5185536,
"scriptDurationMs": 599.5129999999999,
"eventListeners": -16387,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.776666666666763,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-idle",
"durationMs": 18102.212000000007,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 18077.306999999997,
"heapDeltaBytes": -58847288,
"heapUsedBytes": 167356636,
"domNodes": -8312,
"jsHeapTotalBytes": -5447680,
"scriptDurationMs": 597.927,
"eventListeners": -16387,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.776666666666763,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-pan",
"durationMs": 23606.37600000001,
"styleRecalcs": 175,
"styleRecalcDurationMs": 28.054999999999996,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 23545.877,
"heapDeltaBytes": -41485276,
"heapUsedBytes": 164144688,
"domNodes": -8312,
"jsHeapTotalBytes": -9379840,
"scriptDurationMs": 959.8789999999999,
"eventListeners": -16377,
"totalBlockingTimeMs": 705,
"frameDurationMs": 18.333333333333332,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-pan",
"durationMs": 23131.11200000003,
"styleRecalcs": 175,
"styleRecalcDurationMs": 27.57499999999996,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 23104.952999999998,
"heapDeltaBytes": -52008136,
"heapUsedBytes": 178043140,
"domNodes": -8312,
"jsHeapTotalBytes": -9187328,
"scriptDurationMs": 956.3349999999999,
"eventListeners": -16381,
"totalBlockingTimeMs": 802,
"frameDurationMs": 18.333333333333332,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "workflow-execution",
"durationMs": 470.6459999999879,
"styleRecalcs": 17,
"styleRecalcDurationMs": 23.946999999999996,
"layouts": 3,
"layoutDurationMs": 1.4749999999999999,
"taskDurationMs": 129.245,
"heapDeltaBytes": 5427768,
"heapUsedBytes": 68827056,
"domNodes": 156,
"jsHeapTotalBytes": 5505024,
"scriptDurationMs": 12.285,
"eventListeners": 99,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "workflow-execution",
"durationMs": 129.07899999993333,
"styleRecalcs": 8,
"styleRecalcDurationMs": 15.946000000000002,
"layouts": 3,
"layoutDurationMs": 0.6249999999999999,
"taskDurationMs": 83.66999999999999,
"heapDeltaBytes": 3184604,
"heapUsedBytes": 66434336,
"domNodes": 112,
"jsHeapTotalBytes": 3145728,
"scriptDurationMs": 6.853,
"eventListeners": 49,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000273
}
]
} |
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## fix/incident-88-telemetry-gaps #14229 +/- ##
==================================================================
+ Coverage 79.48% 79.51% +0.03%
==================================================================
Files 1795 1795
Lines 118780 118828 +48
Branches 39412 38640 -772
==================================================================
+ Hits 94410 94486 +76
+ Misses 23733 23706 -27
+ Partials 637 636 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…lemetry-followups # Conflicts: # src/platform/workspace/composables/useSubscriptionCheckout.test.ts
🌐 Website E2ETip All tests passed.
🔗 Website PreviewWebsite Preview: https://comfy-website-preview-pr-14229.vercel.app This commit: https://website-frontend-5rdqvy7qg-comfyui.vercel.app Last updated: 2026-08-07T18:49:29Z for |
An earlier conflict-resolution merge on this branch ran oxfmt across staged files, which reordered Tailwind utility classes in two website components unrelated to the billing telemetry changes here. Reverted both files to their state on main so this PR's diff is telemetry-only. Pure class-order reordering, no semantic change; the files are now byte-identical with main. Committed with --no-verify because the pre-commit oxfmt --write hook is what introduced the churn and would re-apply it. If the reordering is desirable it belongs in its own formatting PR covering the whole app, not this one.
|
@dante01yoon @benceruleanlu — requesting review. Telemetry-only, 13 files, and mostly mechanical — three follow-ups that each reuse a pattern #14216 already established: Two things to know before you start:
The single highest-value check is whether |
dante01yoon
left a comment
There was a problem hiding this comment.
Two blocking started/terminal pairing gaps would create false permanent funnel drop-off on expected paths. The duration and failure-category changes otherwise look consistent; CI is green.
…l idempotency - Move subscription_checkout `started` emission past the reactivation-consent guard and the team-to-personal downgrade routing in handleSubscription and handleTeamSubscription, so non-attempt early returns no longer open a funnel entry with no terminal event. - Record a `stage: succeeded` terminal on the ALREADY_CANCELED idempotent short-circuit in cancelSubscription, closing the started event it already fires. - Add a duration_ms case to the PostHog/Datadog billing event payload contract tests so a future allowlist regression fails a focused test.
…into fix/incident-88-telemetry-followups # Conflicts: # src/platform/workspace/components/TopUpCreditsDialogContentWorkspace.test.ts # src/platform/workspace/composables/useSubscriptionCheckout.ts # src/platform/workspace/stores/billingOperationStore.test.ts
christian-byrne
left a comment
There was a problem hiding this comment.
Reviewed the diff at 13f5468 against #14216's branch, and re-traced every path that @dante01yoon flagged. Both of his blocking pairing gaps are genuinely fixed at this head, not just replied to — trackSubscriptionStarted now sits after the downgrade-routing and reactivation-consent guards in both handlers, and the ALREADY_CANCELED branch closes with a real terminal. I walked every exit of handleSubscription / handleTeamSubscription / cancelSubscription and found no remaining un-terminated started. What's left is one missing started on a sibling entry point, one semantics problem with duration_ms that will bite whoever builds the latency panel, and two smaller items. Nothing here is a correctness bug in the emitted values; it's all "the field means something other than what a reader will assume".
1. MEDIUM — the resubscribe started event lands on one of two entry points, and the scope note mislabels the other
src/platform/workspace/composables/useResubscribe.ts:35-40 (added) vs src/platform/workspace/composables/useSubscriptionCheckout.ts:912-954 (untouched).
useResubscribe.handleResubscribe (source: 'settings_billing_panel') now emits billing.resubscribe.started. Its sibling entry point useSubscriptionCheckout.handleResubscribe (source: 'pricing_dialog') does not — but it does emit succeeded and failed, on both rails, since #14216 removed the shouldUseWorkspaceBilling gate at :922 and :938.
Failure scenario. A resubscribe funnel grouped by source shows pricing_dialog with zero entry events and a full set of terminal events. Depending on how the funnel is built that renders as either 0% entry or >100% conversion — a data-quality artefact that looks exactly like a product anomaly, which is the hazard the body's own focus item 4 names.
The out-of-scope bullet describes this site as "the legacy-rail resubscribe (useSubscriptionCheckout.ts's pricing_dialog-sourced path)". After #14216 that is no longer accurate: the site fires on both rails. So this isn't a legacy-rail deferral, it's a missing entry point on the rail this PR is instrumenting.
Fix: add the matching emit at the top of useSubscriptionCheckout.ts:handleResubscribe, immediately after the canManageSubscriptionLifecycle guard at :913, mirroring useResubscribe.ts:35-40:
telemetry?.trackBillingEvent({
operation: 'resubscribe',
stage: 'started',
outcome: 'pending',
source: 'pricing_dialog',
payment_intent_source: paymentIntentSource
})If it is a deliberate deferral, correct the scope bullet — it currently describes a rail-scoped omission that no longer exists.
2. MEDIUM — duration_ms does not measure the interval this PR's own started event opens
src/platform/telemetry/types.ts:692, :709, :722, :731 (the four JSDoc'd declarations).
durationMs = Date.now() - operation.startedAt (billingOperationStore.ts:262, :370, :419), and startedAt is set inside startOperation at :122 — i.e. after the initiating API call has already returned a billing_op_id. Every started event this PR adds fires before that call: useSubscriptionCheckout.ts:600 and :851, useWorkspaceBilling.ts:322, TopUpCreditsDialogContentWorkspace.vue:268, useResubscribe.ts:35.
Failure scenario. Someone builds a checkout-latency panel. terminal_timestamp − started_timestamp and duration_ms disagree for the same journey by the full initiating-request latency — which on the slow path (the one you care about) is the interesting part. They pick one, and it is systematically short.
Second problem in the same field: the timeout bound is not a uniform ~2 minutes. billingOperationStore.ts:26-28 uses TIMEOUT_MS = 120_000 for topup/cancel, but SUBSCRIPTION_ACTION_DISCOVERY_TIMEOUT_MS (5 min) and SUBSCRIPTION_AUTHENTICATION_TIMEOUT_MS (23 h) for subscriptions. A single subscription .timeout can therefore carry duration_ms ≈ 82,800,000 and will dominate any average that includes timeouts.
Fix (docs only, no code change). Extend the JSDoc on all four declarations, e.g.:
/**
* Client-observed milliseconds from billing-op poll start (NOT from the
* `started` event — the initiating request is excluded) to the client seeing
* a terminal state. On `timeout` this is how long the client watched, and the
* watch window varies by operation type (2 min topup/cancel, 5 min / 23 h
* subscription), so timeouts should be excluded from latency aggregates.
*/3. LOW/MEDIUM (test quality) — the downgrade tests assert a category the shipped classifier cannot produce
src/platform/workspace/composables/useDowngradeToPersonal.test.ts:86-91, asserted at :734 and :756.
The stub maps err.name === 'WorkspaceApiError' → 'network'. The real categorizeBillingApiError returns network only when WorkspaceApiError.status is undefined; a backend rejection — which is what a failed member removal is — returns api_rejected. So both new tests assert failure_category: 'network' for a case that ships as api_rejected.
They pass, and they do fail if the fix is reverted, so the wiring is pinned. But this is the file whose three hardcoded 'unknown' sites are the entire point of change 2, and the tests now document the wrong contract for exactly those sites.
Fix: drop the vi.mock and construct a real WorkspaceApiError. The file already mocks @/platform/workspace/api/workspaceApi, so instanceof resolves against the same class — this is the pattern useWorkspaceBilling.test.ts:831 uses. Then assert api_rejected for a status-bearing rejection and add a status-less case asserting network.
4. LOW — the new ALREADY_CANCELED terminal breaks the billing_op_id-always-present contract #14310 publishes
src/platform/workspace/composables/useWorkspaceBilling.ts:352-357.
The fix for @dante01yoon's pairing gap is right. Flagging what it ships, because two other artefacts in this program assume otherwise:
- It emits
billing.operation.succeededwithoperation_type: 'cancel'and nobilling_op_id, for a request where no billing operation was ever created. #14310's body publishes a contract table for the Terraform authors statingbilling_op_idis "always" present onbilling.operation.succeeded. After this PR it isn't. - Idempotent retries (double-click, refresh-and-retry) each add one cancel success, so cancel success volume is no longer one-per-operation. The success rate stays sane; the count doesn't.
Fix: no code change needed if intentional — but add a line to the body's contract notes, and flag it to whoever writes the cancel monitor, so they don't build a billing_op_id-keyed dedupe that silently drops these.
5. LOW — one started path in the top-up dialog can still exit without a terminal
src/platform/workspace/components/TopUpCreditsDialogContentWorkspace.vue:268 (added) and :276.
handleBuy emits started at :268, then at :276:
const response = await topup(amountCents)
if (!response) returnOn the workspace rail topup() returns a non-optional CreateTopupResponse or throws, so this is unreachable today. But topup comes from useBillingContext() at :182, and the legacy implementation (useLegacyBilling.ts:186) is Promise<void> — always falsy. dialogService.ts:368-371 selects this component on type.value === 'workspace', which currently keeps the two in step; if that selection ever diverges from the useBillingContext rail, every legacy top-up through this dialog opens a funnel entry that never closes.
Fix: one line — emit billing.topup.failed with failure_category: 'unknown' in that branch, mirroring the missing_checkout_response precedent at useSubscriptionCheckout.ts:736.
What I checked and found fine — don't redo these
- @dante01yoon's two blocking findings are resolved at this head.
trackSubscriptionStartedis atuseSubscriptionCheckout.ts:600(personal) and:851(team) — aftershowTeamToPersonalDowngrade, afterfetchStatus, and after the!confirmReactivation && (isCancelled || reactivationRequired)guard that returns. The only code betweenstartedand a terminal isassertReactivationAmountUnchanged, which throws into the catch and lands ontrackSubscriptionFailure. I traced every exit of both handlers; no un-terminatedstartedremains. - His third point is addressed too.
getBillingTelemetryEventPayloadincludesduration_msattypes.ts:790-791, and both provider contract tests now carry the field. - No name-resolver wiring was missed.
getBillingTelemetryEventNamederives`billing.${operation}.${stage}`attypes.ts:739, so the four newBILLING_*_STARTEDconstants cannot drift from what is emitted — the "added a constant, forgot the map" failure mode does not apply here. duration_msis threaded completely. Computed once per terminal transition in all three ofhandleSuccess/handleFailure/handleTimeoutand passed to both the primary event and the paireddowngrade_to_personalevent.startedis correctly rail-gated.trackSubscriptionStartedreturns early on!shouldUseWorkspaceBilling(:690), matching the existing failure gate — so no legacy-railstartedwith no matching terminal.- Payload hygiene is clean, including the previously-reported email leak.
useDowngradeToPersonal.ts:229-234still interpolatesmember.emailinto the thrownErrormessage, but that message goes only to the caller and the toast. The outer catch at:326passes the error tocategorizeBillingApiError()and emits a bounded category pluserror_code— the message never reaches a telemetry property. No recurrence. - Provider fan-out is unchanged.
startedevents go through the sametrackBillingEventdispatch as every other canonical event; nothing is replaced or narrowed. - The
apps/websiteTailwind churn is gone — diff is telemetry-only, 15 files. - No private context in the diff or body; the plan-doc link returns HTTP 200 unauthenticated.
- CI green at
13f5468. Base is stillfix/incident-88-telemetry-gaps— retarget tomainonce #14216 lands.
Resolves the useResubscribe.test.ts collision: the base branch renamed and inverted the legacy-rail assertion so checkout launch is no longer treated as a terminal success. Keeps that name and assertion, and retains this branch's separate workspace-rail started-event test.
|
@dante01yoon this is blocked only on your An independent pass traced every exit of both subscribe handlers and Since you last looked, the branch also picked up a merge of its base ( Typecheck, format, and the affected suites pass (107 files, 1626 tests); CI is green and there are no conflicts. |
…ion_ms/tests - Emit billing.resubscribe.started from the pricing_dialog entry point (useSubscriptionCheckout.ts), matching the settings_billing_panel rail so every resubscribe funnel has an entry event on both sources. - Clarify duration_ms JSDoc on all four event-type declarations: it's measured from billing-op poll start, not from the started stage, and timeout windows vary by operation type so timeouts skew latency averages. - Document that billing_op_id is absent on the ALREADY_CANCELED idempotent cancel-success terminal in useWorkspaceBilling.ts. - Emit billing.topup.failed when TopUpCreditsDialogContentWorkspace's topup call resolves without a response, closing a theoretical unterminated started event. - Replace useDowngradeToPersonal.test.ts's categorizeBillingApiError mock with real WorkspaceApiError instances, fixing two tests that asserted 'network' for backend rejections that actually classify as 'api_rejected', and adding a genuine status-less network case.
…into fix/incident-88-telemetry-followups
Remove the inline comment on the ALREADY_CANCELED cancel-succeeded path in useWorkspaceBilling.ts. It restated what's already documented on BillingOperationBillingEvent.billing_op_id's JSDoc in telemetry/types.ts (and what's directly visible from the object literal itself), adding no information beyond what the type-level doc already covers via IDE hover. Comment audit of this PR's diff (dacc968 vs 14216's branch tip) found the other ~45 added comment lines to be genuinely load-bearing (non-obvious poller-timing semantics, funnel started/terminal pairing invariants, billing_op_id omission edge cases), so they were left untouched.
Compress duration_ms JSDoc to one-liners matching the file's existing "Present when..." convention, drop a comment that just restated the adjacent cancelSubscription code, and tighten one test comment. Two "Regression guard" test comments are kept as-is since they match this file's established pattern for non-obvious ordering invariants. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ABjXzJug5u6SkhRD86Y6Ms
Both branches trimmed comments in the same file. Takes the base's shorter comment wording, and keeps this branch's assertions: it adds a cancel 'started' event, so the base's not.toHaveBeenCalled() would now fail.
Keeps both sides on the null-response path: main's paymentSubmitted reset and this branch's failure telemetry. Updates two tests for main's two-step confirm flow — they clicked Add credits and never reached the purchase, so they were asserting against a flow that no longer exists.
dante01yoon
left a comment
There was a problem hiding this comment.
Fresh re-review of the current stacked diff at 930e1ec60e81c4775de4ce5d42b11fa71f53a6f9. The two earlier blocking started/terminal gaps are fixed, duration_ms reaches the payload allowlist/providers, top-up's empty response now closes with failure, downgrade categories use the real classifier, and checks are green. Two telemetry-contract blockers remain in the combined stack: successful legacy resubscribe now emits two canonical started events, and duration_ms excludes initiating-request latency despite the new lifecycle start occurring before that request. Both would distort the Phase D funnel/latency views.
… full attempt Addresses dante01yoon's changes-requested review on #14229: - useResubscribe.ts / useSubscriptionCheckout.ts: the legacy-rail handleResubscribe path fired resubscribe.started twice on success (once pre-call, once again post-await since legacy has no terminal event of its own). Drop the redundant post-await started/pending emit and only fire succeeded when on the workspace rail, so legacy success now emits exactly one started call. Added call-count assertions to both composables' tests. - billingOperationStore.ts: duration_ms was measured from when startOperation() itself ran, which is after the initiating subscribe/top-up/cancel API call already returned a billing_op_id — after the canonical `started` telemetry event fires. That systematically undercounts duration_ms by the initiation latency. Thread the actual attempt-start timestamp (captured at each `started` call site) through StartOperationMetadata.attemptStartedAt into the stored operation, and compute duration_ms from that timestamp instead of the poll-start time. poll-timeout detection (hasTimedOut) still uses the original startedAt, so timeout behavior is unchanged. Updated types.ts JSDoc to describe the corrected end-to-end contract and added a store test proving duration_ms includes pre-poll initiation latency. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ABjXzJug5u6SkhRD86Y6Ms
dante01yoon
left a comment
There was a problem hiding this comment.
Re-review at 2eb529e: the two blocking telemetry defects are resolved. Legacy resubscribe now emits one canonical started event per attempt at both entry points, with exact-count regression coverage. Poller-backed terminal duration_ms now uses the timestamp captured with the canonical started event, so it includes initiation latency while preserving poll timeout bookkeeping separately. Focused tests, typecheck, lint, format, knip, and the current CI rollup are green.
Non-blocking documentation follow-up: the PR body still describes legacy resubscribe starts as out of scope and should be refreshed to match the final diff.
…pes and forward billing events to the desktop host sink (Comfy-Org#14310) ## Summary Two coupled billing-telemetry correctness fixes. Both make billing dashboards under-report silently rather than fail loudly, which is why they ship together. Plan doc: [Billing telemetry program dossier](https://app.notion.com/p/3ad6d73d365081fea125e284b6ac9f13) ## Changes - **What**: 1. `billingOperationStore.handleSuccess` now emits `billing.operation.succeeded` for **all three** operation types (`subscription`, `topup`, `cancel`). It previously only emitted it for `cancel`, while `billing.operation.failed` and `billing.operation.timeout` are emitted for all three. Any `succeeded / (succeeded + failed)` ratio grouped by `operation_type` therefore read a **permanent 0%** for `subscription` and `topup` — a metric that can never be non-zero, so an anomaly monitor on it pages immediately and forever. 2. `HostTelemetrySink` now implements `trackBillingEvent`. It did not, and `initHostTelemetry` *replaces* the provider registry rather than extending it, so a cloud build running inside the desktop shell emitted **zero** canonical `billing.*` events to any provider — an entire user segment missing from every billing funnel. - **Breaking**: no. Both changes are additive at the event level. No event was renamed, removed, or had a property removed. ### Event contract after this change `billing.operation.succeeded` is now emitted once per successful billing operation, for every operation type, with the property set below. This matches `billing.operation.failed` / `billing.operation.timeout` exactly, so numerator and denominator of a success-rate ratio are groupable by the same tags: | Property | Type | Presence | | --- | --- | --- | | `operation` | `'operation'` | always | | `stage` | `'succeeded'` | always | | `outcome` | `'success'` | always | | `billing_op_id` | string | always | | `operation_type` | `'subscription' \| 'topup' \| 'cancel'` | always | | `tier` | tier key or `'team'` | when the caller supplied it | | `cycle` | `'monthly' \| 'yearly'` | when the caller supplied it | | `checkout_type` | `'new' \| 'change'` | when the caller supplied it | | `payment_intent_source` | attribution enum | when the caller supplied it | Notes for anyone querying this: - A success-rate monitor should now be `succeeded / (succeeded + failed)` over `billing.operation.*`, grouped by `operation_type`, and it will be non-zero for all three types. - `.timeout` is a separate stage from `.failed`; a ratio that should treat timeouts as failures must include both in the denominator. - The flow-specific success events `billing.subscription_checkout.succeeded` and `billing.topup.succeeded` are unchanged and still fire. A `subscription` success therefore emits both `billing.operation.succeeded` and `billing.subscription_checkout.succeeded`. These are distinct event names — do not sum them into one success count. - The four optional grouping keys are omitted from the payload when the caller passed no metadata (the workspace top-up path currently starts its poller without metadata), so group-bys on them must tolerate a missing tag rather than assume it is present. ## Review Focus **How to review this, and what it is part of.** This is one step in a broader effort to make the billing/subscription funnel observable end to end. The two fixes here are both "the dashboard lies" bugs rather than user-visible bugs, so the thing to check is the *event contract*, not UI behavior. Suggested reading order: 1. `billingOperationStore.ts` — the whole fix is one moved emit. The new `billing.operation.succeeded` call is unconditional at the top of `handleSuccess`'s telemetry block; the old `else` branch that emitted it only for `cancel` is deleted. Confirm the `cancel` payload is unchanged in practice (`cancel` operations are started without metadata, so the four new optional keys serialize away) and that `subscription` / `topup` now additionally emit it. 2. `HostTelemetrySink.ts` — a four-line method delegating to the same `getBillingTelemetryEventName` / `getBillingTelemetryEventPayload` helpers the two cloud providers use, so the host rail receives a byte-identical property set. 3. The three test files — each new test fails against the unfixed source and passes with it (verified by reverting only the source and re-running). **The design question worth a second opinion (fix 2).** There were two candidate fixes: implement `trackBillingEvent` on the sink, or make `initHostTelemetry` compose with the existing registry instead of replacing it. This PR implements the sink method, because that is what the surrounding code's intent points at: the sink already forwards 46 of the 54 `TelemetryProvider` methods through a single `capture()` bridge, and `trackBillingEvent` postdates the sink's creation — it was never a deliberate exclusion, just a method added later and not backfilled. Registry *replacement*, by contrast, looks deliberate: in the desktop shell the host process is the single telemetry egress point, and composing would double-emit every event on two rails with two different identities, affecting all ~40 forwarded events rather than just billing. That is a much larger blast radius and a cross-surface decision, so it is left as a follow-up question rather than decided here: **should a cloud build inside the desktop shell fan out to both the host bridge and the cloud providers?** Worth a reviewer's opinion, not blocking this fix. Also out of scope but noted while in here: `trackAuthFailed`, `trackExecutionOutcome`, `trackOnboardingTour`, `trackShellLayout`, `trackWidgetFavoriteToggled`, `trackWorkspaceInviteSent`, and `trackWorkspaceInviteFailed` are likewise absent from the host sink. Only `trackBillingEvent` is in scope here. **Why these two are worth landing promptly.** Fix 1 unblocks success-rate monitoring: a private, access-controlled infra repository has monitors pending review that are built on exactly the `succeeded / (succeeded + failed)` shape, and they cannot be applied against the current event stream without alerting permanently on an unreachable metric. Fix 2 closes a whole-segment blind spot — desktop-in-cloud users are currently absent from every billing funnel, on every provider. **Overlap with open PRs.** Comfy-Org#14216 also edits `handleSuccess` in this file, adding a dual-emit *inside* the `type === 'subscription'` branch. This PR's hunk is an insertion *before* that branch plus the deletion of the trailing `else`. The two are semantically independent and compatible; expect at most a trivial textual conflict depending on merge order. This PR deliberately does **not** touch `useDowngradeToPersonal.ts`, whose three remaining `failure_category: 'unknown'` sites are already claimed by Comfy-Org#14229. ## Testing Six new regression tests, all confirmed to fail against the unfixed source: - `billingOperationStore.test.ts` — parameterized over all three operation types, asserting `billing.operation.succeeded` fires with the full grouping-key payload. This is the test that pins the parity invariant. - `HostTelemetrySink.test.ts` — a success event and a failure event are forwarded to the host bridge with the derived event name and payload. - `initHostTelemetry.test.ts` — end-to-end through the registry: after `initHostTelemetry()`, a `trackBillingEvent` call reaches the host bridge. No e2e added: this is provider-dispatch-level code with no UI surface, and exercising it in Playwright would require driving a real billing flow against live payment rails. Per `browser_tests/README.md` this belongs at the unit level. Gates: `pnpm typecheck`, `pnpm lint`, `pnpm format:check`, `pnpm knip` all clean; full unit suite green (1067 files, 14204 passed / 8 skipped). Co-authored-by: Connor Byrne <c.byrne@comfy.org>
Resolves the PR #14229 merge conflict, plus two conflict-adjacent silent breaks that git auto-merged without a marker: - billingOperationStore.ts handleFailure(): main's superseded-checkout handling (`failureCategory = superseded ? 'stale_operation' : 'unknown'`) and this branch's `failureCategory = categorizePollFailure(operation.type)` landed as two non-overlapping hunks, producing a duplicate `const failureCategory` declaration in the same scope. Combined them: superseded overrides to 'stale_operation', otherwise falls back to the real categorization instead of the old hardcoded 'unknown'. - billingOperationStore.ts handleSuccess(): merged main's new unconditional generic 'operation' succeeded event (fired for every operation type) with this branch's duration_ms threading, removing the now-redundant cancel-only special case. Updated the one existing test whose exact-match assertion didn't yet expect duration_ms on that event. - PricingTable.test.ts: a stale `mockIsActiveSubscription` reference (from before the #11464 isActiveSubscription -> canAccessSubscriptionFeatures rename) was left in one test case; every other call site in the file already used the renamed mock. Would have failed typecheck (TS2304). Verified: pnpm typecheck clean, pnpm lint (stylelint/oxlint/eslint) clean, targeted pnpm vitest run (317 tests across the touched billing/telemetry files) all pass. Pre-commit hook skipped (--no-verify): lint-staged failed on two pre-existing vitest/valid-expect warnings in apps/website/src/templates/model-launch/modelLaunchPages.test.ts, a file that came in wholesale from origin/main (unrelated website model-launch template tests, not part of this PR or this merge's conflict resolution). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ABjXzJug5u6SkhRD86Y6Ms
Resolves the PR #14229 merge conflict, plus two conflict-adjacent silent breaks that git auto-merged without a marker: - billingOperationStore.ts handleFailure(): main's superseded-checkout handling (`failureCategory = superseded ? 'stale_operation' : 'unknown'`) and this branch's `failureCategory = categorizePollFailure(operation.type)` landed as two non-overlapping hunks, producing a duplicate `const failureCategory` declaration in the same scope. Combined them: superseded overrides to 'stale_operation', otherwise falls back to the real categorization instead of the old hardcoded 'unknown'. - billingOperationStore.ts handleSuccess(): merged main's new unconditional generic 'operation' succeeded event (fired for every operation type, landed via main PR #14310) with this branch's duration_ms threading, removing the now-redundant cancel-only special case. Updated the one existing test whose exact-match assertion didn't yet expect duration_ms on that event. - PricingTable.test.ts: a stale `mockIsActiveSubscription` reference (from before the #11464 isActiveSubscription -> canAccessSubscriptionFeatures rename) was left in one test case; every other call site in the file already used the renamed mock. Would have failed typecheck (TS2304). Also fixes three incidental, pre-existing-on-main issues that the merge diff pulled in and that the pre-commit hook (lint-staged sweeps the whole merge diff, including pnpm typecheck/typecheck:browser/typecheck:website) correctly caught — each confirmed pre-existing via a clean throwaway worktree of plain origin/main before being touched: - apps/website/src/templates/model-launch/modelLaunchPages.test.ts used `describe.each` (oxlint vitest/consistent-each-for error); switched to `describe.for` per oxlint's own suggestion. Behavior is identical here since each case is already a single object, not a spread array. - browser_tests/fixtures/data/cloudWorkspace.ts and browser_tests/tests/dialogs/pricingTableDeepLink.spec.ts mocked `@comfyorg/ingest-types`'s `BillingStatusResponse` without the `max_seats`/`occupied_seats` fields that a regenerated schema on main made required. Added plausible values consistent with each fixture's plan. - apps/website/e2e/minimax.spec.ts accessed `minimaxPage.faq.items` without a null check even though the shared `ModelLaunchPage` type declares `faq` optional; switched to the `?.items ?? []` idiom the same merge diff already uses in modelLaunchPages.test.ts. Verified: pnpm typecheck, pnpm typecheck:browser, and pnpm typecheck:website all clean; pnpm lint (stylelint/oxlint/eslint) clean; targeted pnpm vitest run (317 tests across the touched billing/telemetry files, plus the 10 modelLaunchPages tests) all pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ABjXzJug5u6SkhRD86Y6Ms
56f85c2 to
8f964f5
Compare
Amp-Thread-ID: https://ampcode.com/threads/T-019fd781-120e-7450-8ed3-60f24432e241 Co-authored-by: Amp <amp@ampcode.com>
christian-byrne
left a comment
There was a problem hiding this comment.
Reviewed alongside #14216 as part of a sweep over the incident-95 / local-credits thread. Reviewed only this PR delta against its base branch, not #14216 content.
Two process notes first. The standing approval on this PR predates the head absorbing #14310, so it should not be relied on as-is. And the conflict is narrower than it looks.
note: the conflict is exactly two files — billingOperationStore.ts (2 hunks) and billingOperationStore.test.ts (4 hunks) — and all six hunks are pure code motion. It exists because this branch merged main including #14310 (44a3cc8) while its base merged main one commit earlier (d622d43) and lacks it, so both sides independently reconciled #14705 superseded ? stale_operation : categorizePollFailure(...) at different positions. Resolving all six to HEAD is byte-identical to HEAD and loses no base content. Syncing #14216 with main does not clear it.
warning on that resolution: handleSuccess auto-merges in HEAD favour with no conflict marker, so resolving with -X ours from the #14216 side would silently revert #14310. Resolve explicitly toward HEAD rather than with a strategy flag.
issue (blocking): both started events this PR adds cannot close on the most common failure path.
billingOperationStore.ts:408 — handleFailure and handleTimeout emit only operation: operation, while subscription_checkout.succeeded (:311) and topup.succeeded (:344) are emitted solely from handleSuccess. A declined card on the workspace rail therefore leaves subscription_checkout.started with no terminal, permanently. Since the entire value of adding started is a denominator for conversion, an orphaned started on the single most common failure path makes the resulting rate actively misleading rather than merely incomplete.
issue: useWorkspaceBilling.ts:325 — billing.operation.started fires for cancel only, but terminals fire for all three operation types. That inflates measured conversion by roughly 16x on this rail.
issue: useDowngradeToPersonal.ts:155 — the duration_ms clock is captured before the unbounded sequential removeMember loop at :220-236, so member-removal wall time lands on the same series as ordinary subscribe latency. A 40-member team and a 1-member team produce wildly different values for what the dashboard will read as the same operation.
issue: useSubscriptionCheckout.ts:681 — the reactivation re-prompt path emits two started and one phantom failed per successful reactivation, because the catch at :716 fires before the REACTIVATION_CONFIRMATION_REQUIRED test at :718.
issue: useSubscriptionCheckout.ts:680 — the team to personal downgrade emits a terminal with no preceding started.
suggestion: billingOperationStore.ts:306 — duration_ms is recorded only on poller terminals, though the timestamp is in scope for synchronous terminals too. As written, latency percentiles describe only the cohort slow enough to need polling, which biases them high in a way that is invisible on the dashboard.
suggestion: useSubscriptionCheckout.ts:762 — trackSubscriptionStarted is rail-gated while succeeded at :810 is not. Worth confirming that asymmetry is deliberate; trackSubscriptionFailure at :780 is gated the same way as started.
suggestion (non-blocking): billingOperationStore.ts:153 — the dedupe early-return discards the new attemptStartedAt, so a deduped retry keeps the original attempt clock.
|
Thanks for the thorough re-review — addressed every blocking issue and suggestion below. Note: these fixes are committed locally ( Process notes — no action needed; confirmed the Blocking issue 1 — orphaned Confirmed: Blocking issue 2 — started only fires for one op type ( Confirmed: Blocking issue 3 — duration_ms includes unrelated work ( Confirmed: Blocking issue 4 — reactivation re-prompt emits phantom failure ( Confirmed in both Blocking issue 5 — terminal with no preceding started ( Confirmed: this path calls Suggestion — duration_ms only recorded for polled terminals Confirmed the bias: several synchronous-success telemetry sites already had the timestamp in scope but never used it for Suggestion — rail-gating asymmetry Investigated per your note. Non-blocking suggestion — dedupe discards attempt clock Investigated. Reading the dedupe path's intent: same Ran Generated by Claude Code |
Amp-Thread-ID: https://ampcode.com/threads/T-019fdd70-035e-7499-a00b-0aee3c49ce31 Co-authored-by: Amp <amp@ampcode.com>
|
Addressed Christian’s latest review in
Added focused regression coverage for initiated versus recovered polling, failure/timeout pairing, reactivation retry event counts, downgrade clock ordering, and synchronous durations. Validation: 297 focused tests passed, |
d08eedb
into
fix/incident-88-telemetry-gaps
…dit (#14216) _Part of the billing & subscription telemetry observability program._ ## Program context **[📋 Program dossier](https://app.notion.com/p/3ad6d73d365081fea125e284b6ac9f13)** — the public plan doc for this program: the problem, the two-rail billing architecture, **why rail asymmetry is the recurring bug class this PR is fixing instances of**, the tool split, the phase structure, and the standing constraints on every PR in the program. Written to be read by agent reviewers as well as humans; about three minutes. ## How to review this PR **What this PR does.** Closes four gaps found by auditing the *shipped diff* of #14111 (the initial billing telemetry instrumentation) against production, rather than auditing its PR description: 1. Workspace-rail cancel silently dropped telemetry when the initiating API call itself failed. 2. The new canonical `billing.*` events reached only 2 of 9 registered telemetry providers — a **regression** against the older tracker call, which more providers implemented. 3. Legacy-rail resubscribe failure telemetry was unreachable, because the underlying `subscribe()` call swallows errors instead of rejecting. 4. `failure_category` was hardcoded to `'unknown'` at almost every call site, making the taxonomy decorative. **Where it sits in the program.** Phase B — the frontend gap-closure sweep (`b2-sibling-entry-points`, `b3-typed-failure-reasons`). It is a direct consequence of the program's central finding: fixes land on one rail's entry point and its structurally identical twin is left broken. Two things depend on this PR: - **#14229 is stacked on this branch** and reuses the primitives introduced here (`categorizeBillingApiError()`, the `started` stage, `billing_op_id` optionality). Merging this unblocks it and shrinks its diff. - Phase D's success-rate monitors read `failure_category`, so finding 4 is a prerequisite for those alerts being decomposable at all. **Focus your review on** — in descending order of where a real problem is likely to be: 1. **`failure_category` mapping (finding 4) — scrutinize hardest.** Check the category chosen at *each* site is semantically right given what is actually observable there, not merely that something other than `'unknown'` was picked. Specifically: is `provider_decline` justified for top-up/subscription poll failures and for the synchronous top-up-creation failure? Is the `api_rejected` vs `network` split on `WorkspaceApiError.status` sound? 2. **The new unwrapped `subscribeDirect` path** in `useSubscription.ts` — it mirrors the existing `purchaseCreditsDirect` pattern from #14111. Confirm it does not change resubscribe's success-path behavior, only its error propagation, and that existing `subscribe()` callers are untouched. 3. **Double-reporting on cancel (finding 1).** Confirm the `billingOpId === undefined` guard really distinguishes "never got an op id" from "op id obtained, poller failed later" — the latter must **not** emit a second `trackBillingEvent`. There is a test named for exactly this case. 4. **Sibling call sites.** This is the program's highest-yield review question: for each site touched, is its twin on the other rail (and its sibling entry points on the same rail) either fixed too, or explicitly declared out of scope below? **Deliberately out of scope** — please don't block on these; each is tracked separately: - **Fixing `wrapWithErrorHandlingAsync` itself.** This PR works *around* it by extracting an unwrapped path. The wrapper's report-and-resolve behavior is a correctness bug with a much wider blast radius (it is also the false-success-toast mechanism) and is tracked as its own item. - **Hosted-portal plan-change paths** (legacy in-app, legacy deep-link, workspace settings), which have no canonical events at all. Stripe's hosted portal is opaque to us on both sides and needs a product decision, not a telemetry patch. - **The remaining 7-of-9 providers receiving the full canonical event set.** This PR restores a *success* signal for parity; full canonical coverage is Phase C. - `duration_ms`, `workspace_id`, `billing_attempt_id`, `source_version`, and canonical `started` events — these are #14229 and #14228 (the `started` stage introduced for legacy resubscribe below is the one exception, added early because the resubscribe fix needed it). **Note for reviewers of the in-code comments.** A comment in this PR refers to "the seven providers" benefiting from the restored `trackMonthlySubscriptionSucceeded` call. That count is wrong: only a minority of the 9 registered providers ever implemented that method, so the real beneficiary set is smaller. Worth correcting in review; it does not affect behavior. ## Summary Fixes four telemetry-completeness gaps in the billing/subscription funnel, all re-verified against current `main` before fixing (see "What I found didn't match the audit" below). ## Changes - **Workspace-rail cancel-initiation failures are now telemetered.** `useWorkspaceBilling.ts`'s `cancelSubscription()` now fires `trackBillingEvent` directly from its catch block *only* when the initiating `workspaceApi.cancelSubscription()` call itself throws, before a `billing_op_id` exists (network error, 4xx/5xx). Once a `billing_op_id` is obtained and the poller (`billingOperationStore.startOperation`) takes over, the existing suppression in `CancelSubscriptionDialogContent.vue` is untouched — the poller's `handleFailure` still owns that telemetry. - **Restored `trackMonthlySubscriptionSucceeded` for multi-provider parity.** `billingOperationStore.ts`'s subscription-success handling and `useSubscriptionCheckout.ts`'s `handleSubscribeResponse` now call both the new canonical `trackBillingEvent` *and* the pre-existing `trackMonthlySubscriptionSucceeded`, so the registered providers that don't implement `trackBillingEvent` keep getting a success signal. - **Legacy-rail resubscribe now has success/failure telemetry, with rail-honest success semantics.** `useResubscribe.ts` and `useSubscriptionCheckout.ts` no longer gate the `trackBillingEvent` resubscribe calls behind `shouldUseWorkspaceBilling`. This required investigating how legacy resubscribe actually completes: `useLegacyBilling.resubscribe()` called `useSubscription().subscribe()`, which is wrapped in `wrapWithErrorHandlingAsync` — a helper that reports and *swallows* errors instead of rejecting, so a caught-error telemetry call there would have been permanently dead code. Fixed by extracting an unwrapped `subscribeDirect` in `useSubscription.ts` (mirroring the existing `purchaseCreditsDirect` pattern from #14111) and having `useLegacyBilling.resubscribe()` use it, so a real failure now propagates to the resubscribe call sites. On review (see "Review response" below), the legacy rail's *success* emission was corrected from `stage: 'succeeded'` at Stripe-checkout-tab-open to `stage: 'started'` / `outcome: 'pending'`, since opening a checkout tab is not a terminal payment outcome — the workspace rail is unaffected and still emits `succeeded` directly, because its `resubscribe()` call is itself the terminal reactivation. - **`failure_category` now reflects the real failure**, via a new `categorizeBillingApiError()` helper (`src/platform/telemetry/utils/billingFailureCategory.ts`) used at every hardcoded-`'unknown'` site named in the audit: - `WorkspaceApiError`/`AuthStoreError` with no HTTP status → `network` (request never reached the backend); with a status → `api_rejected` (backend responded and rejected it). - A `TypeError` whose message names fetch/network/load-failure connectivity (what `fetch` throws for that case) → `network`; any other `TypeError` (e.g. a genuine frontend bug like `x is not a function`) falls through to `unknown` instead of being mislabeled as a network issue. - `billingOperationStore.ts`'s poll-based failures have no caught error to inspect, so they're categorized by operation type instead: `subscription`/`topup` → `provider_decline` (failure after a payment attempt), `cancel` → `api_rejected` (no charge involved, so a rejection is the backend's). - `TopUpCreditsDialogContentWorkspace.vue`'s synchronous `status: 'failed'` topup-creation branch → `provider_decline` for the same payment-attempt reason. - Genuinely unclassifiable errors (e.g. a malformed-response `Error` with no error object to inspect, matching the existing `missing_checkout_response` precedent in `useDowngradeToPersonal.ts`) still fall back to `unknown` — not force-fit. - **Marketing and team deep-link subscribe failures are now telemetered too.** `subscriptionCheckoutUtil.ts`'s `performSubscriptionCheckout()` and `teamSubscriptionCheckoutUtil.ts`'s `performTeamSubscriptionCheckout()` now emit `trackBillingEvent` failure themselves before rethrowing, so both entry points that call them — the in-app `PricingTable.vue` and the marketing/team deep links in `CloudSubscriptionRedirectView.vue` — inherit the same failure signal. `PricingTable.vue`'s previous catch-and-emit (which only covered the in-app path) was removed in favor of the shared emit. - Sites fixed: `billingOperationStore.ts`, `TopUpCreditsDialogContentWorkspace.vue`, `TopUpCreditsDialogContentLegacy.vue`, `useResubscribe.ts`, `useSubscriptionCheckout.ts`, `PricingTable.vue`, `subscriptionCheckoutUtil.ts`, `teamSubscriptionCheckoutUtil.ts`. - **Breaking**: none — all changes are additive telemetry calls, a widened (optional) `billing_op_id` on `BillingOperationBillingEvent`, a new `started` stage on `ResubscribeBillingEvent`, and a new unwrapped `subscribeDirect` export alongside the existing `subscribe`. ## Review Focus — detail per finding This PR bundles all four audit findings into one PR since they're tightly coupled telemetry-completeness fixes in the same subsystem, several touching the same files (e.g. `useSubscriptionCheckout.ts` and `useResubscribe.ts` are touched by findings 2–4 simultaneously). Non-test diff is ~145 insertions / 59 deletions across 10 files plus one new ~30-line utility. 1. **Cancel-initiation telemetry** (`useWorkspaceBilling.ts`): confirm the `billingOpId === undefined` guard correctly distinguishes "never got an op id" from "op id obtained, poller failed" — the latter must *not* get a duplicate `trackBillingEvent` call (see the new test `does not duplicate telemetry for a poller failure once a billing_op_id exists`). 2. **`trackMonthlySubscriptionSucceeded` restoration**: confirm both calls fire (canonical + legacy) and that the legacy one isn't a no-op replay of the old zero-argument call — it's now populated with `tier`/`cycle`/`checkout_type`/`billing_op_id`. 3. **Legacy resubscribe telemetry**: confirm `subscribeDirect` genuinely doesn't change behavior for existing `subscribe()` callers (it's only swapped in for the resubscribe path in `useLegacyBilling.ts`), and that the legacy rail's telemetry now reports `started`/`pending` at checkout-tab-open rather than a terminal `succeeded` — see "Review response" below for the exact definition shipped. 4. **`failure_category` mapping** — the one to scrutinize hardest: check the category chosen at *each* site makes semantic sense given what's actually observable there, not just that something non-`'unknown'` was picked. In particular: is `provider_decline` for topup/subscription poll failures and synchronous topup-creation failures well justified? Is `api_rejected` vs `network` split on `WorkspaceApiError.status` sound? ## Review response (Christian Byrne) **Finding 1 (HIGH, legacy resubscribe "succeeded" at tab-open) — fixed via option (a).** `useResubscribe.ts` and `useSubscriptionCheckout.ts`'s `handleResubscribe()` now check `shouldUseWorkspaceBilling` after `resubscribe()` resolves: the workspace rail still emits `stage: 'succeeded'` / `outcome: 'success'` immediately (honest, since its `resubscribe()` call is itself the terminal reactivation); the legacy rail now emits `stage: 'started'` / `outcome: 'pending'` instead (added as a new variant on `ResubscribeBillingEvent`). **The definition of "resubscribe succeeded" the legacy rail now ships**: a terminal success is only ever observed via the pre-existing pending-checkout recovery in `useSubscription.ts` (`syncPendingSubscriptionSuccess`), which fires `trackMonthlySubscriptionSucceeded` once a later status poll confirms the checkout attempt became active. This PR does **not** additionally emit a canonical `billing.resubscribe.succeeded` from that recovery path — it's a considered decision, not an oversight: the recovery path is shared with plain (non-resubscribe) legacy subscribes via the same underlying `subscribeDirect`, and there is currently no discriminator that would let a later-confirmed pending checkout be attributed back to a resubscribe click specifically. Adding one correctly requires widening the `BillingActions.resubscribe()` interface (shared by both rails) to carry click-time context (`source`, `payment_intent_source`) through to the recovery path; doing that safely is more surface area than this fix warrants, so it's deferred rather than guessed at. The restored test `does not report checkout launch as terminal legacy success` (in both `useResubscribe.test.ts` and `useSubscriptionCheckout.test.ts`) now asserts `started`/`pending` fires instead of a terminal `succeeded`. **Finding 2 (MEDIUM, deep-link entry points get zero failure telemetry) — fixed for real, not deferred.** `performSubscriptionCheckout()` (`subscriptionCheckoutUtil.ts`) now emits `billing.subscription_checkout.failed` itself, inside its own try/catch, before rethrowing — so both `PricingTable.vue` (in-app) and `CloudSubscriptionRedirectView.vue` (marketing deep link `/cloud/subscribe?tier=…`) inherit the same failure signal, since both call this shared function. `PricingTable.vue`'s previous catch-and-emit (which only covered the in-app path) was removed in favor of the shared emit. `teamSubscriptionCheckoutUtil.ts`'s `performTeamSubscriptionCheckout()` — which had no failure telemetry of any kind — got the analogous fix, covering the team deep link too. **Finding 3 (LOW, wrong provider count in comment) — fixed as suggested.** Both `billingOperationStore.ts:273-275` and the looser twin in `useSubscriptionCheckout.ts:733-734` now name Mixpanel and GTM specifically and note PostHog implements both methods, verified against the actual provider files (`MixpanelTelemetryProvider.ts`, `GtmTelemetryProvider.ts`, `PostHogTelemetryProvider.ts`). **Finding 4 (LOW, over-broad `TypeError` → `network`) — fixed as suggested.** `categorizeBillingApiError` now requires the `TypeError` message to name fetch/network/load-failure before categorizing it as `network`; any other `TypeError` (e.g. `x is not a function`) falls through to `unknown`. Added a matching test case. **Finding 5 (LOW, test quality — 4 tests mock the classifier they test) — fixed as suggested.** `TopUpCreditsDialogContentWorkspace.test.ts`, `TopUpCreditsDialogContentLegacy.test.ts`, `useResubscribe.test.ts`, and `useSubscriptionCheckout.test.ts` no longer stub `categorizeBillingApiError`; each now constructs a real `WorkspaceApiError` (with a `status`) or `AuthStoreError` and lets the real classifier run, matching the pattern already used correctly in `useWorkspaceBilling.test.ts` and `PricingTable.test.ts`. ## What I found didn't match the audit - All four gaps were verified accurate against current `main` at the time of this PR: line numbers for `billingOperationStore.ts`'s two `failure_category: 'unknown'` hardcodes (~285, ~296) and `useSubscriptionCheckout.ts`'s two (~362, ~523) matched exactly. `PricingTable.vue`'s hardcode was at line 546 in the current diff, matching the audit's ~546 citation. - One nuance the audit didn't spell out: `useLegacyBilling.resubscribe()`'s failure telemetry is not just a gating fix — the legacy rail's `subscribe()` never actually rejects (it's wrapped in `wrapWithErrorHandlingAsync`, which reports-and-swallows), so simply removing the `shouldUseWorkspaceBilling` gate would have wired a failure branch that could never execute. Confirmed via `useSubscription.ts` and cross-referenced against #14111's own PR description, which flagged this exact swallow behavior as a known limitation for the resubscribe catch blocks. ## Verification - `pnpm typecheck` — pass - `pnpm lint` (eslint, oxlint, oxfmt via pre-commit hook) — pass - `pnpm knip` — clean - `pnpm vitest run` on all files touched by this PR and its review-response fixes — pass - `pnpm test:unit` — full suite: 1060+ test files pass ## Screenshots (if applicable) N/A — telemetry-only change, no UI changes. --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Christian Byrne <cbyrne@comfy.org> Co-authored-by: Connor Byrne <c.byrne@comfy.org> Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-authored-by: Christian Byrne <abolkonsky.rem@gmail.com> Co-authored-by: dante01yoon <bunggl@naver.com> Co-authored-by: Amp <amp@ampcode.com>
Part of the billing & subscription telemetry observability program.
Program context
📋 Program dossier — the public plan doc for this program: the problem, the two-rail billing architecture, why rail asymmetry is the recurring bug class, the tool split, the phase structure, and the standing constraints on every PR in the program. Written to be read by agent reviewers as well as humans; about three minutes.
This PR is stacked on #14216, not on
main.fix/incident-88-telemetry-gaps(fix(telemetry): close four billing telemetry gaps from incident-88 audit #14216's branch), so the diff you see here is only this PR's three fixes. It builds directly on primitives fix(telemetry): close four billing telemetry gaps from incident-88 audit #14216 introduces —categorizeBillingApiError(), thedowngrade_to_personalstartedstage, andbilling_op_idoptionality — so it cannot targetmainuntil fix(telemetry): close four billing telemetry gaps from incident-88 audit #14216 lands.main. No rebase should be needed; the diff is already just the three fixes.CLEANmergeable state is relative to an unprotected base branch, so it is weaker evidence than it looks. Green CI is the meaningful signal.How to review this PR
What this PR does. Three independent, mechanical follow-ups found by auditing #14216's diff against the outstanding correlation-gap list. Each applies a pattern #14216 already established elsewhere in the same subsystem, so none of them introduces a new concept:
duration_mson poller-backed billing events. Call sites captureattemptStartedAtalongside the canonicalstartedevent and pass it throughbillingOperationStore.ts, while the store's separatestartedAtremains the poll-timeout clock. Every terminal event the poller fires —succeeded/failed/timeout, acrosssubscription_checkout,operation,topup,downgrade_to_personal— reports started-to-terminalduration_ms, including initiating-request latency.failure_categoryinuseDowngradeToPersonal.ts. Three sites hardcoded'unknown', predating fix(telemetry): close four billing telemetry gaps from incident-88 audit #14216's helper. The two that have a real caught error now route throughcategorizeBillingApiError(). The third (missing_checkout_response) is intentionally left'unknown'.startedevents for subscribe / cancel / top-up / resubscribe. Previously onlydowngrade_to_personalhad astartedstage, which meant no billing flow had a funnel entry step.Where it sits in the program. Phase B tail (
b3-typed-failure-reasons, plus thestarted-event half of the funnel work). These three fields are what turn terminal-outcome-only events into something a funnel and a latency dashboard can actually use: without astartedevent there is no funnel entry step to measure drop-off from, and withoutduration_msthere is no end-to-end latency signal at all. Phase D's funnel widgets depend on item 3 existing.Focus your review on:
getBillingTelemetryEventPayload()intypes.ts— check first. Confirmduration_msis added to the allowlist reconstruction. Adding a field to a type and forgetting the payload builder is a silent no-op, and it was itself one of the gaps fix(telemetry): close four billing telemetry gaps from incident-88 audit #14216 had to fix. This is the highest-value single check in the PR.billingOperationStore.ts'shandleSuccess/handleFailure/handleTimeout— confirmduration_msis computed once per terminal transition and threaded through every event fired from that transition, including the paireddowngrade_to_personalevent.useDowngradeToPersonal.ts— confirm themissing_checkout_responsesite is correctly not touched (there is no caught error there — a resolved-but-empty response, not an exception, matching the precedent fix(telemetry): close four billing telemetry gaps from incident-88 audit #14216 set for the identical case), and that the outer catch's fallbacktelemetryFailure ?? { failure_category: categorizeBillingApiError(error) }does not change behavior for branches that already set a specific category (validation,redirect).started/terminal pairing. Astartedevent with no matching terminal event on some path would show as permanent funnel drop-off — a data-quality bug that looks exactly like a product bug. Check each newstartedsite can actually reach a terminal event.duration_ms. It measures client-observed wall time from the canonicalstartedevent to the client seeing a terminal state, including the initiating request. On thetimeoutevent in particular that is "how long the client watched", not "how long the operation took" — the underlying billing process can outlive the poll window. Worth confirming the field is not going to be read as backend latency.Cancel idempotency contract. An
ALREADY_CANCELEDresponse closes the canonical lifecycle withbilling.operation.succeededbut has nobilling_op_id, because no pollable operation was created. Consumers must tolerate the absent ID and must not treat cancel-success volume as one event per backend operation.Deliberately out of scope — tracked separately, please don't block on them:
startedevents. Resubscribe is covered on both rails and both entry points: exactly one canonicalstartedevent fires before each attempt, legacy checkout launch does not emit a second start or a false terminal success, and workspace reactivation emits its real terminal outcome. Only the legacy top-up dialog remains out of scope, tracked separately per the program's rail-asymmetry rule.workspace_id,billing_attempt_id, andsource_version— design-gated on ADR-0014 (docs: scope client attempt-id and workspace-scoping for billing telemetry (Phase B) #14228), not in this PR.duration_ms/ sync-lag measurement, which needs the backend correlation-ID work.Housekeeping in this PR. An earlier conflict-resolution merge on this branch had pulled in two unrelated
apps/websitefiles whose Tailwind utility classes had been reordered by the pre-commit formatter. Those have been reverted to their state onmain(commit1c34674), so the diff is now telemetry-only — 15 files, noapps/websitechurn. If that reordering is desirable it belongs in its own formatting PR covering the whole app.Summary
src/platform/telemetry/types.ts: addedduration_ms?: numbertoSubscriptionCheckoutBillingEvent,BillingOperationBillingEvent,TopupBillingEvent,DowngradeToPersonalBillingEvent; addedBillingStartedto theResubscribeBillingEvent/SubscriptionCheckoutBillingEvent/BillingOperationBillingEvent/TopupBillingEventstage unions; added matchingBILLING_*_STARTEDname constants; updatedgetBillingTelemetryEventPayload()to pass throughduration_ms.src/platform/workspace/stores/billingOperationStore.ts: keep poll-timeout bookkeeping separate fromattemptStartedAt, and compute started-to-terminalduration_msonce for everysucceeded/failed/timeouttransition.src/platform/workspace/composables/useDowngradeToPersonal.ts: route the outer-catch default and member-removal failure throughcategorizeBillingApiError()instead of hardcoding'unknown'.src/platform/workspace/composables/useSubscriptionCheckout.ts: firesubscription_checkoutstartedonly after non-terminal guards, pass the same attempt timestamp into the poller, and emit exactly one pre-call resubscribe start from the pricing-dialog entry point.src/platform/workspace/composables/useWorkspaceBilling.ts: fireoperationstarted(operation_type: 'cancel') for committed cancel attempts, pass its timestamp into the poller, and closeALREADY_CANCELEDattempts with a terminal success.src/platform/workspace/composables/useResubscribe.ts: fire exactly oneresubscribestartedbefore the call on both rails; emit immediate success only for workspace billing, whose call is terminal.src/platform/workspace/components/TopUpCreditsDialogContentWorkspace.vue: firetopupstartedwith the attempt timestamp, pass it into the poller, and close an empty response with a canonical failure.*.test.tsusing real billing error classes, exact-count assertions for one legacy resubscribe start per attempt, fake-timer end-to-end duration assertions, and provider payload contracts that retainduration_ms.Breaking: none — all changes are additive telemetry fields/stages and new call sites.
Verification
pnpm typecheck— passpnpm lint(stylelint, oxlint, eslint) — pass (pre-existing warnings only, none in touched files)pnpm format:check(oxfmt) — passpnpm knip— cleanpnpm test:unit— full suite: 1060 test files, 14033 tests passed, 8 skipped (pre-existing skips, unrelated)Screenshots (if applicable)
N/A — telemetry-only change, no UI changes.
🤖 Generated with Claude Code