diff --git a/src/main/telemetry/client.test.ts b/src/main/telemetry/client.test.ts index a5361b64395..2b76dd44c36 100644 --- a/src/main/telemetry/client.test.ts +++ b/src/main/telemetry/client.test.ts @@ -361,16 +361,15 @@ describe('setOptIn()', () => { expect(order).toEqual(['optIn', 'capture:telemetry_opted_in']) }) - it('console-mirrors telemetry_opted_in when no PostHog client is initialized', async () => { + it('drops telemetry_opted_in silently in non-official builds', async () => { settings.telemetry!.optedIn = false _setPostHogClientForTests(null) _enableTransportForTests(false) await setOptIn('settings', true) - expect(console.debug).toHaveBeenCalledWith('[telemetry]', 'telemetry_opted_in', { - via: 'settings' - }) + expect(mock.capture).not.toHaveBeenCalled() + expect(console.debug).not.toHaveBeenCalled() }) it('fires app_opened once after pending-banner opt-in enables the SDK', async () => { diff --git a/src/main/telemetry/client.ts b/src/main/telemetry/client.ts index 5ee4ac4b956..03b8effc7f9 100644 --- a/src/main/telemetry/client.ts +++ b/src/main/telemetry/client.ts @@ -248,20 +248,19 @@ function waitForCaptureEnqueue(client: PostHog, event: EventName, uuid: string): }) } +// In `pnpm dev` and any contributor / non-official build, `track()` is a +// no-op: it returns immediately without transmitting, logging, or running +// the burst-cap / consent / validator pipeline. Telemetry only flows in +// official stable/rc builds where CI injects `ORCA_BUILD_IDENTITY` and +// `ORCA_POSTHOG_WRITE_KEY`. export function track(name: N, props: EventProps): void { - // Console mirror: always in non-official builds (so the whole team — - // contributors included — sees exactly what would transmit) and also in - // official builds when `TELEMETRY_ENABLED` is off (PR 2 verification). - // These are the only two paths that short-circuit before the pipeline. if (!testTransportEnabled && (!IS_OFFICIAL_BUILD || !TELEMETRY_ENABLED)) { - console.debug('[telemetry]', name, props) return } // (1) Shutdown gate. Late IPC arrivals should not attempt to enqueue // against a client that is actively flushing. if (shuttingDown) { - console.debug('[telemetry] shutdown-gate drop:', name) return } if (!posthog || !commonProps || !storeRef) {