From 5463aa10d63a0499b7d80b48c7ea1e80fc8d63e2 Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Fri, 13 Nov 2026 16:21:12 -0800 Subject: [PATCH] test: delete shallow telemetry schema and allowlist suites (#42203) Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com> --- src/shared/daemon-adoption-telemetry.test.ts | 74 ------------------- .../feature-education-telemetry.test.ts | 29 -------- 2 files changed, 103 deletions(-) delete mode 100644 src/shared/daemon-adoption-telemetry.test.ts delete mode 100644 src/shared/feature-education-telemetry.test.ts diff --git a/src/shared/daemon-adoption-telemetry.test.ts b/src/shared/daemon-adoption-telemetry.test.ts deleted file mode 100644 index df65ffabd4a..00000000000 --- a/src/shared/daemon-adoption-telemetry.test.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { describe, expect, it } from 'vitest' - -import { eventSchemas } from './telemetry-event-registry' - -// The reset remedy is offered for exactly these classes, so main and the fix dialog must agree. - -// Privacy invariant: enum-only. A raw path, version, or exact count must be rejected by .strict(). -describe('daemon_adopted / daemon_pty_cwd_denied schemas', () => { - const adopted = { - app_version_match: 'different', - spawner_path_class: 'updater-cache', - code_identity: 'unresolvable', - tcc_attribution: 'intact', - live_session_count_bucket: '2-5' - } - const denied = { - cwd_class: 'documents', - app_version_match: 'different', - spawner_path_class: 'updater-cache', - code_identity: 'parked' - } - - it('rejects leaked paths, versions, counts, and unknown enum values', () => { - for (const leak of [ - { spawner_exec_path: '/Users/alice/Library/Caches/ShipIt/Orca.app' }, - { app_version: '1.4.187' }, - { live_session_count: 3 }, - { cwd: '/Users/alice/Documents' } - ]) { - expect(eventSchemas.daemon_adopted.safeParse({ ...adopted, ...leak }).success).toBe(false) - expect(eventSchemas.daemon_pty_cwd_denied.safeParse({ ...denied, ...leak }).success).toBe( - false - ) - } - expect( - eventSchemas.daemon_adopted.safeParse({ ...adopted, spawner_path_class: '/Applications' }) - .success - ).toBe(false) - expect( - eventSchemas.daemon_pty_cwd_denied.safeParse({ ...denied, cwd_class: 'Documents' }).success - ).toBe(false) - expect( - eventSchemas.daemon_adopted.safeParse({ ...adopted, code_identity: 'severed' }).success - ).toBe(false) - expect( - eventSchemas.daemon_pty_cwd_readable.safeParse({ ...denied, launch_method: 'stable-copy' }) - .success - ).toBe(false) - expect( - eventSchemas.daemon_pty_cwd_readable.safeParse({ - ...denied, - spawner_path_class: 'stable-copy' - }).success - ).toBe(true) - }) -}) - -// Match the denied-event enum-only privacy budget: no daemon scope, path or folder name. -describe('daemon_folder_access_notice schema', () => { - const shown = { action: 'shown', cwd_class: 'documents' } - - it('rejects an unknown action, an unknown class, and any extra field', () => { - for (const bad of [ - { action: 'open_manage_sessions' }, - { cwd_class: 'Documents' }, - { daemon_scope: 'aaaa111122223333' }, - { cwd: '/Users/alice/Documents' } - ]) { - expect(eventSchemas.daemon_folder_access_notice.safeParse({ ...shown, ...bad }).success).toBe( - false - ) - } - }) -}) diff --git a/src/shared/feature-education-telemetry.test.ts b/src/shared/feature-education-telemetry.test.ts deleted file mode 100644 index c56801c6470..00000000000 --- a/src/shared/feature-education-telemetry.test.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - normalizeFeatureEducationSource, - normalizeSetupGuideSource -} from './feature-education-telemetry' - -describe('feature education telemetry constants', () => { - it('normalizes unknown telemetry sources to a bounded fallback', () => { - expect(normalizeFeatureEducationSource('tasks_open')).toBe('tasks_open') - expect(normalizeFeatureEducationSource('workspace_agent_sessions_visible')).toBe( - 'workspace_agent_sessions_visible' - ) - expect(normalizeFeatureEducationSource('floating_workspace_visible')).toBe( - 'floating_workspace_visible' - ) - expect(normalizeFeatureEducationSource('setup_guide_parallel_work')).toBe( - 'setup_guide_parallel_work' - ) - expect(normalizeFeatureEducationSource('https://example.com/private')).toBe('unknown') - expect(normalizeFeatureEducationSource(null)).toBe('unknown') - }) - - it('normalizes setup guide telemetry sources to a bounded fallback', () => { - expect(normalizeSetupGuideSource('sidebar')).toBe('sidebar') - expect(normalizeSetupGuideSource('settings')).toBe('settings') - expect(normalizeSetupGuideSource('help_menu')).toBe('help_menu') - expect(normalizeSetupGuideSource('private-source')).toBe('unknown') - }) -})