From 88e23db6b5403732e6ffd034ceaf7f492249b732 Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Wed, 28 Oct 2026 14:12:18 -0700 Subject: [PATCH] test: remove 16 low-value audience, notice and export cases (#35128) Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com> --- config/scripts/ci-shard-timings.json | 1 - .../gpu-crash-fallback-decision.test.ts | 60 +------------------ .../hook-plugin-module-contract.test.ts | 25 -------- .../use-browser-page-resource-notices.test.ts | 43 ------------- .../native-chat-context-usage.test.ts | 17 +----- .../native-chat-upgrade-tip-audience.test.ts | 32 ---------- .../native-chat-visual-shell.test.ts | 27 --------- 7 files changed, 2 insertions(+), 203 deletions(-) delete mode 100644 src/renderer/src/components/browser-pane/navigate/use-browser-page-resource-notices.test.ts delete mode 100644 src/shared/native-chat/native-chat-upgrade-tip-audience.test.ts diff --git a/config/scripts/ci-shard-timings.json b/config/scripts/ci-shard-timings.json index c9139da2205..92aaa7d3a91 100644 --- a/config/scripts/ci-shard-timings.json +++ b/config/scripts/ci-shard-timings.json @@ -12508,7 +12508,6 @@ "src/shared/native-chat-turn-membership.test.ts": 174, "src/shared/native-chat-turn-status.test.ts": 52, "src/shared/native-chat-unverifiable-turn-status.test.ts": 111, - "src/shared/native-chat/native-chat-upgrade-tip-audience.test.ts": 41, "src/shared/native-chat/native-chat-visual-directive.test.ts": 45, "src/shared/native-chat/native-chat-visual-height-governor.test.ts": 141, "src/shared/native-chat/native-chat-visual-shell.reader-scroll.test.ts": 188, diff --git a/src/main/crash-reporting/gpu-crash-fallback-decision.test.ts b/src/main/crash-reporting/gpu-crash-fallback-decision.test.ts index 059482284fe..04cdadeb401 100644 --- a/src/main/crash-reporting/gpu-crash-fallback-decision.test.ts +++ b/src/main/crash-reporting/gpu-crash-fallback-decision.test.ts @@ -1,27 +1,7 @@ import { describe, expect, it } from 'vitest' -import { - GpuCrashFallbackTracker, - isGpuChildProcessType, - isGpuFallbackCrashCandidate -} from './gpu-crash-fallback-decision' +import { GpuCrashFallbackTracker, isGpuFallbackCrashCandidate } from './gpu-crash-fallback-decision' describe('GpuCrashFallbackTracker', () => { - it('engages fallback once GPU crashes hit the threshold inside the window', () => { - const tracker = new GpuCrashFallbackTracker({ windowMs: 30_000, threshold: 3 }) - expect(tracker.recordGpuCrash(500)).toEqual({ - shouldEngageFallback: false, - crashesInWindow: 1 - }) - expect(tracker.recordGpuCrash(8_000)).toEqual({ - shouldEngageFallback: false, - crashesInWindow: 2 - }) - expect(tracker.recordGpuCrash(16_000)).toEqual({ - shouldEngageFallback: true, - crashesInWindow: 3 - }) - }) - it('engages at most once so the relaunch cannot loop', () => { const tracker = new GpuCrashFallbackTracker({ windowMs: 30_000, threshold: 2 }) tracker.recordGpuCrash(100) @@ -44,18 +24,6 @@ describe('GpuCrashFallbackTracker', () => { expect(tracker.hasEngaged()).toBe(false) }) - it('engages on a burst that starts long after launch (session 12e6ee64)', () => { - const tracker = new GpuCrashFallbackTracker({ windowMs: 30_000, threshold: 3 }) - // Field timings reproduce a burst long after launch. - expect(tracker.recordGpuCrash(242_137).shouldEngageFallback).toBe(false) - expect(tracker.recordGpuCrash(920_110).shouldEngageFallback).toBe(false) - expect(tracker.recordGpuCrash(926_462).shouldEngageFallback).toBe(false) - expect(tracker.recordGpuCrash(946_115)).toEqual({ - shouldEngageFallback: true, - crashesInWindow: 3 - }) - }) - it('treats a span of exactly windowMs as inside the window', () => { const tracker = new GpuCrashFallbackTracker({ windowMs: 30_000, threshold: 3 }) tracker.recordGpuCrash(0) @@ -75,38 +43,12 @@ describe('GpuCrashFallbackTracker', () => { expect(tracker.hasEngaged()).toBe(false) }) - it('ignores a slow drip that never fills the window', () => { - const tracker = new GpuCrashFallbackTracker({ windowMs: 30_000, threshold: 3 }) - for (const at of [0, 20_000, 40_000, 60_000, 80_000, 100_000]) { - expect(tracker.recordGpuCrash(at).shouldEngageFallback).toBe(false) - } - expect(tracker.hasEngaged()).toBe(false) - }) - - it('never retains a crash older than the window, even on a backwards clock jump', () => { - const tracker = new GpuCrashFallbackTracker({ windowMs: 30_000, threshold: 3 }) - tracker.recordGpuCrash(100_000) - tracker.recordGpuCrash(1_000) - // Assert sorted pruning directly; the crash count alone can hide out-of-order retention. - const window = tracker.windowSnapshot() - const newest = window.at(-1) ?? 0 - expect(window.every((at) => newest - at <= 30_000)).toBe(true) - expect([...window]).toEqual([...window].sort((left, right) => left - right)) - }) - it('ignores impossible timestamps', () => { const tracker = new GpuCrashFallbackTracker({ windowMs: 30_000, threshold: 1 }) expect(tracker.recordGpuCrash(-1).shouldEngageFallback).toBe(false) expect(tracker.recordGpuCrash(Number.NaN).shouldEngageFallback).toBe(false) expect(tracker.hasEngaged()).toBe(false) }) - - it('classifies GPU child process types case-insensitively', () => { - expect(isGpuChildProcessType('GPU')).toBe(true) - expect(isGpuChildProcessType('gpu')).toBe(true) - expect(isGpuChildProcessType('Utility')).toBe(false) - expect(isGpuChildProcessType(undefined)).toBe(false) - }) }) describe('isGpuFallbackCrashCandidate', () => { diff --git a/src/main/opencode/hook-plugin-module-contract.test.ts b/src/main/opencode/hook-plugin-module-contract.test.ts index f86703616e6..6e6f3226ed3 100644 --- a/src/main/opencode/hook-plugin-module-contract.test.ts +++ b/src/main/opencode/hook-plugin-module-contract.test.ts @@ -107,31 +107,6 @@ describe('OpenCode status plugin module contract', () => { expect(module.default).toBe(module.OrcaOpenCodeStatusPlugin) }) - it('exposes a default export carrying a string id and a callable server()', async () => { - const module = await loadPluginModule() - - expect(module.default).toBeTypeOf('object') - expect(typeof module.default?.id).toBe('string') - expect(module.default?.id).toBe('orca-opencode-status') - expect(module.default?.server).toBeTypeOf('function') - }) - - it('keeps the named factory export so the factory-based loader still resolves', async () => { - const module = await loadPluginModule() - - expect(module.OrcaOpenCodeStatusPlugin).toBeTypeOf('function') - }) - - it('returns an event handler from the default export server(), like the named factory', async () => { - const module = await loadPluginModule() - - const fromDefault = await module.default?.server?.({}) - const fromNamed = await module.OrcaOpenCodeStatusPlugin?.({}) - - expect(fromDefault?.event).toBeTypeOf('function') - expect(fromNamed?.event).toBeTypeOf('function') - }) - it('reports a session lifecycle event through the hook endpoint when driven via the default export', async () => { process.env.ORCA_PANE_KEY = 'tab-1:leaf-1' const posts = captureHookPosts() diff --git a/src/renderer/src/components/browser-pane/navigate/use-browser-page-resource-notices.test.ts b/src/renderer/src/components/browser-pane/navigate/use-browser-page-resource-notices.test.ts deleted file mode 100644 index 16999b78417..00000000000 --- a/src/renderer/src/components/browser-pane/navigate/use-browser-page-resource-notices.test.ts +++ /dev/null @@ -1,43 +0,0 @@ -// @vitest-environment happy-dom -import { cleanup, renderHook } from '@testing-library/react' -import { afterEach, expect, it, vi } from 'vitest' - -const state = vi.hoisted(() => ({ - browserSessionImportState: { - status: 'success', - summary: { - totalCookies: 2, - importedCookies: 1, - skippedCookies: 1, - domains: ['good.example'] - } - }, - clearBrowserSessionImportState: vi.fn() -})) - -vi.mock('@/store', () => ({ - useAppStore: (select: (value: typeof state) => unknown) => select(state) -})) - -import { useBrowserPageResourceNotices } from './use-browser-page-resource-notices' - -afterEach(cleanup) - -it('names only the successful summary domains in the import notice', () => { - Object.defineProperty(window, 'api', { - configurable: true, - value: { - browser: { - onPermissionDenied: () => () => {}, - onPopup: () => () => {} - } - } - }) - - const { result } = renderHook(() => useBrowserPageResourceNotices('browser-1')) - - expect(result.current.resourceNotice).toBe( - 'Imported 1 cookies for good.example. Reload the page to use them.' - ) - expect(state.clearBrowserSessionImportState).toHaveBeenCalledOnce() -}) diff --git a/src/shared/native-chat/native-chat-context-usage.test.ts b/src/shared/native-chat/native-chat-context-usage.test.ts index 8cf5ff1f9f7..ffa9a7fb42f 100644 --- a/src/shared/native-chat/native-chat-context-usage.test.ts +++ b/src/shared/native-chat/native-chat-context-usage.test.ts @@ -1,8 +1,5 @@ import { describe, expect, it } from 'vitest' -import { - deriveNativeChatContextUsage, - isNativeChatCompactionBoundary -} from './native-chat-context-usage' +import { deriveNativeChatContextUsage } from './native-chat-context-usage' import type { AgentSessionTokenUsage } from '../agent-session-context-usage' import type { NativeChatMessage } from '../native-chat-types' @@ -91,15 +88,3 @@ describe('deriveNativeChatContextUsage', () => { expect(deriveNativeChatContextUsage([assistant('zero', usage(0))], noWindow)).toBeNull() }) }) - -describe('isNativeChatCompactionBoundary', () => { - it('matches only the compaction presentation', () => { - expect(isNativeChatCompactionBoundary(compaction)).toBe(true) - expect( - isNativeChatCompactionBoundary({ - ...compaction, - blocks: [{ type: 'text', text: 'Context compacted' }] - }) - ).toBe(false) - }) -}) diff --git a/src/shared/native-chat/native-chat-upgrade-tip-audience.test.ts b/src/shared/native-chat/native-chat-upgrade-tip-audience.test.ts deleted file mode 100644 index f289000d1ff..00000000000 --- a/src/shared/native-chat/native-chat-upgrade-tip-audience.test.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - isInNativeChatUpgradeTipAudience, - nativeChatUpgradeTipVariant -} from './native-chat-upgrade-tip-audience' - -describe('nativeChatUpgradeTipVariant', () => { - it.each([ - ['eligible', 'chat-ui-on', 'standard'], - ['eligible', 'chat-ui-on-terminal-default', 'keep-terminal'], - ['excluded', 'chat-ui-on-terminal-default', 'none'], - ['excluded', 'chat-ui-off', 'none'], - ['excluded', 'new-profile', 'none'] - ] as const)('gives %s/%s the %s tip', (membership, basis, variant) => { - expect(nativeChatUpgradeTipVariant({ version: 1, membership, basis })).toBe(variant) - }) - - it('shows no tip without a readable record', () => { - expect(nativeChatUpgradeTipVariant(null)).toBe('none') - }) -}) - -describe('isInNativeChatUpgradeTipAudience', () => { - it.each([ - [null, null], - ['none', false], - ['standard', true], - ['keep-terminal', true] - ] as const)('reads variant %s as %s', (variant, inAudience) => { - expect(isInNativeChatUpgradeTipAudience(variant)).toBe(inAudience) - }) -}) diff --git a/src/shared/native-chat/native-chat-visual-shell.test.ts b/src/shared/native-chat/native-chat-visual-shell.test.ts index 6bcee2ba6b2..f7b21056032 100644 --- a/src/shared/native-chat/native-chat-visual-shell.test.ts +++ b/src/shared/native-chat/native-chat-visual-shell.test.ts @@ -2,19 +2,14 @@ import { describe, expect, it } from 'vitest' import { NATIVE_CHAT_VISUAL_CSP, NATIVE_CHAT_VISUAL_HOST_CSP, - NATIVE_CHAT_VISUAL_MAX_HEIGHT, - NATIVE_CHAT_VISUAL_MIN_HEIGHT, NATIVE_CHAT_VISUAL_OPEN_LINK_TYPE, NATIVE_CHAT_VISUAL_PING_TYPE, NATIVE_CHAT_VISUAL_PONG_TYPE, NATIVE_CHAT_VISUAL_READER_SCROLL_TYPE, NATIVE_CHAT_VISUAL_SIZE_TYPE, - NATIVE_CHAT_VISUAL_THEME_TYPE, buildNativeChatVisualDocument, - clampNativeChatVisualHeight, nativeChatVisualPingMessage, nativeChatVisualThemeCss, - nativeChatVisualThemeMessage, readNativeChatVisualFrameMessage, readNativeChatVisualPong } from './native-chat-visual-shell' @@ -89,12 +84,6 @@ describe('buildNativeChatVisualDocument', () => { expect(document.endsWith(html)).toBe(true) }) - it('paints the theme before the visual and carries the channel in the bootstrap', () => { - expect(document).toContain('') - expect(document).toContain('--background:oklch(0.2 0 0)') - expect(document).toContain('"channel":"abc123"') - }) - it('resolves in-page links against the visual itself, ahead of the policy that bars any other base', () => { const baseAt = document.indexOf('') expect(baseAt).toBeGreaterThan(0) @@ -121,14 +110,6 @@ describe('nativeChatVisualThemeCss', () => { expect(css).not.toContain('--Upper') expect(css.startsWith(':root{color-scheme:light')).toBe(true) }) - - it('builds the live theme message on the same channel', () => { - expect(nativeChatVisualThemeMessage(theme, 'abc')).toMatchObject({ - type: NATIVE_CHAT_VISUAL_THEME_TYPE, - channel: 'abc', - colorScheme: 'dark' - }) - }) }) describe('readNativeChatVisualFrameMessage', () => { @@ -229,11 +210,3 @@ describe('readNativeChatVisualPong', () => { expect(readNativeChatVisualPong(data, 'c')).toBeNull() }) }) - -describe('clampNativeChatVisualHeight', () => { - it('keeps heights in range', () => { - expect(clampNativeChatVisualHeight(1)).toBe(NATIVE_CHAT_VISUAL_MIN_HEIGHT) - expect(clampNativeChatVisualHeight(99_999)).toBe(NATIVE_CHAT_VISUAL_MAX_HEIGHT) - expect(clampNativeChatVisualHeight(300.4)).toBe(300) - }) -})