diff --git a/config/scripts/ci/sharding/ci-shard-timings.json b/config/scripts/ci/sharding/ci-shard-timings.json index 4f987b231d8..9ee44607b1a 100644 --- a/config/scripts/ci/sharding/ci-shard-timings.json +++ b/config/scripts/ci/sharding/ci-shard-timings.json @@ -309,9 +309,7 @@ "src/cli/command-suggestion-budget.test.ts": 132, "src/cli/command-suggestion-destructive-families.test.ts": 226, "src/cli/command-suggestion.test.ts": 68, - "src/cli/computer-format.test.ts": 135, "src/cli/computer-tree-query.test.ts": 79, - "src/cli/emulator-logcat-format.test.ts": 69, "src/cli/format-recovery.test.ts": 413, "src/cli/format.test.ts": 446, "src/cli/handler-group-manifest.test.ts": 3610, @@ -446,7 +444,6 @@ "src/cli/specs/account.test.ts": 95, "src/cli/specs/cli-command-names-parity.test.ts": 205, "src/cli/specs/profile-state.test.ts": 102, - "src/cli/terminal-format.test.ts": 84, "src/cli/terminal-read-screen.test.ts": 660, "src/cli/worktree-ps-program-status.test.ts": 65, "src/cli/worktree-ps-terminal-verdict.test.ts": 60, diff --git a/mobile/src/files/mobile-file-preview-navigation.test.ts b/mobile/src/files/mobile-file-preview-navigation.test.ts deleted file mode 100644 index ccb5a23dab1..00000000000 --- a/mobile/src/files/mobile-file-preview-navigation.test.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' -import { navigateToMobileFilePreview } from './mobile-file-preview-navigation' - -describe('mobile-file-preview-navigation', () => { - it('pushes the file route before closing the embedded explorer on scheduler delivery', () => { - const events: string[] = [] - const push = vi.fn(() => events.push('push')) - const scheduleClose = vi.fn((_callback: () => void, _delay: number) => { - events.push('schedule') - }) - const params = { - hostId: 'host-1', - worktreeId: 'wt-1', - relativePath: 'assets/a #b?c%25 d\\logo.png', - name: 'logo.png', - worktreeName: 'Orca' - } - - navigateToMobileFilePreview({ push }, params, { - embedded: true, - scheduleClose, - onRequestClose: () => events.push('close') - }) - - expect(push).toHaveBeenCalledExactlyOnceWith({ - pathname: '/h/[hostId]/files/preview/[worktreeId]', - params - }) - expect(events).toEqual(['push', 'schedule']) - expect(scheduleClose).toHaveBeenCalledWith(expect.any(Function), 0) - scheduleClose.mock.calls[0]?.[0]() - expect(events).toEqual(['push', 'schedule', 'close']) - }) -}) diff --git a/mobile/src/files/mobile-file-preview-source.test.ts b/mobile/src/files/mobile-file-preview-source.test.ts deleted file mode 100644 index cf11c580715..00000000000 --- a/mobile/src/files/mobile-file-preview-source.test.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { previewSourceFromRoute, sourceKeyForPreview } from './mobile-file-preview-source' - -describe('mobile-file-preview-source', () => { - it('uses structured preview keys so colons in paths cannot collide', () => { - const first = sourceKeyForPreview({ - source: 'terminalArtifact', - worktreeId: 'wt:1', - absolutePath: '/tmp/a', - grantId: 'grant-1', - terminalHandle: 'b:c' - }) - const second = sourceKeyForPreview({ - source: 'terminalArtifact', - worktreeId: 'wt', - absolutePath: '1:/tmp/a:b', - grantId: 'grant-2', - terminalHandle: 'c' - }) - - expect(first).not.toBe(second) - }) - - it('makes native-chat artifact previews read-only', () => { - expect( - previewSourceFromRoute({ - hostId: 'host-1', - worktreeId: 'wt-1', - source: 'terminalArtifact', - absolutePath: '/tmp/result.html', - grantId: 'grant-1', - nativeChatTab: 'tab-1', - nativeChatSession: 'session-1' - }) - ).toMatchObject({ - nativeChatContext: { tabId: 'tab-1', sessionId: 'session-1' }, - readOnly: true - }) - }) -}) diff --git a/mobile/src/files/mobile-file-preview-syntax.test.ts b/mobile/src/files/mobile-file-preview-syntax.test.ts deleted file mode 100644 index d8241899afc..00000000000 --- a/mobile/src/files/mobile-file-preview-syntax.test.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { buildMobileFilePreviewSyntax } from './mobile-file-preview-syntax' - -describe('mobile-file-preview-syntax', () => { - it('returns syntax segments for supported source paths', () => { - const syntax = buildMobileFilePreviewSyntax('src/app.ts', 'const answer = 42') - - expect(syntax.language).toBe('typescript') - expect(syntax.segments).toContainEqual({ kind: 'keyword', text: 'const' }) - expect(syntax.segments.map((segment) => segment.text).join('')).toBe('const answer = 42') - }) - - it('falls back to a plain segment when highlighting is unavailable', () => { - expect(buildMobileFilePreviewSyntax('README.unknown', 'plain text')).toEqual({ - language: 'plaintext', - segments: [{ kind: 'plain', text: 'plain text' }] - }) - }) -}) diff --git a/mobile/src/home/home-host-connection-projection.test.ts b/mobile/src/home/home-host-connection-projection.test.ts deleted file mode 100644 index baf613ac4f5..00000000000 --- a/mobile/src/home/home-host-connection-projection.test.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - projectHomeHostConnections, - type HomeHostConnectionProjectionEntry -} from './home-host-connection-projection' - -function entry( - hostId: string, - overrides: Partial = {} -): HomeHostConnectionProjectionEntry { - return { - hostId, - path: 'lan', - pendingPath: null, - pairingRejected: false, - relayHostReachability: 'connecting', - ...overrides - } -} - -describe('projectHomeHostConnections', () => { - it('keys connection entries by host without losing their recovery state', () => { - const offline = entry('desk', { - pendingPath: 'tailscale', - pairingRejected: true, - relayHostReachability: 'signed-out' - }) - const connected = entry('laptop', { path: 'relay' }) - const projection = projectHomeHostConnections([offline, connected]) - - expect(projection['desk']).toBe(offline) - expect(projection['laptop']).toBe(connected) - }) - - it('keeps a host named __proto__ as an own key', () => { - const projection = projectHomeHostConnections([entry('__proto__', { path: 'relay' })]) - - expect(Object.hasOwn(projection, '__proto__')).toBe(true) - expect(projection['__proto__']?.path).toBe('relay') - expect(Object.getPrototypeOf(projection)).toBe(Object.prototype) - }) -}) diff --git a/mobile/src/host-screen/phone-card-property-choices.test.ts b/mobile/src/host-screen/phone-card-property-choices.test.ts deleted file mode 100644 index 7eb042c3823..00000000000 --- a/mobile/src/host-screen/phone-card-property-choices.test.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - WORKSPACE_CARD_DISPLAY_CHOICES, - WORKSPACE_CARD_PROPERTY_CHOICES -} from '../../../src/shared/workspace-view/workspace-view-options' -import type { WorktreeCardProperty } from '../../../src/shared/ui-chrome-types' -import { - phoneCardPropertyChoices, - withoutPhoneHiddenProperties -} from './phone-card-property-choices' - -const ids = (choices: readonly { id: string }[]) => choices.map((choice) => choice.id) - -describe('the card properties the phone offers', () => { - it('hides Ports and keeps Orca CLI', () => { - expect(ids(phoneCardPropertyChoices(WORKSPACE_CARD_PROPERTY_CHOICES))).not.toContain('ports') - const display = ids(phoneCardPropertyChoices(WORKSPACE_CARD_DISPLAY_CHOICES)) - expect(display).not.toContain('ports') - expect(display).toContain('cli') - }) - - it('drops Ports from what it counts without touching the shared value', () => { - const shared: readonly WorktreeCardProperty[] = Object.freeze(['issue', 'ports', 'cli']) - expect(withoutPhoneHiddenProperties(shared)).toEqual(['issue', 'cli']) - expect(shared).toEqual(['issue', 'ports', 'cli']) - }) -}) diff --git a/mobile/src/mobile-web-shell/mobile-web-shell-dev-facts.test.ts b/mobile/src/mobile-web-shell/mobile-web-shell-dev-facts.test.ts deleted file mode 100644 index e2e543f4ee9..00000000000 --- a/mobile/src/mobile-web-shell/mobile-web-shell-dev-facts.test.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { formatMobileWebShellDevFacts } from './mobile-web-shell-dev-facts' - -const READY = { buildId: '0123456789abcdef', totalBytes: 2_097_152, elapsedMs: 412 } -const PREFIX = '0123456789ab' - -describe('the shell dev facts line', () => { - it('shows the build prefix, the bytes and the time, and never the whole build id', () => { - const line = formatMobileWebShellDevFacts({ ...READY, droppedBinaryFrames: 0 }) - expect(line).toBe(`${PREFIX} · 2097152 B · 412 ms`) - expect(line).not.toContain(READY.buildId) - }) - - it('carries the running dropped-frame count once the stream has shed one', () => { - expect(formatMobileWebShellDevFacts({ ...READY, droppedBinaryFrames: 1 })).toBe( - `${PREFIX} · 2097152 B · 412 ms · 1 frame dropped` - ) - expect(formatMobileWebShellDevFacts({ ...READY, droppedBinaryFrames: 37 })).toBe( - `${PREFIX} · 2097152 B · 412 ms · 37 frames dropped` - ) - }) -}) diff --git a/native/computer-use-linux/runtime_keyboard_test.py b/native/computer-use-linux/runtime_keyboard_test.py index f95b1199bdb..18f4c34ae13 100644 --- a/native/computer-use-linux/runtime_keyboard_test.py +++ b/native/computer-use-linux/runtime_keyboard_test.py @@ -10,22 +10,12 @@ import unittest from pathlib import Path -class FakeKeySynthType: - PRESSRELEASE = "pressrelease" - SYM = "sym" - STRING = "string" - - -KEYSYMS = {"Return": 0xFF0D, "Tab": 0xFF09, "Escape": 0xFF1B, "Left": 0xFF51, "Down": 0xFF54} - - def load_runtime(): gi = types.ModuleType("gi") repository = types.ModuleType("gi.repository") gi.require_version = lambda *_: None - repository.Atspi = types.SimpleNamespace(KeySynthType=FakeKeySynthType, generate_keyboard_event=None, - set_timeout=lambda *_: None) - repository.Gdk = types.SimpleNamespace(keyval_from_name=KEYSYMS.__getitem__) + repository.Atspi = types.SimpleNamespace(set_timeout=lambda *_: None) + repository.Gdk = types.SimpleNamespace() repository.GdkPixbuf = types.SimpleNamespace() gi.repository = repository sys.modules["gi"] = gi diff --git a/src/cli/computer-format.test.ts b/src/cli/computer-format.test.ts deleted file mode 100644 index 5abab39b94d..00000000000 --- a/src/cli/computer-format.test.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' -import { prepareComputerCliJsonResult } from './computer-format' -import { printResult } from './format' - -describe('prepareComputerCliJsonResult', () => { - it.each([ - 'Physical size: 1440x3200\n', - '33', - 'screenshotStatus', - '', - 42, - -1, - 0, - true, - false, - null - ])('preserves successful primitive JSON output for %j', (result) => { - const response = { - id: 'req-primitive', - ok: true as const, - result, - _meta: { runtimeId: 'runtime-1' } - } - const formatter = vi.fn(() => 'unused') - const logSpy = vi.spyOn(console, 'log').mockImplementation(() => undefined) - - try { - expect(prepareComputerCliJsonResult(response)).toBe(response) - printResult(response, true, formatter) - expect(logSpy).toHaveBeenCalledOnce() - expect(logSpy).toHaveBeenCalledWith(JSON.stringify(response, null, 2)) - expect(formatter).not.toHaveBeenCalled() - } finally { - logSpy.mockRestore() - } - }) - - it.each([ - { result: {} }, - { result: [] }, - { result: { screenshotStatus: {} } }, - { result: { screenshot: { data: 'cG5n', format: 'png' } } } - ])('preserves object results without a computer screenshot: %j', ({ result }) => { - const response = { - id: 'req-object', - ok: true as const, - result, - _meta: { runtimeId: 'runtime-1' } - } - - expect(prepareComputerCliJsonResult(response)).toBe(response) - }) -}) diff --git a/src/cli/emulator-logcat-format.test.ts b/src/cli/emulator-logcat-format.test.ts deleted file mode 100644 index 5dfbab2cace..00000000000 --- a/src/cli/emulator-logcat-format.test.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { formatLogcat } from './emulator-logcat-format' - -describe('formatLogcat', () => { - it('ignores malformed rows instead of throwing', () => { - expect( - formatLogcat([ - null, - 42, - { - timestamp: '10-01 12:00:00.000', - level: 'I', - tag: 'Main', - message: 'ready' - } - ]) - ).toBe('10-01 12:00:00.000 I Main: ready') - }) -}) diff --git a/src/cli/format.test.ts b/src/cli/format.test.ts index 7fba85f8000..1da2db9980e 100644 --- a/src/cli/format.test.ts +++ b/src/cli/format.test.ts @@ -51,32 +51,4 @@ describe('printResult computer screenshots', () => { expect(output.result.screenshot.path).toBeUndefined() expect(output.result.screenshot.dataOmitted).toBeUndefined() }) - - it('does not rewrite non-computer nested screenshot JSON payloads', () => { - const logSpy = vi.spyOn(console, 'log').mockImplementation(() => undefined) - const screenshotData = Buffer.from('png-data').toString('base64') - - printResult( - { - id: 'req-browser-like', - ok: true, - result: { - screenshot: { - data: screenshotData, - format: 'png' - } - }, - _meta: { runtimeId: 'runtime-1' } - }, - true, - () => 'unused' - ) - - const output = JSON.parse(logSpy.mock.calls[0][0]) as { - result: { screenshot: { data: string; path?: string; dataOmitted?: boolean } } - } - expect(output.result.screenshot.data).toBe(screenshotData) - expect(output.result.screenshot.path).toBeUndefined() - expect(output.result.screenshot.dataOmitted).toBeUndefined() - }) }) diff --git a/src/cli/terminal-format.test.ts b/src/cli/terminal-format.test.ts deleted file mode 100644 index 535e3b4059d..00000000000 --- a/src/cli/terminal-format.test.ts +++ /dev/null @@ -1,259 +0,0 @@ -import { describe, expect, it } from 'vitest' -import type { - RuntimeTerminalShow, - RuntimeTerminalWait, - RuntimeTerminalWaitBlockedReason -} from '../shared/runtime-terminal-contracts' -import { - formatTerminalClose, - formatTerminalFocus, - formatTerminalRead, - formatTerminalSend, - formatTerminalShow, - formatTerminalWait -} from './terminal-format' - -describe('formatTerminalFocus', () => { - it('distinguishes superseded navigation from a winning focus', () => { - expect( - formatTerminalFocus({ - focus: { - handle: 'term_stale', - tabId: 'tab-stale', - worktreeId: 'worktree-1', - navigated: false - } - }) - ).toBe( - 'Focus request for terminal term_stale was superseded or host navigation was skipped (tab tab-stale).' - ) - expect( - formatTerminalFocus({ - focus: { handle: 'term_winner', tabId: 'tab-winner', worktreeId: 'worktree-1' } - }) - ).toBe('Focused terminal term_winner (tab tab-winner).') - }) -}) - -describe('formatTerminalClose', () => { - it('prints "PTY killed." only for a confirmed kill', () => { - expect( - formatTerminalClose({ close: { handle: 'term_local', tabId: 'tab-1', ptyKilled: true } }) - ).toBe('Closed terminal term_local. PTY killed.') - }) - - it('says the remote process was not confirmed stopped instead of claiming a kill', () => { - expect( - formatTerminalClose({ - close: { - handle: 'term_remote', - tabId: 'tab-1', - ptyKilled: false, - ptyStopVerdict: 'unverifiable', - ptyStopReason: 'its SSH provider is no longer registered' - } - }) - ).toBe( - 'Closed terminal term_remote. The PTY was not confirmed stopped: its SSH provider is no longer registered.' - ) - }) - - it('promises the reconnect replay only when the host recorded the kill for it', () => { - const close = { - handle: 'term_remote', - tabId: 'tab-1', - ptyKilled: false, - ptyStopVerdict: 'unverifiable' as const, - ptyStopReason: 'SSH connection lost, reconnecting...' - } - expect(formatTerminalClose({ close: { ...close, pendingKillRecorded: true } })).toBe( - 'Closed terminal term_remote. The PTY was not confirmed stopped: SSH connection lost, reconnecting... The kill retries when the host reconnects.' - ) - expect(formatTerminalClose({ close })).toBe( - 'Closed terminal term_remote. The PTY was not confirmed stopped: SSH connection lost, reconnecting...' - ) - }) - - it('names a PTY known to be live', () => { - expect( - formatTerminalClose({ - close: { - handle: 'term_live', - tabId: 'tab-1', - ptyKilled: false, - ptyStopVerdict: 'live' - } - }) - ).toBe('Closed terminal term_live. The PTY is live.') - }) -}) - -describe('formatTerminalSend', () => { - it.each([ - { - observation: 'permission' as const, - warning: 'Resolve the permission prompt in the terminal', - nextStep: '--retry-request prompt-unhealthy' - }, - { - observation: 'incarnation_replaced' as const, - warning: 'the terminal process was replaced', - nextStep: 'Inspect the current terminal before sending a new prompt' - } - ])('warns and gives a next step for $observation', ({ observation, warning, nextStep }) => { - const output = formatTerminalSend({ - send: { - handle: 'term_worker', - accepted: true, - bytesWritten: 8, - prompt: { - requestId: 'prompt-unhealthy', - stages: ['input_accepted'], - provider: 'codex', - observation, - processIncarnation: 'inc-1', - generation: 1, - baselineWorkingSequence: 0 - } - } - }) - - expect(output).toContain(`provider: codex`) - expect(output).toContain(`delivery observation: ${observation}`) - expect(output).toContain(`warning: delivery was not observed`) - expect(output).toContain(warning) - expect(output).toContain(nextStep) - }) - - it.each([ - { provider: 'claude' as const, expected: 'no turn start was observed' }, - { provider: 'unsupported' as const, expected: 'this provider cannot report delivery' }, - { provider: 'old-host' as const, expected: 'predates durable prompt receipts' } - ])('warns per provider when delivery was not observed ($provider)', ({ provider, expected }) => { - const output = formatTerminalSend({ - send: { - handle: 'term_worker', - accepted: true, - bytesWritten: 8, - prompt: { - requestId: 'prompt-unobserved', - stages: ['input_accepted'], - provider, - observation: 'unsupported', - processIncarnation: 'inc-1', - generation: 1, - baselineWorkingSequence: 0 - } - } - }) - - expect(output).toContain(expected) - }) - - it('names the next command when a supported send never reached turn_started', () => { - const output = formatTerminalSend({ - send: { - handle: 'term_worker', - accepted: true, - bytesWritten: 8, - prompt: { - requestId: 'prompt-swallowed', - stages: ['input_accepted'], - provider: 'claude', - observation: 'supported', - processIncarnation: 'inc-1', - generation: 1, - baselineWorkingSequence: 0 - } - } - }) - - expect(output).toContain('no turn start was observed') - expect(output).toContain('--retry-request prompt-swallowed --wait-submit ') - }) -}) - -function showResult(reason?: RuntimeTerminalWaitBlockedReason): { - terminal: RuntimeTerminalShow -} { - return { - terminal: { - handle: 'term_agy', - ptyId: 'pty-1', - paneRuntimeId: 1, - rendererGraphEpoch: 1, - worktreeId: 'worktree-1', - worktreePath: '/tmp/w', - branch: 'main', - tabId: 'tab-1', - leafId: 'leaf-1', - title: 'Antigravity', - connected: true, - writable: true, - lastOutputAt: null, - preview: 'Do you trust the files in this folder?', - agentWait: { source: 'prompt-text', reason } - } - } -} - -// Older hosts can mislabel other providers' dialogs with codex-* tokens; include the neutral names. -describe('blocked-reason rendering against a mixed-version host', () => { - function waitResult(blockedReason: RuntimeTerminalWaitBlockedReason): { - wait: RuntimeTerminalWait - } { - return { - wait: { - handle: 'term_agy', - condition: 'tui-idle', - satisfied: false, - status: 'running', - exitCode: null, - blockedReason - } - } - } - - // Pair alias additions with unchanged tokens so missing alias logic cannot pass on absence alone. - it.each([ - ['codex-trust-workspace', 'codex-trust-workspace (agent-trust-workspace)'], - ['codex-update-prompt', 'codex-update-prompt (agent-update-prompt)'], - ['codex-cwd-prompt', 'codex-cwd-prompt (agent-cwd-prompt)'], - ['codex-hooks-review-prompt', 'codex-hooks-review-prompt (agent-hooks-review-prompt)'], - ['codex-interactive-prompt', 'codex-interactive-prompt (agent-interactive-prompt)'], - ['agent-trust-workspace', 'agent-trust-workspace'], - ['codex-model-migration-prompt', 'codex-model-migration-prompt'] - ] as const)('renders %s as %s on both wait and show', (reason, rendered) => { - expect(formatTerminalWait(waitResult(reason)).split('\n').at(-1)).toBe( - `blockedReason: ${rendered}` - ) - expect(formatTerminalShow(showResult(reason))).toContain( - `agentWait: ${rendered} (via prompt-text)` - ) - }) - - it('still describes a wait with no reason at all', () => { - expect(formatTerminalShow(showResult(undefined))).toContain( - 'agentWait: interactive prompt (via prompt-text)' - ) - }) -}) - -describe('formatTerminalRead draft separation', () => { - it('labels composer drafts outside terminal output', () => { - const output = formatTerminalRead({ - terminal: { - handle: 'term_1', - status: 'running', - tail: ['Build passed', '❯'], - truncated: false, - nextCursor: null, - source: 'screen', - draft: 'proceed with the release' - } - }) - - expect(output).toContain('draft: "proceed with the release"') - expect(output).toContain('\n\nBuild passed\n❯') - }) -}) diff --git a/src/main/window/clipboard-plain-text-read.test.ts b/src/main/window/clipboard-plain-text-read.test.ts index 430b960d48b..fb39a103a0a 100644 --- a/src/main/window/clipboard-plain-text-read.test.ts +++ b/src/main/window/clipboard-plain-text-read.test.ts @@ -21,22 +21,6 @@ function clipboardWith({ } describe('readClipboardPlainText', () => { - it('prefers standard text without inspecting other pasteboard types', () => { - const clipboard = clipboardWith({ - text: 'standard', - buffers: { 'public.plain-text': Buffer.from('other') } - }) - expect(readClipboardPlainText(clipboard, 'darwin')).toBe('standard') - expect(clipboard.readBuffer).not.toHaveBeenCalled() - }) - - it.each([ - ['public.plain-text', { 'public.plain-text': Buffer.from(URL_TEXT) }], - ['public.url', { 'public.url': Buffer.from(URL_TEXT) }] - ])('reads a Universal Clipboard URL from %s on macOS', (_type, buffers) => { - expect(readClipboardPlainText(clipboardWith({ buffers }), 'darwin')).toBe(URL_TEXT) - }) - it('skips an undecodable plain-text type and uses the URL', () => { const buffers = { 'public.plain-text': Buffer.from(URL_TEXT, 'utf16le'), @@ -62,10 +46,4 @@ describe('readClipboardPlainText', () => { }) expect(readClipboardPlainText(clipboard, 'darwin')).toBe('') }) - - it.each(['linux', 'win32'] as const)('does not read macOS pasteboard types on %s', (platform) => { - const clipboard = clipboardWith({ buffers: { 'public.url': Buffer.from(URL_TEXT) } }) - expect(readClipboardPlainText(clipboard, platform)).toBe('') - expect(clipboard.readBuffer).not.toHaveBeenCalled() - }) })