Repository navigation
fix(telemetry): emit billing.operation.succeeded for all operation types and forward billing events to the desktop host sink - #14310
Conversation
…forward billing events to the host sink Two coupled billing-telemetry correctness fixes; both make dashboards under-report rather than fail loudly. billing.operation.succeeded was only emitted for `cancel`, while billing.operation.failed and .timeout are emitted for all three operation types. A succeeded/(succeeded+failed) success-rate ratio grouped by operation_type therefore reads a permanent 0% for `subscription` and `topup`. handleSuccess now emits billing.operation.succeeded for every operation type, carrying the same tier/cycle/checkout_type/ payment_intent_source grouping keys the failure and timeout events already carry. The flow-specific subscription_checkout.succeeded and topup.succeeded events are unchanged. HostTelemetrySink implemented no trackBillingEvent, and initHostTelemetry replaces the provider registry rather than extending it, so cloud builds running inside the desktop shell emitted zero canonical billing events to any provider. The sink already forwards 46 of the 54 TelemetryProvider methods through a single capture() bridge; trackBillingEvent postdates the sink and was simply never added. Implementing it matches that design.
📄 Knowledge reviewDosu skipped reviewing this PR because your organization has used its |
🎭 Playwright: ✅ 1758 passed, 0 failed · 1 flaky📊 Browser Reports
🎨 Storybook: ✅ Built — View Storybook📦 Bundle: 8.18 MB gzip 🔴 +244 BDetailsSummary
Category Glance App Entry Points — 3.66 kB (baseline 3.66 kB) • ⚪ 0 BMain entry bundles and manifests
Status: 1 added / 1 removed Graph Workspace — 1.28 MB (baseline 1.28 MB) • ⚪ 0 BGraph editor runtime, canvas, workflow orchestration
Status: 1 added / 1 removed / 1 unchanged Views & Navigation — 112 kB (baseline 112 kB) • ⚪ 0 BTop-level views, pages, and routed surfaces
Status: 12 added / 12 removed / 4 unchanged Panels & Settings — 551 kB (baseline 551 kB) • ⚪ 0 BConfiguration panels, inspectors, and settings screens
Status: 11 added / 11 removed / 15 unchanged User & Accounts — 29.1 kB (baseline 29.1 kB) • ⚪ 0 BAuthentication, profile, and account management bundles
Status: 7 added / 7 removed / 3 unchanged Editors & Dialogs — 124 kB (baseline 124 kB) • ⚪ 0 BModals, dialogs, drawers, and in-app editors
Status: 6 added / 6 removed / 1 unchanged UI Components — 70.7 kB (baseline 70.7 kB) • ⚪ 0 BReusable component library chunks
Status: 6 added / 6 removed / 9 unchanged Data & Services — 3.43 MB (baseline 3.43 MB) • 🔴 +117 BStores, services, APIs, and repositories
Status: 14 added / 14 removed / 3 unchanged Utilities & Hooks — 386 kB (baseline 386 kB) • ⚪ 0 BHelpers, composables, and utility bundles
Status: 16 added / 16 removed / 20 unchanged Vendor & Third-Party — 15.7 MB (baseline 15.7 MB) • ⚪ 0 BExternal libraries and shared vendor chunks Status: 16 unchanged Other — 12.6 MB (baseline 12.6 MB) • 🔴 +1.58 kBBundles that do not match a named category
Status: 71 added / 71 removed / 207 unchanged ⚡ Performance Report
Show regressions
All metrics
Historical variance (last 15 runs)
Trend (last 15 commits on main)
Raw data{
"timestamp": "2026-07-30T00:34:57.397Z",
"gitSha": "27e31f5501617524dfd516e31f8ef8b7cda9cdbe",
"branch": "fix/billing-succeeded-parity-and-host-sink",
"measurements": [
{
"name": "canvas-idle",
"durationMs": 2234.319999999997,
"styleRecalcs": 8,
"styleRecalcDurationMs": 7.788999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 621.091,
"heapDeltaBytes": 3525728,
"heapUsedBytes": 71403648,
"domNodes": 16,
"jsHeapTotalBytes": 20836352,
"scriptDurationMs": 21.967,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "canvas-idle",
"durationMs": 2058.89099999996,
"styleRecalcs": 9,
"styleRecalcDurationMs": 7.702000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 527.251,
"heapDeltaBytes": -22375180,
"heapUsedBytes": 45587680,
"domNodes": -274,
"jsHeapTotalBytes": 19652608,
"scriptDurationMs": 19.824,
"eventListeners": -148,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1834.276999999986,
"styleRecalcs": 74,
"styleRecalcDurationMs": 37.913000000000004,
"layouts": 12,
"layoutDurationMs": 3.7430000000000008,
"taskDurationMs": 792.096,
"heapDeltaBytes": -16612252,
"heapUsedBytes": 51282352,
"domNodes": -275,
"jsHeapTotalBytes": 21225472,
"scriptDurationMs": 117.72099999999999,
"eventListeners": -148,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "canvas-mouse-sweep",
"durationMs": 1856.8230000000199,
"styleRecalcs": 75,
"styleRecalcDurationMs": 39.387,
"layouts": 12,
"layoutDurationMs": 3.548,
"taskDurationMs": 921.954,
"heapDeltaBytes": -16592244,
"heapUsedBytes": 51541200,
"domNodes": -275,
"jsHeapTotalBytes": 21487616,
"scriptDurationMs": 120.52799999999999,
"eventListeners": -148,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66999999999998,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1738.7509999999793,
"styleRecalcs": 32,
"styleRecalcDurationMs": 16.525000000000002,
"layouts": 6,
"layoutDurationMs": 0.586,
"taskDurationMs": 390.37300000000005,
"heapDeltaBytes": 7108676,
"heapUsedBytes": 75208404,
"domNodes": 79,
"jsHeapTotalBytes": 20312064,
"scriptDurationMs": 20.262,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "canvas-zoom-sweep",
"durationMs": 1751.1919999999463,
"styleRecalcs": 32,
"styleRecalcDurationMs": 20.614,
"layouts": 6,
"layoutDurationMs": 0.838,
"taskDurationMs": 394.151,
"heapDeltaBytes": 7137396,
"heapUsedBytes": 75316860,
"domNodes": 77,
"jsHeapTotalBytes": 20574208,
"scriptDurationMs": 19.213,
"eventListeners": 19,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "dom-widget-clipping",
"durationMs": 590.7929999999908,
"styleRecalcs": 11,
"styleRecalcDurationMs": 7.543999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 382.826,
"heapDeltaBytes": -12352804,
"heapUsedBytes": 55533044,
"domNodes": 18,
"jsHeapTotalBytes": 21098496,
"scriptDurationMs": 58.077000000000005,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "dom-widget-clipping",
"durationMs": 605.3939999999898,
"styleRecalcs": 11,
"styleRecalcDurationMs": 8.096999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 390.712,
"heapDeltaBytes": -12340480,
"heapUsedBytes": 55627616,
"domNodes": 18,
"jsHeapTotalBytes": 21098496,
"scriptDurationMs": 59.16400000000001,
"eventListeners": 0,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-idle",
"durationMs": 2033.108000000027,
"styleRecalcs": 9,
"styleRecalcDurationMs": 7.277000000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 656.306,
"heapDeltaBytes": 7323848,
"heapUsedBytes": 66750444,
"domNodes": -274,
"jsHeapTotalBytes": 4517888,
"scriptDurationMs": 92.74499999999999,
"eventListeners": -144,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.699999999999818
},
{
"name": "large-graph-idle",
"durationMs": 2028.776999999991,
"styleRecalcs": 9,
"styleRecalcDurationMs": 7.431,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 650.309,
"heapDeltaBytes": 6887096,
"heapUsedBytes": 65762048,
"domNodes": -276,
"jsHeapTotalBytes": 4255744,
"scriptDurationMs": 90.51100000000001,
"eventListeners": -144,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-pan",
"durationMs": 2191.9240000000286,
"styleRecalcs": 70,
"styleRecalcDurationMs": 15.653,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1262.2619999999997,
"heapDeltaBytes": 5139244,
"heapUsedBytes": 65128160,
"domNodes": -277,
"jsHeapTotalBytes": 4984832,
"scriptDurationMs": 414.456,
"eventListeners": -142,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "large-graph-pan",
"durationMs": 2151.581999999962,
"styleRecalcs": 68,
"styleRecalcDurationMs": 13.758000000000003,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 1294.916,
"heapDeltaBytes": 6368452,
"heapUsedBytes": 66612864,
"domNodes": -279,
"jsHeapTotalBytes": 5246976,
"scriptDurationMs": 461.48999999999995,
"eventListeners": -144,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "large-graph-zoom",
"durationMs": 3180.638999999985,
"styleRecalcs": 65,
"styleRecalcDurationMs": 15.055999999999996,
"layouts": 60,
"layoutDurationMs": 7.8340000000000005,
"taskDurationMs": 1495.684,
"heapDeltaBytes": -3467900,
"heapUsedBytes": 57982528,
"domNodes": -281,
"jsHeapTotalBytes": 7925760,
"scriptDurationMs": 521.0550000000001,
"eventListeners": -148,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "large-graph-zoom",
"durationMs": 3213.8259999999264,
"styleRecalcs": 66,
"styleRecalcDurationMs": 15.943999999999996,
"layouts": 60,
"layoutDurationMs": 7.997000000000001,
"taskDurationMs": 1537.433,
"heapDeltaBytes": -2086388,
"heapUsedBytes": 59449692,
"domNodes": -281,
"jsHeapTotalBytes": 7401472,
"scriptDurationMs": 525.946,
"eventListeners": -148,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "minimap-idle",
"durationMs": 2044.7439999999801,
"styleRecalcs": 9,
"styleRecalcDurationMs": 8.140999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 706.2800000000001,
"heapDeltaBytes": 7823108,
"heapUsedBytes": 68505800,
"domNodes": -276,
"jsHeapTotalBytes": 5304320,
"scriptDurationMs": 108.16899999999998,
"eventListeners": -146,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "minimap-idle",
"durationMs": 2023.7040000000661,
"styleRecalcs": 9,
"styleRecalcDurationMs": 7.237999999999998,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 657.8489999999999,
"heapDeltaBytes": 6418240,
"heapUsedBytes": 67089420,
"domNodes": -277,
"jsHeapTotalBytes": 4780032,
"scriptDurationMs": 92.23400000000001,
"eventListeners": -142,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 591.3590000000113,
"styleRecalcs": 48,
"styleRecalcDurationMs": 11.453000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 397.296,
"heapDeltaBytes": -12112860,
"heapUsedBytes": 56009024,
"domNodes": 22,
"jsHeapTotalBytes": 21884928,
"scriptDurationMs": 121.732,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.670000000000012,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-dom-widget-clipping",
"durationMs": 577.3460000000341,
"styleRecalcs": 47,
"styleRecalcDurationMs": 10.191,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 401.17,
"heapDeltaBytes": -12039868,
"heapUsedBytes": 55944280,
"domNodes": 20,
"jsHeapTotalBytes": 22409216,
"scriptDurationMs": 120.06199999999998,
"eventListeners": 6,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-idle",
"durationMs": 2005.5380000000014,
"styleRecalcs": 9,
"styleRecalcDurationMs": 7.987999999999999,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 517.744,
"heapDeltaBytes": -21753936,
"heapUsedBytes": 46224028,
"domNodes": -273,
"jsHeapTotalBytes": 20701184,
"scriptDurationMs": 15.458,
"eventListeners": -148,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-idle",
"durationMs": 2003.938000000005,
"styleRecalcs": 10,
"styleRecalcDurationMs": 9.094000000000001,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 364.603,
"heapDeltaBytes": 3495880,
"heapUsedBytes": 71548572,
"domNodes": 20,
"jsHeapTotalBytes": 21098496,
"scriptDurationMs": 14.946000000000002,
"eventListeners": 4,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1735.9609999999748,
"styleRecalcs": 75,
"styleRecalcDurationMs": 34.801,
"layouts": 16,
"layoutDurationMs": 4.136,
"taskDurationMs": 780.4649999999999,
"heapDeltaBytes": -20891024,
"heapUsedBytes": 47376840,
"domNodes": -275,
"jsHeapTotalBytes": 19914752,
"scriptDurationMs": 88.379,
"eventListeners": -148,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "subgraph-mouse-sweep",
"durationMs": 1710.809999999924,
"styleRecalcs": 75,
"styleRecalcDurationMs": 34.099,
"layouts": 16,
"layoutDurationMs": 4.012,
"taskDurationMs": 775.371,
"heapDeltaBytes": -20665356,
"heapUsedBytes": 47381688,
"domNodes": -273,
"jsHeapTotalBytes": 20439040,
"scriptDurationMs": 85.443,
"eventListeners": -148,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "subgraph-transition-enter",
"durationMs": 1385.9630000000038,
"styleRecalcs": 17,
"styleRecalcDurationMs": 30.24199999999999,
"layouts": 13,
"layoutDurationMs": 12.319,
"taskDurationMs": 972.7050000000002,
"heapDeltaBytes": 31029444,
"heapUsedBytes": 99568964,
"domNodes": 13673,
"jsHeapTotalBytes": 14942208,
"scriptDurationMs": 35.428000000000004,
"eventListeners": 2371,
"totalBlockingTimeMs": 119,
"frameDurationMs": 16.66333333333335,
"p95FrameDurationMs": 16.800000000000182
},
{
"name": "viewport-pan-sweep",
"durationMs": 8162.060999999994,
"styleRecalcs": 249,
"styleRecalcDurationMs": 39.519999999999996,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 4283.187000000001,
"heapDeltaBytes": 10551148,
"heapUsedBytes": 69775996,
"domNodes": -275,
"jsHeapTotalBytes": 6819840,
"scriptDurationMs": 1303.1480000000001,
"eventListeners": -128,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333338,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "viewport-pan-sweep",
"durationMs": 8235.149999999976,
"styleRecalcs": 251,
"styleRecalcDurationMs": 42.309,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 4309.153,
"heapDeltaBytes": 10572528,
"heapUsedBytes": 69203184,
"domNodes": -273,
"jsHeapTotalBytes": 6529024,
"scriptDurationMs": 1305.1439999999998,
"eventListeners": -128,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.669999999999952,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-idle",
"durationMs": 17510.185999999976,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 17491.073,
"heapDeltaBytes": -56466456,
"heapUsedBytes": 167406640,
"domNodes": -8312,
"jsHeapTotalBytes": -9109504,
"scriptDurationMs": 541.139,
"eventListeners": -16387,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.779999999999927,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-idle",
"durationMs": 17843.043000000078,
"styleRecalcs": 0,
"styleRecalcDurationMs": 0,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 17796.408999999996,
"heapDeltaBytes": -47513500,
"heapUsedBytes": 166974584,
"domNodes": -8312,
"jsHeapTotalBytes": -12259328,
"scriptDurationMs": 577.791,
"eventListeners": -16385,
"totalBlockingTimeMs": 0,
"frameDurationMs": 17.780000000000047,
"p95FrameDurationMs": 16.80000000000291
},
{
"name": "vue-large-graph-pan",
"durationMs": 21411.48799999996,
"styleRecalcs": 147,
"styleRecalcDurationMs": 19.94800000000002,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 21387.01,
"heapDeltaBytes": -36648940,
"heapUsedBytes": 164206676,
"domNodes": -8312,
"jsHeapTotalBytes": -15667200,
"scriptDurationMs": 860.879,
"eventListeners": -16379,
"totalBlockingTimeMs": 413,
"frameDurationMs": 17.776666666666642,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "vue-large-graph-pan",
"durationMs": 22387.073999999986,
"styleRecalcs": 161,
"styleRecalcDurationMs": 22.06199999999997,
"layouts": 0,
"layoutDurationMs": 0,
"taskDurationMs": 22328.807999999997,
"heapDeltaBytes": -45069876,
"heapUsedBytes": 156185720,
"domNodes": -8312,
"jsHeapTotalBytes": -15667200,
"scriptDurationMs": 862.022,
"eventListeners": -16385,
"totalBlockingTimeMs": 383,
"frameDurationMs": 18.329999999999927,
"p95FrameDurationMs": 16.799999999999272
},
{
"name": "workflow-execution",
"durationMs": 463.8039999999819,
"styleRecalcs": 15,
"styleRecalcDurationMs": 23.874999999999996,
"layouts": 3,
"layoutDurationMs": 1.259,
"taskDurationMs": 133.057,
"heapDeltaBytes": -15891200,
"heapUsedBytes": 51072892,
"domNodes": 130,
"jsHeapTotalBytes": 7991296,
"scriptDurationMs": 13.970999999999998,
"eventListeners": 67,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.66333333333332,
"p95FrameDurationMs": 16.700000000000728
},
{
"name": "workflow-execution",
"durationMs": 484.78799999998046,
"styleRecalcs": 13,
"styleRecalcDurationMs": 20.37,
"layouts": 2,
"layoutDurationMs": 0.413,
"taskDurationMs": 122.58700000000002,
"heapDeltaBytes": -16011296,
"heapUsedBytes": 51043720,
"domNodes": 119,
"jsHeapTotalBytes": 7991296,
"scriptDurationMs": 10.769,
"eventListeners": 65,
"totalBlockingTimeMs": 0,
"frameDurationMs": 16.666666666666668,
"p95FrameDurationMs": 16.700000000000728
}
]
} |
🎨 Storybook: 🚧 Building... |
📝 WalkthroughWalkthroughBilling operation success handling now emits shared billing telemetry for subscription, topup, and cancel operations. The host telemetry sink derives billing event names and payloads before forwarding them to the host capture bridge, with expanded success and failure test coverage. ChangesBilling telemetry
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant billingOperationStore
participant Telemetry
participant HostTelemetrySink
participant HostTelemetryBridge
billingOperationStore->>Telemetry: trackBillingEvent(success payload)
Telemetry->>HostTelemetrySink: trackBillingEvent(event)
HostTelemetrySink->>HostTelemetryBridge: capture(derived event name, payload)
Possibly related PRs
Suggested labels: Suggested reviewers: Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 inconclusive)
✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/platform/workspace/stores/billingOperationStore.ts (1)
296-303: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winPreserve the existing cancel success event.
The
billing.cancel.succeededevent is no longer emitted; cancel operations now produce onlybilling.operation.succeeded. This removes an existing telemetry contract and contradicts the PR objective that existing flow-specific success events remain unchanged. Restore the cancel-specific event and retain a regression assertion for it.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/platform/workspace/stores/billingOperationStore.ts` around lines 296 - 303, Restore the existing cancel-specific success telemetry in the operation success handling near the topup branch: when the operation type is cancel, emit billing.cancel.succeeded in addition to the generic billing.operation.succeeded event. Add or retain a regression assertion verifying the cancel event is emitted, while leaving the topup success behavior unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/platform/workspace/stores/billingOperationStore.ts`:
- Around line 296-303: Restore the existing cancel-specific success telemetry in
the operation success handling near the topup branch: when the operation type is
cancel, emit billing.cancel.succeeded in addition to the generic
billing.operation.succeeded event. Add or retain a regression assertion
verifying the cancel event is emitted, while leaving the topup success behavior
unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: e83074da-8a65-485e-a097-e36aadc57af0
📒 Files selected for processing (5)
src/platform/telemetry/initHostTelemetry.test.tssrc/platform/telemetry/providers/host/HostTelemetrySink.test.tssrc/platform/telemetry/providers/host/HostTelemetrySink.tssrc/platform/workspace/stores/billingOperationStore.test.tssrc/platform/workspace/stores/billingOperationStore.ts
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #14310 +/- ##
==========================================
+ Coverage 79.55% 79.59% +0.04%
==========================================
Files 1759 1759
Lines 111692 111637 -55
Branches 37626 36860 -766
==========================================
+ Hits 88860 88861 +1
+ Misses 22313 22250 -63
- Partials 519 526 +7
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 6 files with indirect coverage changes 🚀 New features to boost your workflow:
|
christian-byrne
left a comment
There was a problem hiding this comment.
Reviewed at 2ac76ba. This one is clean — no blocking findings, and I'd land it. Both fixes do exactly what the body claims, the six new tests use the real helpers rather than mocks and each pins something a revert would break, and the event-contract table is the single most useful artefact anyone in this program has produced for the Terraform side. The notes below are all optional; the first is a refutation of an existing bot finding, so please read that one before acting on the review queue.
0. Please ignore CodeRabbit's "Preserve the existing cancel success event" — it is wrong
There is no billing.cancel.* event and there never was. BillingTelemetryEvent's operation union is subscription_checkout | operation | resubscribe | topup | downgrade_to_personal (src/platform/telemetry/types.ts:721-726), and names are derived as `billing.${operation}.${stage}` (:739) — billing.cancel.succeeded is not a constructible name.
Cancel success has always been billing.operation.succeeded with operation_type: 'cancel', and this PR preserves it: the old hardcoded else branch is replaced by the unconditional emit at billingOperationStore.ts:261-271, which passes operation_type: operation.type (= 'cancel' for cancels). The pre-existing assertion at billingOperationStore.test.ts:784-789 is untouched and green. No action needed.
1. LOW (contract) — team→personal downgrades now count as operation_type: 'subscription' successes
src/platform/workspace/composables/useDowngradeToPersonal.ts:305-319 starts its poller with type: 'subscription' and checkoutType: 'change'. After this change a completed downgrade emits three success events: billing.operation.succeeded{operation_type:'subscription'}, billing.subscription_checkout.succeeded, and billing.downgrade_to_personal.succeeded.
The success rate is unaffected — handleFailure was already symmetric on this — but subscription success volume on the new operation-level metric now includes churn events. Since the body's contract table is what the monitor author will read, worth one bullet in "Notes for anyone querying this": a downgrade-to-personal rides operation_type: 'subscription', so conversion counts built on that tag should exclude events that also carry a billing.downgrade_to_personal.* sibling.
2. LOW — fix 2 closes the funnel blind spot but not the alerting one; worth saying so explicitly
initHostTelemetry replaces the registry, so with this fix desktop-in-cloud billing events reach the host bridge and only the host bridge — they still do not reach Datadog RUM. Given RUM is the agreed alerting sink, that segment becomes visible in the host's analytics while remaining invisible to alerting.
The body frames the composition question well and I agree with leaving it open. The ask is just one sentence saying which of the two blind spots this closes, so "closes a whole-segment blind spot — desktop-in-cloud users are currently absent from every billing funnel, on every provider" isn't read as "that segment is now alertable".
3. LOW — the host sink's primitive filter will silently drop a future object-valued billing property
src/platform/telemetry/providers/host/HostTelemetrySink.ts:75-90. toHostTelemetryProperties keeps only primitives and primitive arrays. Every property getBillingTelemetryEventPayload produces is a string or number today, so this is a no-op right now.
But trackBillingEvent is unusual among the sink's methods in that its payload shape is defined in another file and is actively being extended (duration_ms in #14229; workspace_id / billing_attempt_id in ADR-0014). If any of those lands as an object, it vanishes on the host rail only, with no error and no test failure. Not worth changing here — worth a one-line comment on trackBillingEvent:128 noting the primitives-only constraint so the next person extending the payload sees it.
4. LOW — the cancel row of the new parameterized test asserts a payload production never emits
src/platform/workspace/stores/billingOperationStore.test.ts:146-177 runs all three types through startOperation(..., { tier, cycle, checkoutType, paymentIntentSource }). Real cancels are started metadata-free (useWorkspaceBilling.ts:336-339), so the cancel row pins a shape that never occurs.
Harmless for the parity invariant being tested. But the body's caveat (c) — that the four optional keys are omitted, not null, when the poller starts metadata-free — is the more load-bearing property for the monitors (a group-by has to tolerate a missing tag), and nothing asserts it. Suggest one extra case: start an operation with no metadata, assert billing.operation.succeeded fires and that tier/cycle/checkout_type/payment_intent_source are absent from the payload rather than undefined.
What I checked and found fine — don't redo these
- Fix 1 is exactly the parity change claimed. The unconditional emit at
billingOperationStore.ts:261carriesoperation_type: operation.typeplus the same four optional grouping keys thathandleFailure(:362) andhandleTimeout(:408) already carried, so the numerator and denominator of a success-rate ratio are groupable by identical tags. Thecancelpayload is unchanged in practice. - Fix 2 is a faithful copy of the cloud providers.
HostTelemetrySink.trackBillingEvent(:128-133) delegates to the samegetBillingTelemetryEventName/getBillingTelemetryEventPayloadpair asPostHogTelemetryProvider:442andDatadogRumTelemetryProvider:14. No parallel serialization path that could drift. - Test quality. All six new tests exercise the real helpers, not mocks, and each fails on revert:
it.forover the three operation types (correct —it.eachis a lint error in this repo), the sink forwarding one success and one failure event, and the end-to-endinitHostTelemetry.test.tscase that proves the replacement registry actually dispatchestrackBillingEvent. - Sibling sweep, both fixes. For fix 1:
handleFailureandhandleTimeoutalready emitted for all three types, so this closes an asymmetry rather than creating one. For fix 2: the seven other missingTelemetryProvidermethods are named as out of scope in the body — confirmed they are still absent and all billing-irrelevant, so this is a clean carve-out rather than a partial fix. - Failure-hook reachability and terminal-state honesty.
handleSuccessfires only from a backend-confirmedsucceededpoll status, so no premature success. Nothing here sits downstream ofwrapWithErrorHandlingAsync. - Event and property names match the shipped canonical contract, derived rather than hand-written.
- Payload hygiene is clean — no raw error strings, no user-authored free text, no Stripe identifiers.
- No private context. The infra repo is referred to only as "a private, access-controlled infra repository"; no monitor or dashboard ids, no analytics project or insight ids, no Slack links or channels, no on-call handles, no personal names. The plan-doc link returns HTTP 200 unauthenticated.
- CI green,
MERGEABLE, basemain. The noted textual conflict with #14216 inhandleSuccessis real but trivial in either merge order.
dante01yoon
left a comment
There was a problem hiding this comment.
Fresh FE-only review at 2ac76ba against current main: no blocking findings.
billing.operation.succeededis emitted once from the backend-confirmed success path forsubscription,topup, andcancel, with the same operation ID/type and optional grouping fields used by.failed/.timeout. Existing flow-specific subscription/top-up/downgrade events remain distinct and unchanged; the prior cancel event remains the same canonical event after moving the emit.HostTelemetrySink.trackBillingEventdelegates to the same canonical name/payload helpers as PostHog and Datadog. The registry path reaches the desktop bridge, the absent-bridge path remains safe, and billing payload fields are compatible with the host's primitive filter.- I found no same-name duplicate emission, missing billing filter, free-form error/user content, new PII exposure, lifecycle inconsistency, or bridge-specific serialization drift.
- Coverage includes all three successful operation types, success/failure host mappings, and end-to-end registry forwarding. Current CI is green (72 checks; no pending/failing checks), patch coverage is 100%, and a merge-tree check against current
maincompleted cleanly despite the branch being behind.
Approved.
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
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
Changes
billingOperationStore.handleSuccessnow emitsbilling.operation.succeededfor all three operation types (subscription,topup,cancel). It previously only emitted it forcancel, whilebilling.operation.failedandbilling.operation.timeoutare emitted for all three. Anysucceeded / (succeeded + failed)ratio grouped byoperation_typetherefore read a permanent 0% forsubscriptionandtopup— a metric that can never be non-zero, so an anomaly monitor on it pages immediately and forever.HostTelemetrySinknow implementstrackBillingEvent. It did not, andinitHostTelemetryreplaces the provider registry rather than extending it, so a cloud build running inside the desktop shell emitted zero canonicalbilling.*events to any provider — an entire user segment missing from every billing funnel.Event contract after this change
billing.operation.succeededis now emitted once per successful billing operation, for every operation type, with the property set below. This matchesbilling.operation.failed/billing.operation.timeoutexactly, so numerator and denominator of a success-rate ratio are groupable by the same tags:operation'operation'stage'succeeded'outcome'success'billing_op_idoperation_type'subscription' | 'topup' | 'cancel'tier'team'cycle'monthly' | 'yearly'checkout_type'new' | 'change'payment_intent_sourceNotes for anyone querying this:
succeeded / (succeeded + failed)overbilling.operation.*, grouped byoperation_type, and it will be non-zero for all three types..timeoutis a separate stage from.failed; a ratio that should treat timeouts as failures must include both in the denominator.billing.subscription_checkout.succeededandbilling.topup.succeededare unchanged and still fire. Asubscriptionsuccess therefore emits bothbilling.operation.succeededandbilling.subscription_checkout.succeeded. These are distinct event names — do not sum them into one success count.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:
billingOperationStore.ts— the whole fix is one moved emit. The newbilling.operation.succeededcall is unconditional at the top ofhandleSuccess's telemetry block; the oldelsebranch that emitted it only forcancelis deleted. Confirm thecancelpayload is unchanged in practice (canceloperations are started without metadata, so the four new optional keys serialize away) and thatsubscription/topupnow additionally emit it.HostTelemetrySink.ts— a four-line method delegating to the samegetBillingTelemetryEventName/getBillingTelemetryEventPayloadhelpers the two cloud providers use, so the host rail receives a byte-identical property set.The design question worth a second opinion (fix 2). There were two candidate fixes: implement
trackBillingEventon the sink, or makeinitHostTelemetrycompose 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 54TelemetryProvidermethods through a singlecapture()bridge, andtrackBillingEventpostdates 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, andtrackWorkspaceInviteFailedare likewise absent from the host sink. OnlytrackBillingEventis 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. #14216 also edits
handleSuccessin this file, adding a dual-emit inside thetype === 'subscription'branch. This PR's hunk is an insertion before that branch plus the deletion of the trailingelse. The two are semantically independent and compatible; expect at most a trivial textual conflict depending on merge order. This PR deliberately does not touchuseDowngradeToPersonal.ts, whose three remainingfailure_category: 'unknown'sites are already claimed by #14229.Testing
Six new regression tests, all confirmed to fail against the unfixed source:
billingOperationStore.test.ts— parameterized over all three operation types, assertingbilling.operation.succeededfires 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: afterinitHostTelemetry(), atrackBillingEventcall 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.mdthis belongs at the unit level.Gates:
pnpm typecheck,pnpm lint,pnpm format:check,pnpm knipall clean; full unit suite green (1067 files, 14204 passed / 8 skipped).