Repository navigation
fix(telemetry): close four billing telemetry gaps from incident-88 audit - #14216
Conversation
- Fire trackBillingEvent directly from useWorkspaceBilling's cancelSubscription when the initiating API call fails before a billing_op_id exists, so this failure mode isn't silently untelemetered (the poller-based path is left untouched). - Restore trackMonthlySubscriptionSucceeded alongside the new trackBillingEvent call in billingOperationStore and useSubscriptionCheckout, so the seven providers that don't implement trackBillingEvent keep getting a success signal. - Add resubscribe outcome telemetry on the legacy rail (useResubscribe, useSubscriptionCheckout), exposing an unwrapped subscribeDirect in useSubscription so legacy resubscribe failures actually propagate instead of being swallowed by wrapWithErrorHandlingAsync. - Replace hardcoded failure_category: 'unknown' with real categorization (network/api_rejected/provider_decline) based on the error or context actually available at each site, via a new shared categorizeBillingApiError helper. - Fixes #14111 gap-closure audit findings
🎨 Storybook: ✅ Built — View Storybook🎭 Playwright: ✅ 1788 passed, 0 failed · 3 flaky📊 Browser Reports
📦 Bundle: 8.69 MB gzip 🔴 +2 kBDetailsSummary
Category Glance App Entry Points — 3.67 kB (baseline 3.67 kB) • ⚪ 0 BMain entry bundles and manifests
Status: 1 added / 1 removed Graph Workspace — 1.36 MB (baseline 1.36 MB) • ⚪ 0 BGraph editor runtime, canvas, workflow orchestration
Status: 2 added / 2 removed / 1 unchanged Views & Navigation — 124 kB (baseline 124 kB) • 🔴 +34 BTop-level views, pages, and routed surfaces
Status: 13 added / 13 removed / 4 unchanged Panels & Settings — 570 kB (baseline 570 kB) • ⚪ 0 BConfiguration panels, inspectors, and settings screens
Status: 10 added / 10 removed / 16 unchanged User & Accounts — 27 kB (baseline 27 kB) • ⚪ 0 BAuthentication, profile, and account management bundles
Status: 6 added / 6 removed / 4 unchanged Editors & Dialogs — 125 kB (baseline 125 kB) • ⚪ 0 BModals, dialogs, drawers, and in-app editors
Status: 7 added / 7 removed / 1 unchanged UI Components — 67.1 kB (baseline 67.1 kB) • ⚪ 0 BReusable component library chunks
Status: 6 added / 6 removed / 8 unchanged Data & Services — 3.5 MB (baseline 3.49 MB) • 🔴 +8.55 kBStores, services, APIs, and repositories
Status: 14 added / 14 removed / 3 unchanged Utilities & Hooks — 549 kB (baseline 547 kB) • 🔴 +2.16 kBHelpers, composables, and utility bundles
Status: 18 added / 18 removed / 20 unchanged Vendor & Third-Party — 16.3 MB (baseline 16.3 MB) • ⚪ 0 BExternal libraries and shared vendor chunks Status: 17 unchanged Other — 14 MB (baseline 14 MB) • 🔴 +3.26 kBBundles that do not match a named category
Status: 70 added / 70 removed / 216 unchanged ⚡ Performance Report
Show regressions
All metrics
Historical variance (last 15 runs)
Trend (last 15 commits on main)
Raw data{
"timestamp": "2026-08-09T00:03:40.600Z",
"gitSha": "f07ef84e7c20532b25172ae0757ab9ab196e4fed",
"branch": "fix/incident-88-telemetry-gaps",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 2058.1940000000145,
"styleRecalcs": 7,
"styleRecalcDurationMs": 9.822000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 647.356,
"heapDeltaBytes": 5792884,
"heapUsedBytes": 70277580,
"domNodes": 14,
"jsHeapTotalBytes": 25165824,
"scriptDurationMs": 21.837,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-idle",
"durationMs": 2051.388999999972,
"styleRecalcs": 8,
"styleRecalcDurationMs": 9.679999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 642.574,
"heapDeltaBytes": 5943344,
"heapUsedBytes": 70466696,
"domNodes": 16,
"jsHeapTotalBytes": 24379392,
"scriptDurationMs": 21.291999999999998,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-mouse-sweep",
"durationMs": 2577.7970000000323,
"styleRecalcs": 85,
"styleRecalcDurationMs": 79.13999999999999,
"layouts": 12,
"layoutDurationMs": 8.193999999999999,
"taskDurationMs": 1577.057,
"heapDeltaBytes": -11205932,
"heapUsedBytes": 53024164,
"domNodes": -280,
"jsHeapTotalBytes": 24092672,
"scriptDurationMs": 207.399,
"eventListeners": -155,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "canvas-mouse-sweep",
"durationMs": 2180.580999999961,
"styleRecalcs": 80,
"styleRecalcDurationMs": 59.108999999999995,
"layouts": 12,
"layoutDurationMs": 5.187,
"taskDurationMs": 1233.0400000000002,
"heapDeltaBytes": -13288356,
"heapUsedBytes": 51216048,
"domNodes": -281,
"jsHeapTotalBytes": 24354816,
"scriptDurationMs": 169.67900000000003,
"eventListeners": -153,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1769.284999999968,
"styleRecalcs": 31,
"styleRecalcDurationMs": 23.625000000000004,
"layouts": 6,
"layoutDurationMs": 0.8909999999999999,
"taskDurationMs": 553.5179999999999,
"heapDeltaBytes": 8719764,
"heapUsedBytes": 72893804,
"domNodes": 75,
"jsHeapTotalBytes": 24903680,
"scriptDurationMs": 30.124,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1745.997999999986,
"styleRecalcs": 31,
"styleRecalcDurationMs": 26.476000000000003,
"layouts": 6,
"layoutDurationMs": 0.841,
"taskDurationMs": 538.949,
"heapDeltaBytes": 8723820,
"heapUsedBytes": 73281596,
"domNodes": 76,
"jsHeapTotalBytes": 24903680,
"scriptDurationMs": 29.709,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "dom-widget-clipping",
"durationMs": 805.3189999999972,
"styleRecalcs": 10,
"styleRecalcDurationMs": 11.043999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 556.608,
"heapDeltaBytes": -11147260,
"heapUsedBytes": 53241360,
"domNodes": 16,
"jsHeapTotalBytes": 26476544,
"scriptDurationMs": 84.52600000000001,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "dom-widget-clipping",
"durationMs": 791.8919999999616,
"styleRecalcs": 12,
"styleRecalcDurationMs": 10.673,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 521.4259999999999,
"heapDeltaBytes": -10916656,
"heapUsedBytes": 53473492,
"domNodes": 20,
"jsHeapTotalBytes": 25165824,
"scriptDurationMs": 79.47500000000001,
"eventListeners": 2,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-idle",
"durationMs": 2140.6430000000114,
"styleRecalcs": 6,
"styleRecalcDurationMs": 7.436999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 959.71,
"heapDeltaBytes": -15227568,
"heapUsedBytes": 66548688,
"domNodes": -278,
"jsHeapTotalBytes": 7286784,
"scriptDurationMs": 157.761,
"eventListeners": -151,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-idle",
"durationMs": 2087.7209999999877,
"styleRecalcs": 6,
"styleRecalcDurationMs": 5.984999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 893.884,
"heapDeltaBytes": 4300748,
"heapUsedBytes": 64597968,
"domNodes": -281,
"jsHeapTotalBytes": 3510272,
"scriptDurationMs": 158.85299999999998,
"eventListeners": -179,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-pan",
"durationMs": 3166.4559999999824,
"styleRecalcs": 66,
"styleRecalcDurationMs": 19.29,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 2151.01,
"heapDeltaBytes": 15717408,
"heapUsedBytes": 77039376,
"domNodes": -289,
"jsHeapTotalBytes": 3964928,
"scriptDurationMs": 791.398,
"eventListeners": -147,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-pan",
"durationMs": 2786.377000000016,
"styleRecalcs": 67,
"styleRecalcDurationMs": 17.188,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1862.2869999999998,
"heapDeltaBytes": 1784196,
"heapUsedBytes": 62763176,
"domNodes": -285,
"jsHeapTotalBytes": 4751360,
"scriptDurationMs": 675.3739999999999,
"eventListeners": -179,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333338,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-zoom",
"durationMs": 4375.358000000006,
"styleRecalcs": 61,
"styleRecalcDurationMs": 18.448,
"layouts": 60,
"layoutDurationMs": 12.584,
"taskDurationMs": 2522.8949999999995,
"heapDeltaBytes": -5138048,
"heapUsedBytes": 57900796,
"domNodes": -292,
"jsHeapTotalBytes": 4820992,
"scriptDurationMs": 946.871,
"eventListeners": -151,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-zoom",
"durationMs": 4097.634999999968,
"styleRecalcs": 62,
"styleRecalcDurationMs": 16.328000000000003,
"layouts": 60,
"layoutDurationMs": 9.961,
"taskDurationMs": 2130.468,
"heapDeltaBytes": 10402684,
"heapUsedBytes": 73041272,
"domNodes": -290,
"jsHeapTotalBytes": 5345280,
"scriptDurationMs": 803.0129999999999,
"eventListeners": -153,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "minimap-idle",
"durationMs": 2103.055999999981,
"styleRecalcs": 5,
"styleRecalcDurationMs": 5.593000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1001.1050000000001,
"heapDeltaBytes": 7029932,
"heapUsedBytes": 67901348,
"domNodes": -281,
"jsHeapTotalBytes": 4034560,
"scriptDurationMs": 179.001,
"eventListeners": -183,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666636,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "minimap-idle",
"durationMs": 2089.9779999999737,
"styleRecalcs": 7,
"styleRecalcDurationMs": 7.710000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 867.8620000000001,
"heapDeltaBytes": 7145756,
"heapUsedBytes": 67951632,
"domNodes": -286,
"jsHeapTotalBytes": 4034560,
"scriptDurationMs": 154.07999999999998,
"eventListeners": -149,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 802.5539999999864,
"styleRecalcs": 44,
"styleRecalcDurationMs": 12.875000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 577.878,
"heapDeltaBytes": -10617012,
"heapUsedBytes": 53869548,
"domNodes": 14,
"jsHeapTotalBytes": 25952256,
"scriptDurationMs": 158.791,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 770.497999999975,
"styleRecalcs": 45,
"styleRecalcDurationMs": 12.113999999999995,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 529.752,
"heapDeltaBytes": -10361872,
"heapUsedBytes": 54047340,
"domNodes": 16,
"jsHeapTotalBytes": 25690112,
"scriptDurationMs": 149.349,
"eventListeners": 8,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-idle",
"durationMs": 2016.1249999999882,
"styleRecalcs": 8,
"styleRecalcDurationMs": 9.343,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 606.546,
"heapDeltaBytes": 5985476,
"heapUsedBytes": 70531160,
"domNodes": 16,
"jsHeapTotalBytes": 24641536,
"scriptDurationMs": 15.322999999999997,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "subgraph-idle",
"durationMs": 2030.2509999999074,
"styleRecalcs": 8,
"styleRecalcDurationMs": 10.043,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 630.4510000000001,
"heapDeltaBytes": 5983304,
"heapUsedBytes": 70490240,
"domNodes": 16,
"jsHeapTotalBytes": 24903680,
"scriptDurationMs": 20.099000000000004,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 2122.2140000000422,
"styleRecalcs": 87,
"styleRecalcDurationMs": 69.074,
"layouts": 16,
"layoutDurationMs": 6.196,
"taskDurationMs": 1304.182,
"heapDeltaBytes": -16461948,
"heapUsedBytes": 48012984,
"domNodes": -282,
"jsHeapTotalBytes": 23044096,
"scriptDurationMs": 147.294,
"eventListeners": -155,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1874.0859999999202,
"styleRecalcs": 79,
"styleRecalcDurationMs": 51.86399999999999,
"layouts": 16,
"layoutDurationMs": 5.989,
"taskDurationMs": 1101.0099999999998,
"heapDeltaBytes": -3445992,
"heapUsedBytes": 61094972,
"domNodes": 63,
"jsHeapTotalBytes": 25165824,
"scriptDurationMs": 126.20800000000001,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-transition-enter",
"durationMs": 1550.6649999999809,
"styleRecalcs": 18,
"styleRecalcDurationMs": 37.12399999999999,
"layouts": 14,
"layoutDurationMs": 14.047999999999998,
"taskDurationMs": 1173.5259999999998,
"heapDeltaBytes": 3951336,
"heapUsedBytes": 76792372,
"domNodes": 13673,
"jsHeapTotalBytes": 15728640,
"scriptDurationMs": 47.64400000000002,
"eventListeners": 2375,
"totalBlockingTimeMs": 179,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "viewport-pan-sweep",
"durationMs": 10604.322000000026,
"styleRecalcs": 249,
"styleRecalcDurationMs": 58.294000000000004,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 6947.71,
"heapDeltaBytes": 7393768,
"heapUsedBytes": 66818088,
"domNodes": -278,
"jsHeapTotalBytes": 6324224,
"scriptDurationMs": 2389.3790000000004,
"eventListeners": -129,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333338,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 9748.79199999998,
"styleRecalcs": 248,
"styleRecalcDurationMs": 53.272,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 6441.311,
"heapDeltaBytes": 24094040,
"heapUsedBytes": 84269136,
"domNodes": -283,
"jsHeapTotalBytes": 4751360,
"scriptDurationMs": 2190.9500000000003,
"eventListeners": -129,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "vue-large-graph-idle",
"durationMs": 27604.307000000004,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 27581.778,
"heapDeltaBytes": -45475464,
"heapUsedBytes": 157600520,
"domNodes": -8312,
"jsHeapTotalBytes": -5971968,
"scriptDurationMs": 752.225,
"eventListeners": -16379,
"totalBlockingTimeMs": 4,
"frameDurationMs": 19.44333333333319,
"p95FrameDurationMs": 16.700000000004366
},
{
"name": "vue-large-graph-idle",
"durationMs": 25073.949999999968,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 25055.082000000002,
"heapDeltaBytes": -38478732,
"heapUsedBytes": 165520372,
"domNodes": -8312,
"jsHeapTotalBytes": -11214848,
"scriptDurationMs": 720.322,
"eventListeners": -16381,
"totalBlockingTimeMs": 1,
"frameDurationMs": 18.890000000000146,
"p95FrameDurationMs": 33.299999999995634
},
{
"name": "vue-large-graph-pan",
"durationMs": 35366.21600000001,
"styleRecalcs": 182,
"styleRecalcDurationMs": 36.15399999999996,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 35336.184,
"heapDeltaBytes": -34786328,
"heapUsedBytes": 175385456,
"domNodes": -8312,
"jsHeapTotalBytes": -8400896,
"scriptDurationMs": 1356.9319999999998,
"eventListeners": -16375,
"totalBlockingTimeMs": 774,
"frameDurationMs": 18.889999999999905,
"p95FrameDurationMs": 16.700000000004366
},
{
"name": "vue-large-graph-pan",
"durationMs": 30226.278999999977,
"styleRecalcs": 182,
"styleRecalcDurationMs": 32.223,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 30196.606,
"heapDeltaBytes": -52213156,
"heapUsedBytes": 153786396,
"domNodes": -8312,
"jsHeapTotalBytes": -9900032,
"scriptDurationMs": 1235.734,
"eventListeners": -16377,
"totalBlockingTimeMs": 1554,
"frameDurationMs": 19.996666666666716,
"p95FrameDurationMs": 33.400000000001455
},
{
"name": "workflow-execution",
"durationMs": 158.06700000007368,
"styleRecalcs": 8,
"styleRecalcDurationMs": 25.854,
"layouts": 7,
"layoutDurationMs": 2.9909999999999997,
"taskDurationMs": 133.74599999999998,
"heapDeltaBytes": 3173068,
"heapUsedBytes": 66544432,
"domNodes": 135,
"jsHeapTotalBytes": 3145728,
"scriptDurationMs": 11.111,
"eventListeners": 25,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "workflow-execution",
"durationMs": 1013.3630000000267,
"styleRecalcs": 11,
"styleRecalcDurationMs": 22.847,
"layouts": 3,
"layoutDurationMs": 0.6600000000000003,
"taskDurationMs": 149.30099999999996,
"heapDeltaBytes": 5913424,
"heapUsedBytes": 69478792,
"domNodes": 119,
"jsHeapTotalBytes": 5767168,
"scriptDurationMs": 15.709000000000001,
"eventListeners": 99,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.800000000000182
}
]
} |
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #14216 +/- ##
==========================================
+ Coverage 78.72% 78.87% +0.14%
==========================================
Files 1866 1869 +3
Lines 115408 113272 -2136
Branches 33539 33898 +359
==========================================
- Hits 90860 89348 -1512
+ Misses 24005 23427 -578
+ Partials 543 497 -46
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 213 files with indirect coverage changes 🚀 New features to boost your workflow:
|
…etry-gaps # Conflicts: # src/platform/workspace/composables/useSubscriptionCheckout.test.ts
|
@dante01yoon @benceruleanlu — requesting review. Larger than the docs PRs in this program but smaller than the file count suggests: ~145 insertions / 59 deletions of non-test code across 10 files, plus one new ~30-line utility; the rest is tests. It closes the four gaps from the post-merge audit of #14111's shipped diff: workspace-rail cancel-initiation telemetry, provider-parity for the success signal, legacy-rail resubscribe failures, and real The body has a "how to review this" primer with a per-finding checklist, an explicit out-of-scope list, and a link to the public program dossier. Merging this also unblocks #14229, which is stacked on this branch and can then be retargeted to |
…etry-gaps # Conflicts: # src/platform/workspace/composables/useSubscriptionCheckout.ts
christian-byrne
left a comment
There was a problem hiding this comment.
Read the full diff at a63fe0f plus the surrounding files at that head, and traced the sibling call sites on both rails. The four gaps are real and three of the four fixes are right. The one I'd push back on is finding 3 (legacy resubscribe): it doesn't just remove a gate, it makes the legacy rail emit billing.resubscribe.succeeded when all that happened is a Stripe tab opened — including when the popup was blocked — which reintroduces the false-success class this program exists to remove. Everything else below is smaller: one undeclared sibling entry point, one wrong in-code comment, one over-broad classifier branch, and four tests that mock the thing they're testing. No blocking objection to the other three findings. CI green, no conflicts.
1. HIGH — legacy resubscribe now reports "succeeded" when only a checkout tab was opened
src/composables/billing/useLegacyBilling.ts:183 → src/platform/cloud/subscription/composables/useSubscription.ts:215-244, emitted at src/platform/workspace/composables/useResubscribe.ts:38 and src/platform/workspace/composables/useSubscriptionCheckout.ts:922.
Failure scenario. Legacy rail, user clicks Resubscribe. useLegacyBilling.resubscribe() calls legacySubscribeDirect(), which calls initiateSubscriptionCheckout(), then window.open(response.checkout_url, '_blank'), then resolves. It never observes a charge. So billing.resubscribe.succeeded fires at tab-open, before any payment.
Worse, useSubscription.ts:227-229:
const checkoutWindow = window.open(response.checkout_url, '_blank')
if (!checkoutWindow) {
return
}A blocked popup resolves successfully. The user never saw Stripe and we emit succeeded.
Consequence. Legacy succeeded / (succeeded + failed) for resubscribe is pinned near 100% forever, and the same journey can later produce a real failure elsewhere — one user appearing as both success and failure, which is exactly the signal shape Phase D's monitors are meant to trust.
This also reverts a deliberate guard. The if (shouldUseWorkspaceBilling.value) gates came from #14111 (915c2bfc1), alongside a test named — verbatim — does not report checkout launch as terminal legacy success. This PR renames that test to fires resubscribe success telemetry on the legacy rail too (useSubscriptionCheckout.test.ts) and inverts its assertion. Deleting a guard whose test names the hazard needs an explicit argument in the body, not a re-title.
Suggested fix — pick one:
- (a) On the legacy rail emit
stage: 'started' / outcome: 'pending'instead ofsucceeded.ResubscribeBillingEventgains theBillingStartedvariant in #14229, and the existing pending-checkout recovery (useSubscription.ts:171-190, which already firestrackMonthlySubscriptionSucceededwhen a pending checkout becomes active) is the honest owner of the terminal. - (b) Keep the success emit, but make
subscribeDirectthrow whenwindow.openreturnsnull, and emitfailedwitherror_code: 'payment_popup_blocked'— that code already exists inBillingErrorCodeanduseSubscriptionCheckout.ts:777-783already treats a blocked popup as a warn-worthy event.
Either way, please state in the body which definition of "resubscribe succeeded" the legacy rail ships, because the two rails will otherwise mean different things under one event name.
2. MEDIUM — the marketing deep-link is the untouched sibling of the PricingTable fix, and isn't declared out of scope
src/platform/cloud/subscription/components/PricingTable.vue:547 (fixed here) vs src/platform/cloud/onboarding/CloudSubscriptionRedirectView.vue:97,117,122.
PricingTable.vue:547 now reports a real failure_category for the in-app personal subscribe. Its sibling entry point on the same rail — the marketing deep-link /cloud/subscribe?tier=… — calls the same performSubscriptionCheckout() from CloudSubscriptionRedirectView.vue:117, but the whole runRedirect is wrapWithErrorHandlingAsync(..., reportError) at :122, which reports-and-resolves. A deep-link subscribe failure therefore emits zero billing events, before and after this PR. The team deep-link at :97 is worse: teamSubscriptionCheckoutUtil.ts has no trackBillingEvent and no startOperation at all.
The out-of-scope list names "hosted-portal plan-change paths (legacy in-app, legacy deep-link, workspace settings)". That is the portal path, not the deep-link subscribe path — so this omission currently reads as an oversight rather than a decision.
Fix: either move the failure emit out of PricingTable.vue's catch and into subscriptionCheckoutUtil.performSubscriptionCheckout() so both entry points inherit it, or add an explicit out-of-scope bullet naming CloudSubscriptionRedirectView.vue and teamSubscriptionCheckoutUtil.ts.
3. LOW (one line) — the "seven providers" comment is wrong, and five of the seven get nothing
src/platform/workspace/stores/billingOperationStore.ts:273-275.
Verified at this head by reading all ten providers: trackMonthlySubscriptionSucceeded is implemented by exactly three of the nine cloud providers — MixpanelTelemetryProvider, GtmTelemetryProvider, PostHogTelemetryProvider (plus HostTelemetrySink, which isn't in this registry). Of the seven named in the comment, five — Impact, ClickHouse, Syft, CustomerIo, Sentry — do not implement the method at all, so the call is a silent ?.() skip there. The real incremental beneficiary set is two: Mixpanel and GTM. PostHog already receives trackBillingEvent.
Suggested replacement:
// Also fires the pre-existing generic event for the two providers that
// implement trackMonthlySubscriptionSucceeded but not trackBillingEvent
// (Mixpanel, GTM). PostHog implements both.The body already concedes the count is wrong; this is the exact wording plus the fact that most of the named set is unreachable. The looser twin at useSubscriptionCheckout.ts:733-734 ("providers that don't yet implement trackBillingEvent") is vague rather than wrong — worth making specific in the same pass.
4. LOW — err instanceof TypeError → 'network' will relabel frontend crashes as network failures
src/platform/telemetry/utils/billingFailureCategory.ts:28.
TypeError is what fetch throws for connectivity, but it is also what the runtime throws for Cannot read properties of undefined, x is not a function, and friends. Any such bug inside a billing catch block now lands in the network bucket — the bucket someone will use to conclude "customers have flaky connections" rather than "we shipped a crash". Given the taxonomy exists precisely to make failures decomposable, this branch trades one wrong answer for a more confident wrong answer.
Fix: narrow it to the fetch shape and let genuine bugs fall through to unknown:
if (err instanceof TypeError && /fetch|network|load failed/i.test(err.message)) {
return 'network'
}and add a case to billingFailureCategory.test.ts for a non-network TypeError (e.g. new TypeError("x is not a function") → unknown).
5. LOW (test quality) — four new test files mock categorizeBillingApiError itself, and the stub disagrees with the real function
src/platform/workspace/components/TopUpCreditsDialogContentWorkspace.test.ts:77, src/components/dialog/content/TopUpCreditsDialogContentLegacy.test.ts:58, src/platform/workspace/composables/useResubscribe.test.ts:47, src/platform/workspace/composables/useSubscriptionCheckout.test.ts:280.
Each stubs the classifier with err.name === 'WorkspaceApiError' ? 'api_rejected' : 'unknown' and then constructs a plain new Error() with .name assigned. The real classifier keys on instanceof WorkspaceApiError and returns api_rejected only when status is defined — so in production those exact inputs yield unknown. The tests assert a category the shipped code cannot produce, and would still pass if the real classifier regressed.
They do fail if the fix is reverted, so they aren't worthless — but two files in this same PR already show the better pattern: useWorkspaceBilling.test.ts:831 and PricingTable.test.ts construct a real WorkspaceApiError / TypeError and let the real classifier run. Please convert the four.
Nit
The PR title carries the internal incident identifier (incident-88) into a public repo. The program already scrubbed the Slack-thread reference to it from PR bodies; the title is the more visible surface. Branch name can't change now — not blocking.
What I checked and found fine — don't redo these
- The cancel double-report guard is correct.
billingOpIdis assigned from the response beforestartOperation(useWorkspaceBilling.ts:335-339), so any later poller failure or timeout leaves it defined and the composable stays silent. The new test at:874pins exactly that, and I traced every path into that catch — none can double-emit. - Sibling sweep for the cancel fix is complete. Enumerated every
startOperationcaller at this head:TopUpCreditsDialogContentWorkspace.vue:289,useDowngradeToPersonal.ts:287,305,useSubscriptionCheckout.ts:777,useWorkspaceBilling.ts:183,330. All initiation-failure paths already have failure telemetry exceptuseWorkspaceBilling.ts:183, which adopts an already-pending op from a status read and is correctly untelemetered. No gap there. subscribeDirectis behaviour-preserving for existingsubscribe()callers.subscribe = wrapWithErrorHandlingAsync(subscribeDirect, reportError)is the same body as before, anduseLegacyBilling.ts:183is the only call site switched.- Failure-hook reachability.
PricingTable.vue:539emits inside an inner catch that re-throws before the outerwrapWithErrorHandlingAsyncsees it, so it is live, not dead code. - No provider coverage is reduced.
trackMonthlySubscriptionSucceededis added alongsidetrackBillingEvent, never instead of it. Note for the body: PostHog now receives bothbilling.subscription_checkout.succeededandapp:monthly_subscription_succeededfor one journey — intended (it restores the workspace-rail under-count) but worth stating so nobody sums them. - No double-emit of
trackMonthlySubscriptionSucceeded.useSubscriptionCheckout.ts:730fires only onstatus === 'subscribed', which returns beforeadvanceToSuccessOnOperation;billingOperationStore.ts:276fires only on the polled path. Mutually exclusive. - Payload hygiene is clean. No raw error strings, no user-authored free text, no Stripe customer identifiers in any telemetry property. Raw messages appear only in toasts (
useResubscribe.ts:57,useSubscriptionCheckout.ts:937,TopUpCreditsDialogContentWorkspace.vue:325) — pre-existing UI behaviour, not telemetry. - Event and property names match the shipped canonical contract.
getBillingTelemetryEventNamederives names fromoperation/stage, so nothing can drift from an older PR description. billing_op_idwidening. Now optional onBillingOperationBillingEvent, used only by the new pre-op cancel failure. Flagging for whoever writes the Datadog side:billing.operation.failedcan now arrive with nobilling_op_id, so a group-by on it must tolerate absence.- No private context. Nothing in the diff or body names a private repo, monitor/dashboard id, analytics project or insight id, Slack link or channel, on-call handle, or a person. The plan-doc link returns HTTP 200 unauthenticated.
- CI green,
MERGEABLE, reviewed ata63fe0f.
…nk coverage, and test fidelity - Legacy-rail resubscribe now emits started/pending instead of a terminal succeeded at checkout-tab-open; workspace rail is unaffected. Restores the regression-guard test that was inverted rather than fixed. - Marketing and team deep-link subscribe failures now get failure telemetry by moving the emit into performSubscriptionCheckout/ performTeamSubscriptionCheckout, so PricingTable and CloudSubscriptionRedirectView share one failure path instead of only the in-app one having it. - Corrected the provider-count comments (Mixpanel/GTM, not seven providers). - Narrowed the TypeError -> network classification to fetch-shaped messages so frontend bugs don't get mislabeled as connectivity issues. - Replaced four tests' classifier mocks with real WorkspaceApiError/ AuthStoreError instances so they exercise the real classifier.
|
Thanks for the deep review, @christian-byrne. All findings addressed in 1a2118d, replied inline on each thread:
Generated by Claude Code |
…etry-gaps # Conflicts: # src/platform/workspace/composables/useSubscriptionCheckout.test.ts # src/platform/workspace/composables/useSubscriptionCheckout.ts
Per maintainer feedback, removes verbose WHAT/restating comments and compresses the remaining WHY-only comments (non-obvious business rules) down to 1-2 lines each, matching repo convention. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ABjXzJug5u6SkhRD86Y6Ms
Main refactored top-up error reporting into reportPurchaseError() and added a two-step confirm flow. Keeps that refactor and gives the helper an optional error so failures still classify via categorizeBillingApiError instead of the hardcoded 'unknown' it shipped with, and the toast keeps the specific message. Updates the classifier test to drive through the new confirm step.
dante01yoon
left a comment
There was a problem hiding this comment.
Re-reviewed the current head 9179b8f528e94b22ab3ea5657432911451af10ad against its exact main diff and the latest stack base. The prior requested fixes are present: legacy resubscribe no longer reports checkout-tab launch as terminal success, both personal/team deep-link failures inherit the shared canonical failure emission without a duplicate caller emit, the TypeError classifier is narrowed, real error classes exercise the category mapping, and cancel initiation remains mutually exclusive with poller-owned failure telemetry. The canonical + legacy subscription-success calls are intentionally different event contracts, not duplicate canonical emissions. All current checks are green.
…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 MERGE_CONFLICT after a push to main. Two things needed manual resolution beyond git's automatic merge: - billingOperationStore.test.ts had a marked conflict: both branches added independent new tests at the same insertion point (this PR's topup/cancel poll-failure-category tests, and main's checkout-superseded tests from #14705). Kept all four. - billingOperationStore.ts's handleFailure() auto-merged without conflict markers but was left with a duplicate `const failureCategory` declaration (main added superseded-checkout handling in the same spot this PR added categorizePollFailure()). Combined both: `stale_operation` for superseded checkouts, else categorizePollFailure() for provider_decline/api_rejected, with main's toast-suppression for superseded checkouts preserved. - PricingTable.test.ts's own new test referenced the pre-rename mock variable name `mockIsActiveSubscription`; main renamed it to `mockCanAccessSubscriptionFeatures` (#11464). Mechanical rename fix. Verified: pnpm typecheck and pnpm lint pass clean; targeted pnpm vitest run across all 12 files touched by the merge (312 tests) pass. Committed with --no-verify: husky's pre-commit hook (lint-staged) sweeps the full merge diff and fails on a pre-existing, unrelated oxlint error already on main (apps/website .../modelLaunchPages.test.ts, untouched by this merge) — approved by task owner to bypass for this merge commit.
dante01yoon
left a comment
There was a problem hiding this comment.
Requesting changes for one billing lifecycle contract issue. The rest of the previously raised telemetry findings remain addressed at this head, and the current checks are green.
| useTelemetry()?.trackBillingEvent( | ||
| shouldUseWorkspaceBilling.value | ||
| ? { | ||
| operation: 'resubscribe', |
There was a problem hiding this comment.
issue: This terminal success can be emitted while the workspace resubscribe operation is still pending. workspaceApi.ts currently narrows the response with a handwritten status: 'active' type, but the generated API contract allows status: 'active' | 'pending'; pending responses carry a billing_op_id that must be polled. In an SCA/3DS flow, this path can therefore emit billing.resubscribe.succeeded before the operation later fails, producing a false success in the billing funnel. The same assumption exists in useSubscriptionCheckout.ts. Could we consume the generated response type and wait for a pending billing operation to reach success before emitting this terminal event? Landing #14771 first appears to provide that contract and polling behavior.
There was a problem hiding this comment.
Good catch, thanks for flagging this. Traced it down: the actual bug lives one layer below, in useWorkspaceBilling.ts's resubscribe() — it discards the response and never polls a pending op to a terminal state, unlike cancelSubscription() in that same file, which already does this correctly.
#14771 already implements exactly this fix (a generated ResubscribeResponse type plus polling via billingOperationStore.startOperation), with tests. Its diff doesn't touch useResubscribe.ts or useSubscriptionCheckout.ts at all, so once #14771 merges, the code here becomes correct automatically with no changes needed on this PR's side.
Plan: land #14771 first, then rebase this PR on top of post-#14771 main — should be a clean rebase since we don't touch the same functions in workspaceApi.ts / useWorkspaceBilling.ts.
Generated by Claude Code
|
In reply to review #4878414635, blocking issue 1:
Fixed. The legacy rail's
Verified with Generated by Claude Code |
|
In reply to review #4878414635, blocking issue 2:
Fixed. Generated by Claude Code |
|
In reply to review #4878414635, blocking issue 3:
Fixed. if (err instanceof AuthStoreError) {
return err.status === undefined ? 'network' : 'api_rejected'
}Added Generated by Claude Code |
|
In reply to review #4878414635, blocking issue 4:
Fixed. function categorizePollFailure(
type: OperationType,
errorMessage: string | null,
isZeroPaymentOperation: boolean
): BillingFailure['failure_category'] {
if (type === 'cancel' || isZeroPaymentOperation) return 'api_rejected'
if (errorMessage && /network|connection|unreachable/i.test(errorMessage)) {
return 'network'
}
return 'provider_decline'
}
Added While rebasing this fix onto the current head (which had since landed #14229's Generated by Claude Code |
|
In reply to review #4878414635, the two suggestions:
Fixed.
Fixed. Removed the unconditional All 4 blocking issues and both suggestions from this review are now fixed, along with the corresponding test-coverage additions, on top of the current Generated by Claude Code |
christian-byrne
left a comment
There was a problem hiding this comment.
Re-reviewed against c22a873 and against the new Telemetry Lifecycle SSOT. Withdrawing my previous blocking review — seven of the eight findings are genuinely fixed, and I do not want a stale CHANGES_REQUESTED sitting on the PR that gates this rollout.
Verified resolved:
- The legacy resubscribe terminal now closes.
useSubscription.ts:197-207emitsbilling.resubscribe.succeeded, tagged throughrecordPendingSubscriptionCheckoutAttempt->subscriptionCheckoutTracker->consumePendingSubscriptionCheckoutSuccess, gated onmetadata.operation === 'resubscribe'so plain subscribes are not mislabeled, and driven on bootstrap/pageshow/visibilitychange with a 6h localStorage TTL. Covered byuseSubscription.test.ts:578and:616. This was my one blocking finding. useResubscribe.ts:38-43emitsstartedbefore the await.billingOperationStore.ts:480-508emits specializedfailed;:545-586emits generictimeoutplus specializedfailedwithfailure_category: 'poll_timeout', matching the SSOT mapping exactly.billing.operation.startednow fires for all three operation types, and the store's generic start only fires when the caller supplied noattemptStartedAt, so no duplication.- Downgrade has both clocks:
downgradeStartedAt:156before the member-removal loop,checkoutStartedAt:263beforesubscribe. billingFailureCategory.ts:17-19branches onerr.status === undefined.provider_declineno longer applies to zero-payment operations (billingOperationStore.ts:620-632).- "No specialized terminal on recovered polling" is honoured — every specialized terminal is gated on
businessAttemptStartedAt, which is only set fromattemptStartedAt.
Two notes on the legacy resubscribe path, neither blocking. didAttemptSucceed (subscriptionCheckoutTracker.ts:307-319) requires a tier+cycle match while legacy subscribeDirect hardcodes tier: 'standard', cycle: 'monthly' (useSubscription.ts:246-247), so a legacy resubscribe landing on any other tier or duration silently never closes. And there is no legacy resubscribe failed, so an abandoned Stripe tab leaves started open until expiry — per the SSOT that is intended, but it means legacy resubscribe conversion is a lower bound rather than a rate, and any dashboard built on it should say so.
One live defect remains, and it is the same class this PR exists to fix.
useDowngradeToPersonal.ts still emits phantom failures for a continuation state. :292-299 sets telemetryFailure and throws ReactivationConfirmationRequiredError on REACTIVATION_CONFIRMATION_REQUIRED; that propagates to the outer catch at :371, which emits downgrade_to_personal.failed (:375), and because checkoutStartedAt was already set at :263, also subscription_checkout.failed (:386) and operation.failed (:397). dialogService.ts:768-778 then re-prompts and retries, producing a second downgrade_to_personal.started. Net: two started and three phantom failed per successful reactivating downgrade.
The SSOT is explicit: "REACTIVATION_CONFIRMATION_REQUIRED is a continuation state, not a failure. It must not emit a phantom failed event before confirmation continues." The equivalent fix already landed for workspace checkout at useSubscriptionCheckout.ts:719-722, where the continuation test was moved ahead of trackSubscriptionFailure; the downgrade path needs the same treatment — let the continuation error bypass the terminal-emitting catch rather than flow through it.
Two coverage gaps worth closing in the same change:
useDowngradeToPersonal.test.ts:341asserts only the thrown error, never the absence offailed— which is why the above survived. The checkout equivalents (useSubscriptionCheckout.test.ts:1774,:2597) do assert it.- The new
poll_timeoutspecialized terminals atbillingOperationStore.ts:558-599have no unit coverage; only the genericstage: 'timeout'is asserted (billingOperationStore.test.ts:1018).
Approving so this is not held up. I have filed the remaining defect and the two coverage gaps separately so they cannot get lost.
…etry-gaps # Conflicts: # src/platform/cloud/subscription/composables/useSubscription.ts # src/platform/cloud/subscription/utils/subscriptionCheckoutUtil.ts # src/stores/authStore.ts
|
|
|
|
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 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:
billing.*events reached only 2 of 9 registered telemetry providers — a regression against the older tracker call, which more providers implemented.subscribe()call swallows errors instead of rejecting.failure_categorywas 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:categorizeBillingApiError(), thestartedstage,billing_op_idoptionality). Merging this unblocks it and shrinks its diff.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:
failure_categorymapping (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: isprovider_declinejustified for top-up/subscription poll failures and for the synchronous top-up-creation failure? Is theapi_rejectedvsnetworksplit onWorkspaceApiError.statussound?subscribeDirectpath inuseSubscription.ts— it mirrors the existingpurchaseCreditsDirectpattern from feat(telemetry): instrument billing/subscription funnel gaps #14111. Confirm it does not change resubscribe's success-path behavior, only its error propagation, and that existingsubscribe()callers are untouched.billingOpId === undefinedguard really distinguishes "never got an op id" from "op id obtained, poller failed later" — the latter must not emit a secondtrackBillingEvent. There is a test named for exactly this case.Deliberately out of scope — please don't block on these; each is tracked separately:
wrapWithErrorHandlingAsyncitself. 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.duration_ms,workspace_id,billing_attempt_id,source_version, and canonicalstartedevents — these are fix(telemetry): duration_ms, real failure categories, and started events for incident-88 followups #14229 and docs: scope client attempt-id and workspace-scoping for billing telemetry (Phase B) #14228 (thestartedstage 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
trackMonthlySubscriptionSucceededcall. 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
mainbefore fixing (see "What I found didn't match the audit" below).Changes
useWorkspaceBilling.ts'scancelSubscription()now firestrackBillingEventdirectly from its catch block only when the initiatingworkspaceApi.cancelSubscription()call itself throws, before abilling_op_idexists (network error, 4xx/5xx). Once abilling_op_idis obtained and the poller (billingOperationStore.startOperation) takes over, the existing suppression inCancelSubscriptionDialogContent.vueis untouched — the poller'shandleFailurestill owns that telemetry.trackMonthlySubscriptionSucceededfor multi-provider parity.billingOperationStore.ts's subscription-success handling anduseSubscriptionCheckout.ts'shandleSubscribeResponsenow call both the new canonicaltrackBillingEventand the pre-existingtrackMonthlySubscriptionSucceeded, so the registered providers that don't implementtrackBillingEventkeep getting a success signal.useResubscribe.tsanduseSubscriptionCheckout.tsno longer gate thetrackBillingEventresubscribe calls behindshouldUseWorkspaceBilling. This required investigating how legacy resubscribe actually completes:useLegacyBilling.resubscribe()calleduseSubscription().subscribe(), which is wrapped inwrapWithErrorHandlingAsync— 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 unwrappedsubscribeDirectinuseSubscription.ts(mirroring the existingpurchaseCreditsDirectpattern from feat(telemetry): instrument billing/subscription funnel gaps #14111) and havinguseLegacyBilling.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 fromstage: 'succeeded'at Stripe-checkout-tab-open tostage: 'started'/outcome: 'pending', since opening a checkout tab is not a terminal payment outcome — the workspace rail is unaffected and still emitssucceededdirectly, because itsresubscribe()call is itself the terminal reactivation.failure_categorynow reflects the real failure, via a newcategorizeBillingApiError()helper (src/platform/telemetry/utils/billingFailureCategory.ts) used at every hardcoded-'unknown'site named in the audit:WorkspaceApiError/AuthStoreErrorwith no HTTP status →network(request never reached the backend); with a status →api_rejected(backend responded and rejected it).TypeErrorwhose message names fetch/network/load-failure connectivity (whatfetchthrows for that case) →network; any otherTypeError(e.g. a genuine frontend bug likex is not a function) falls through tounknowninstead 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 synchronousstatus: 'failed'topup-creation branch →provider_declinefor the same payment-attempt reason.Errorwith no error object to inspect, matching the existingmissing_checkout_responseprecedent inuseDowngradeToPersonal.ts) still fall back tounknown— not force-fit.subscriptionCheckoutUtil.ts'sperformSubscriptionCheckout()andteamSubscriptionCheckoutUtil.ts'sperformTeamSubscriptionCheckout()now emittrackBillingEventfailure themselves before rethrowing, so both entry points that call them — the in-appPricingTable.vueand the marketing/team deep links inCloudSubscriptionRedirectView.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.billingOperationStore.ts,TopUpCreditsDialogContentWorkspace.vue,TopUpCreditsDialogContentLegacy.vue,useResubscribe.ts,useSubscriptionCheckout.ts,PricingTable.vue,subscriptionCheckoutUtil.ts,teamSubscriptionCheckoutUtil.ts.billing_op_idonBillingOperationBillingEvent, a newstartedstage onResubscribeBillingEvent, and a new unwrappedsubscribeDirectexport alongside the existingsubscribe.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.tsanduseResubscribe.tsare touched by findings 2–4 simultaneously). Non-test diff is ~145 insertions / 59 deletions across 10 files plus one new ~30-line utility.useWorkspaceBilling.ts): confirm thebillingOpId === undefinedguard correctly distinguishes "never got an op id" from "op id obtained, poller failed" — the latter must not get a duplicatetrackBillingEventcall (see the new testdoes not duplicate telemetry for a poller failure once a billing_op_id exists).trackMonthlySubscriptionSucceededrestoration: 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 withtier/cycle/checkout_type/billing_op_id.subscribeDirectgenuinely doesn't change behavior for existingsubscribe()callers (it's only swapped in for the resubscribe path inuseLegacyBilling.ts), and that the legacy rail's telemetry now reportsstarted/pendingat checkout-tab-open rather than a terminalsucceeded— see "Review response" below for the exact definition shipped.failure_categorymapping — 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: isprovider_declinefor topup/subscription poll failures and synchronous topup-creation failures well justified? Isapi_rejectedvsnetworksplit onWorkspaceApiError.statussound?Review response (Christian Byrne)
Finding 1 (HIGH, legacy resubscribe "succeeded" at tab-open) — fixed via option (a).
useResubscribe.tsanduseSubscriptionCheckout.ts'shandleResubscribe()now checkshouldUseWorkspaceBillingafterresubscribe()resolves: the workspace rail still emitsstage: 'succeeded'/outcome: 'success'immediately (honest, since itsresubscribe()call is itself the terminal reactivation); the legacy rail now emitsstage: 'started'/outcome: 'pending'instead (added as a new variant onResubscribeBillingEvent). The definition of "resubscribe succeeded" the legacy rail now ships: a terminal success is only ever observed via the pre-existing pending-checkout recovery inuseSubscription.ts(syncPendingSubscriptionSuccess), which firestrackMonthlySubscriptionSucceededonce a later status poll confirms the checkout attempt became active. This PR does not additionally emit a canonicalbilling.resubscribe.succeededfrom 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 underlyingsubscribeDirect, 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 theBillingActions.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 testdoes not report checkout launch as terminal legacy success(in bothuseResubscribe.test.tsanduseSubscriptionCheckout.test.ts) now assertsstarted/pendingfires instead of a terminalsucceeded.Finding 2 (MEDIUM, deep-link entry points get zero failure telemetry) — fixed for real, not deferred.
performSubscriptionCheckout()(subscriptionCheckoutUtil.ts) now emitsbilling.subscription_checkout.faileditself, inside its own try/catch, before rethrowing — so bothPricingTable.vue(in-app) andCloudSubscriptionRedirectView.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'sperformTeamSubscriptionCheckout()— 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-275and the looser twin inuseSubscriptionCheckout.ts:733-734now 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.categorizeBillingApiErrornow requires theTypeErrormessage to name fetch/network/load-failure before categorizing it asnetwork; any otherTypeError(e.g.x is not a function) falls through tounknown. 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, anduseSubscriptionCheckout.test.tsno longer stubcategorizeBillingApiError; each now constructs a realWorkspaceApiError(with astatus) orAuthStoreErrorand lets the real classifier run, matching the pattern already used correctly inuseWorkspaceBilling.test.tsandPricingTable.test.ts.What I found didn't match the audit
mainat the time of this PR: line numbers forbillingOperationStore.ts's twofailure_category: 'unknown'hardcodes (~285, ~296) anduseSubscriptionCheckout.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.useLegacyBilling.resubscribe()'s failure telemetry is not just a gating fix — the legacy rail'ssubscribe()never actually rejects (it's wrapped inwrapWithErrorHandlingAsync, which reports-and-swallows), so simply removing theshouldUseWorkspaceBillinggate would have wired a failure branch that could never execute. Confirmed viauseSubscription.tsand cross-referenced against feat(telemetry): instrument billing/subscription funnel gaps #14111's own PR description, which flagged this exact swallow behavior as a known limitation for the resubscribe catch blocks.Verification
pnpm typecheck— passpnpm lint(eslint, oxlint, oxfmt via pre-commit hook) — passpnpm knip— cleanpnpm vitest runon all files touched by this PR and its review-response fixes — passpnpm test:unit— full suite: 1060+ test files passScreenshots (if applicable)
N/A — telemetry-only change, no UI changes.
🤖 Generated with Claude Code