diff --git a/config/flaky-test-pattern-baseline.txt b/config/flaky-test-pattern-baseline.txt index c4313787f22..7e82d9e469b 100644 --- a/config/flaky-test-pattern-baseline.txt +++ b/config/flaky-test-pattern-baseline.txt @@ -933,7 +933,6 @@ 6 test-no-wall-clock:src/main/runtime/orchestration/worker-output-archive.test.ts 1 test-no-wall-clock:src/main/runtime/owned-session-teardown-policy.test.ts 2 test-no-wall-clock:src/main/runtime/project-removal-structured-sessions.test.ts -1 test-no-wall-clock:src/main/runtime/proven-absent-leaf-pty-verdicts.test.ts 2 test-no-wall-clock:src/main/runtime/pty-shell-ownership-mirror.test.ts 1 test-no-wall-clock:src/main/runtime/push/push-device-registration-persistence.test.ts 1 test-no-wall-clock:src/main/runtime/push/push-registration-rpc.test.ts diff --git a/config/reliability-gates.jsonc b/config/reliability-gates.jsonc index 74fdd7338b0..c82f86c3cf5 100644 --- a/config/reliability-gates.jsonc +++ b/config/reliability-gates.jsonc @@ -13603,7 +13603,7 @@ "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/startup/ssh-startup-reconnect.test.ts src/renderer/src/lib/resolved-worktree-execution-host.test.ts src/renderer/src/components/terminal/background-terminal-worktree-mount.test.ts src/renderer/src/runtime/sync-runtime-graph-scheduling.test.ts src/renderer/src/components/terminal-pane/use-terminal-pane-lifecycle.test.ts src/renderer/src/components/terminal-pane/pty-connection-spawn-and-startup.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-host-surface-replacement.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-stream-reconnect.test.ts src/renderer/src/runtime/remote-runtime-session-tabs-inflight.test.ts src/renderer/src/runtime/web-session-terminal-handle-events.test.ts src/renderer/src/store/slices/terminal-pty-identity-replacement.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/pty-transport-reattach-admission.test.ts src/renderer/src/components/terminal-pane/pty-transport-detach-attach-handoff.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/terminal-error-accumulation.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-attach-subscription.test.ts --reporter=dot", - "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-attach-subscription.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-host-surface-replacement.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-stream-reconnect.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-expired-pane-recovery.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-create-outcome-recovery.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-create-handoff.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-state.test.ts src/renderer/src/components/terminal-pane/TerminalRemoteRuntimeReconnectBanner.test.tsx src/renderer/src/components/terminal-pane/terminal-remote-runtime-recovery-ui-state.test.ts src/shared/remote-runtime-socket-liveness.test.ts src/shared/remote-runtime/control/remote-runtime-shared-control-connection.test.ts src/shared/remote-runtime/control/remote-runtime-shared-control-socket-generation.test.ts src/shared/remote-runtime/remote-runtime-client-error-classification.test.ts src/main/runtime/rpc/remote-runtime-server-heartbeat.test.ts src/main/runtime/rpc/methods/terminal-create-idempotency.test.ts src/main/runtime/orca-runtime-terminal-create-idempotency.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-attach-subscription.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-host-surface-replacement.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-stream-reconnect.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-expired-pane-recovery.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-create-outcome-recovery.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-create-handoff.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-state.test.ts src/renderer/src/components/terminal-pane/TerminalRemoteRuntimeReconnectBanner.test.tsx src/shared/remote-runtime-socket-liveness.test.ts src/shared/remote-runtime/control/remote-runtime-shared-control-connection.test.ts src/shared/remote-runtime/control/remote-runtime-shared-control-socket-generation.test.ts src/shared/remote-runtime/remote-runtime-client-error-classification.test.ts src/main/runtime/rpc/remote-runtime-server-heartbeat.test.ts src/main/runtime/rpc/methods/terminal-create-idempotency.test.ts src/main/runtime/orca-runtime-terminal-create-idempotency.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/hooks/ipc-events/direct-ssh-connect-reply-routing.test.ts src/renderer/src/store/slices/terminals-hydration.test.ts src/renderer/src/store/slices/repos-ssh-host-reconciliation.test.ts src/renderer/src/hooks/direct-ssh-state-routing.test.ts src/renderer/src/components/terminal-pane/pty-connection-spawn-and-startup.test.ts src/renderer/src/components/terminal-pane/terminal-pane-tab-detach.test.ts --reporter=dot", "pnpm exec vitest run --config config/vitest.config.ts src/main/ipc/ssh/ssh.test.ts src/main/ipc/worktrees-ssh-repo-owner-resolution.test.ts src/main/ipc/worktrees-lineage-hydration.test.ts src/main/runtime/public-ssh-state.test.ts src/main/ssh/connection/ssh-connection-manager.test.ts src/main/ssh/connection/ssh-connection.test.ts src/main/ssh/ssh-provider-authority.test.ts src/preload/ssh-authority-forwarding.test.ts src/renderer/src/runtime/runtime-client-events.test.ts src/renderer/src/runtime/runtime-environment-ssh-state.test.ts src/shared/ssh-retained-payload-admission.test.ts --reporter=dot", "pnpm exec electron-vite build --mode e2e", @@ -13631,7 +13631,6 @@ "src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-create-handoff.test.ts", "src/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-state.test.ts", "src/renderer/src/components/terminal-pane/TerminalRemoteRuntimeReconnectBanner.test.tsx", - "src/renderer/src/components/terminal-pane/terminal-remote-runtime-recovery-ui-state.test.ts", "src/renderer/src/runtime/remote-runtime-session-tabs-inflight.test.ts", "src/renderer/src/runtime/web-session-terminal-handle-events.test.ts", "src/renderer/src/store/slices/terminal-pty-identity-replacement.test.ts", @@ -13753,12 +13752,6 @@ "the disconnected state exposes one explicit Reconnect action" ] }, - { - "file": "src/renderer/src/components/terminal-pane/terminal-remote-runtime-recovery-ui-state.test.ts", - "assertions": [ - "only actionable recovery phases retain UI state and pane closure removes disconnected state" - ] - }, { "file": "src/shared/remote-runtime-socket-liveness.test.ts", "assertions": [ @@ -13960,6 +13953,7 @@ "runner": "local", "platform": "macos", "command": "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-attach-subscription.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-host-surface-replacement.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-stream-reconnect.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-expired-pane-recovery.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-create-outcome-recovery.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-create-handoff.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-state.test.ts src/renderer/src/components/terminal-pane/TerminalRemoteRuntimeReconnectBanner.test.tsx src/renderer/src/components/terminal-pane/terminal-remote-runtime-recovery-ui-state.test.ts src/shared/remote-runtime-socket-liveness.test.ts src/shared/remote-runtime/control/remote-runtime-shared-control-connection.test.ts src/shared/remote-runtime/control/remote-runtime-shared-control-socket-generation.test.ts src/shared/remote-runtime/remote-runtime-client-error-classification.test.ts src/main/runtime/rpc/remote-runtime-server-heartbeat.test.ts src/main/runtime/rpc/methods/terminal-create-idempotency.test.ts src/main/runtime/orca-runtime-terminal-create-idempotency.test.ts", + "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-attach-subscription.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-host-surface-replacement.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-stream-reconnect.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-expired-pane-recovery.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-create-outcome-recovery.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-create-handoff.test.ts src/renderer/src/components/terminal-pane/remote-runtime-pty-recovery-state.test.ts src/renderer/src/components/terminal-pane/TerminalRemoteRuntimeReconnectBanner.test.tsx src/shared/remote-runtime-socket-liveness.test.ts src/shared/remote-runtime/control/remote-runtime-shared-control-connection.test.ts src/shared/remote-runtime/control/remote-runtime-shared-control-socket-generation.test.ts src/shared/remote-runtime/remote-runtime-client-error-classification.test.ts src/main/runtime/rpc/remote-runtime-server-heartbeat.test.ts src/main/runtime/rpc/methods/terminal-create-idempotency.test.ts src/main/runtime/orca-runtime-terminal-create-idempotency.test.ts", "result": "passed", "durationSeconds": 5, "summary": "Eleven fault-injection and recovery-UI files and 127 tests passed, covering suspended heartbeat clocks, stale socket, PTY, and create generations, canonical pre-ready close recovery with one replacement subscription, cold and repeated PTY reattachment, authoritative health, bounded PTY and terminal-create recovery, post-probe timeout clipping, manually retryable create cutoff, accurate capability-probe failures, same-PTY manual reconnect, pane-state cleanup, fatal error deduplication, stable create identity, cross-process PTY adoption, and fail-closed legacy inventory." diff --git a/config/scripts/vitest-node-runtime-files.mjs b/config/scripts/vitest-node-runtime-files.mjs index ca53ed783dc..5848954f2b5 100644 --- a/config/scripts/vitest-node-runtime-files.mjs +++ b/config/scripts/vitest-node-runtime-files.mjs @@ -127,7 +127,6 @@ const NODE_RUNTIME_INCLUDE = [ 'src/main/foreign-sqlite-readers/**/*.test.ts', 'src/main/browser/*cookie*.test.ts', 'src/main/browser/cookies/*cookie*.test.ts', - 'src/main/browser/cookies/sources/browser-cookie-validation.test.ts', 'src/main/browser/cookies/sources/browser-cookie-decryption.test.ts', 'src/main/browser/cookies/sources/browser-cookie-import-undecryptable.test.ts', 'src/main/browser/cookies/sources/browser-cookie-source-partition.test.ts', diff --git a/src/main/browser/cookies/sources/browser-cookie-validation.test.ts b/src/main/browser/cookies/sources/browser-cookie-validation.test.ts deleted file mode 100644 index 35358ab0d68..00000000000 --- a/src/main/browser/cookies/sources/browser-cookie-validation.test.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { databaseSameSite } from './browser-cookie-validation' - -describe('databaseSameSite', () => { - it.each([ - { raw: -1, expected: 'unspecified' }, - { raw: 0, expected: 'no_restriction' }, - { raw: 1, expected: 'lax' }, - { raw: 2, expected: 'strict' }, - { raw: 3, expected: 'unspecified' }, - // Firefox stores SAMESITE_UNSET as 256. - { raw: 256, expected: 'unspecified' }, - { raw: 99, expected: 'unspecified' }, - { raw: 1.5, expected: 'unspecified' } - ] as const)('decodes $raw as $expected', ({ raw, expected }) => { - expect(databaseSameSite(raw)).toBe(expected) - }) - - // Nullish and nonnumeric inputs must not become SameSite=None. - it.each([ - { label: 'null', raw: null }, - { label: 'undefined', raw: undefined }, - { label: 'NaN', raw: Number.NaN } - ])('decodes $label as unspecified', ({ raw }) => { - expect(databaseSameSite(raw as unknown as number)).toBe('unspecified') - }) -}) diff --git a/src/main/claude-accounts/keychain.test.ts b/src/main/claude-accounts/keychain.test.ts deleted file mode 100644 index 3bd725ba068..00000000000 --- a/src/main/claude-accounts/keychain.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { afterEach, expect, it, vi } from 'vitest' - -const reads = vi.hoisted(() => vi.fn(async () => null)) -vi.mock('../macos-keychain/generic-password', () => ({ readKeychainPassword: reads })) - -import { readActiveClaudeKeychainCredentialsStrict } from './keychain' - -const originalUser = process.env.USER -afterEach(() => { - process.env.USER = originalUser - reads.mockClear() -}) - -it('reads the claude-code-user item when $USER is not a valid Keychain account (#12857)', async () => { - process.env.USER = 'first@example.com' - await readActiveClaudeKeychainCredentialsStrict() - expect(reads).toHaveBeenCalledWith('Claude Code-credentials', 'claude-code-user') - process.env.USER = 'first.last' - await readActiveClaudeKeychainCredentialsStrict() - expect(reads).toHaveBeenLastCalledWith('Claude Code-credentials', 'first.last') -}) diff --git a/src/main/computer/desktop-script-provider-paths.test.ts b/src/main/computer/desktop-script-provider-paths.test.ts deleted file mode 100644 index 671f81a68e6..00000000000 --- a/src/main/computer/desktop-script-provider-paths.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type * as NodeFs from 'node:fs' -import { join } from 'node:path' -import { afterEach, describe, expect, it, vi } from 'vitest' - -const { existsSyncMock } = vi.hoisted(() => ({ existsSyncMock: vi.fn((_path: string) => false) })) - -vi.mock('node:fs', async (importOriginal) => ({ - ...(await importOriginal()), - existsSync: existsSyncMock -})) - -import { resolveDesktopScriptProviderPath } from './desktop-script-provider-paths' - -describe('resolveDesktopScriptProviderPath', () => { - afterEach(() => { - existsSyncMock.mockReset() - }) - - it('finds the runtime orcad ships beside its sidecar when there is no resourcesPath', () => { - const bundled = join(__dirname, 'computer-use-linux', 'runtime.py') - existsSyncMock.mockImplementation((path) => path === bundled) - - expect(resolveDesktopScriptProviderPath('linux')).toBe(bundled) - }) -}) diff --git a/src/main/crash-reporting/gpu-crash-fallback-field-sessions.test.ts b/src/main/crash-reporting/gpu-crash-fallback-field-sessions.test.ts deleted file mode 100644 index 54baa23f877..00000000000 --- a/src/main/crash-reporting/gpu-crash-fallback-field-sessions.test.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - DEFAULT_GPU_CRASH_FALLBACK_THRESHOLD, - DEFAULT_GPU_CRASH_FALLBACK_WINDOW_MS, - GpuCrashFallbackTracker -} from './gpu-crash-fallback-decision' - -function newTracker(): GpuCrashFallbackTracker { - return new GpuCrashFallbackTracker({ - windowMs: DEFAULT_GPU_CRASH_FALLBACK_WINDOW_MS, - threshold: DEFAULT_GPU_CRASH_FALLBACK_THRESHOLD - }) -} - -describe('1.4.190 win32 GPU-child crash cluster', () => { - it('engages on the session that did reach three crashes (field launch 51b9e93c)', () => { - // Field launch 51b9e93c emitted one crash with two coalesced repeats before engaging. - const tracker = newTracker() - expect(tracker.recordGpuCrash(3_600_000).shouldEngageFallback).toBe(false) - expect(tracker.recordGpuCrash(3_601_000).shouldEngageFallback).toBe(false) - expect(tracker.recordGpuCrash(3_601_890)).toEqual({ - shouldEngageFallback: true, - crashesInWindow: 3 - }) - }) -}) diff --git a/src/main/github/github-repository-identity.gh-account.test.ts b/src/main/github/github-repository-identity.gh-account.test.ts deleted file mode 100644 index 06f40e31e4a..00000000000 --- a/src/main/github/github-repository-identity.gh-account.test.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { ghRepoExecOptions, githubRepoContext } from './github-repository-identity' - -describe('ghRepoExecOptions ghAccount threading', () => { - it('keeps ghAccount when cwd is present for local repos', () => { - expect( - ghRepoExecOptions( - githubRepoContext('/repo', null, { - wslDistro: 'Ubuntu', - ghAccount: { host: 'github.com', user: 'Alice' } - }) - ) - ).toEqual({ - cwd: '/repo', - wslDistro: 'Ubuntu', - ghAccount: { host: 'github.com', user: 'Alice' } - }) - }) - - it('keeps ghAccount when SSH omits cwd', () => { - expect( - ghRepoExecOptions( - githubRepoContext('/remote/repo', 'ssh-1', { - ghAccount: { host: 'github.acme.com', user: 'Bob' } - }) - ) - ).toEqual({ - ghAccount: { host: 'github.acme.com', user: 'Bob' } - }) - }) -}) diff --git a/src/main/ipc/runtime-environments/runtime-environment-removal-cleanup.test.ts b/src/main/ipc/runtime-environments/runtime-environment-removal-cleanup.test.ts deleted file mode 100644 index fd022e96785..00000000000 --- a/src/main/ipc/runtime-environments/runtime-environment-removal-cleanup.test.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' - -vi.mock('../../browser/browser-route-partition-storage-runtime', () => ({ - clearBrowserRoutePartitionStorageForEnvironment: vi.fn() -})) -vi.mock('../../browser/browser-route-partition-storage-retirement', () => ({ - retireBrowserRoutePartitionStorageForEnvironment: vi.fn(async () => undefined) -})) - -const { retireRemovedRuntimeEnvironment } = await import('./runtime-environment-removal-cleanup') - -describe('retiring a removed runtime environment', () => { - it('forgets the server’s session partition and its layout snapshot', async () => { - const store = { - removeWorkspaceSessionHost: vi.fn(), - getRemoteLayoutSnapshot: vi.fn(), - setRemoteLayoutSnapshot: vi.fn() - } - await retireRemovedRuntimeEnvironment('env 1', vi.fn(), store) - expect(store.removeWorkspaceSessionHost).toHaveBeenCalledWith('runtime:env%201') - expect(store.setRemoteLayoutSnapshot).toHaveBeenCalledWith('env 1', null, 'now') - }) -}) diff --git a/src/main/lib/unread-response-body.test.ts b/src/main/lib/unread-response-body.test.ts index 5138de950b3..1744161d7f3 100644 --- a/src/main/lib/unread-response-body.test.ts +++ b/src/main/lib/unread-response-body.test.ts @@ -13,12 +13,6 @@ describe('cancelUnreadResponseBody', () => { expect(cancelled).toBe(true) }) - it('no-ops on a body-less response', async () => { - await expect( - cancelUnreadResponseBody(new Response(null, { status: 500 })) - ).resolves.toBeUndefined() - }) - it('swallows cancellation failures on a locked stream', async () => { const response = cancelTrackingResponse(500, () => {}) response.body?.getReader() diff --git a/src/main/line-editor-ready-output-scanner.test.ts b/src/main/line-editor-ready-output-scanner.test.ts index 3683b95598d..e2e0451b55a 100644 --- a/src/main/line-editor-ready-output-scanner.test.ts +++ b/src/main/line-editor-ready-output-scanner.test.ts @@ -13,10 +13,4 @@ describe('line editor ready output scanner', () => { expect(scanForLineEditorReadyOutput(state, sequence.slice(4))).toBe(true) } ) - - it('ignores ordinary prompt output', () => { - expect( - scanForLineEditorReadyOutput(createLineEditorReadyOutputScanState(), 'user@host % ') - ).toBe(false) - }) }) diff --git a/src/main/native-chat/agent-session-wire/structured-agent-session-launch-env.test.ts b/src/main/native-chat/agent-session-wire/structured-agent-session-launch-env.test.ts deleted file mode 100644 index c3c89fbf09d..00000000000 --- a/src/main/native-chat/agent-session-wire/structured-agent-session-launch-env.test.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { hostTestAttachParams } from './structured-agent-session-host-test-data' -import { - pinnedAgentSessionLaunchArgs, - pinnedAgentSessionLaunchEnv -} from './structured-agent-session-launch-env' - -describe('pinnedAgentSessionLaunchEnv', () => { - it('layers the pinned account home over the shell environment', async () => { - await expect( - pinnedAgentSessionLaunchEnv( - async () => ({ EXAMPLE_GATEWAY_TOKEN: 'shell-exported', CODEX_HOME: '/shell/home' }), - hostTestAttachParams(null) - ) - ).resolves.toEqual({ - launchEnv: { - EXAMPLE_GATEWAY_TOKEN: 'shell-exported', - CODEX_HOME: '/home/dev/.codex' - } - }) - }) - - it('copies the host-resolved provider arguments into reservation authority', async () => { - await expect( - pinnedAgentSessionLaunchArgs(async () => ['--profile', 'review'], hostTestAttachParams(null)) - ).resolves.toEqual({ launchArgs: ['--profile', 'review'] }) - }) -}) diff --git a/src/main/native-chat/transcript-fallback-id.test.ts b/src/main/native-chat/transcript-fallback-id.test.ts deleted file mode 100644 index 8ef46edfcf6..00000000000 --- a/src/main/native-chat/transcript-fallback-id.test.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { transcriptFallbackId } from './transcript-fallback-id' - -describe('transcriptFallbackId', () => { - it('sorts line positions numerically when timestamps are unavailable', () => { - const ids = [10, 2, 100, 9].map((offset) => transcriptFallbackId('/chat.jsonl', offset)) - - expect(ids.sort()).toEqual([ - transcriptFallbackId('/chat.jsonl', 2), - transcriptFallbackId('/chat.jsonl', 9), - transcriptFallbackId('/chat.jsonl', 10), - transcriptFallbackId('/chat.jsonl', 100) - ]) - }) - - it('sorts later incremental byte ranges after earlier ranges', () => { - const earlier = transcriptFallbackId('/chat.jsonl', 99) - const later = transcriptFallbackId('/chat.jsonl', 100) - - expect(earlier < later).toBe(true) - }) -}) diff --git a/src/main/notifications/desktop-away-state.test.ts b/src/main/notifications/desktop-away-state.test.ts deleted file mode 100644 index 702539d6447..00000000000 --- a/src/main/notifications/desktop-away-state.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { expect, it } from 'vitest' -import { readDesktopAwayState } from './desktop-away-state' - -it.each([ - [179, false], - [180, true], - [181, true] -])('checks the three-minute boundary at %s seconds', (idle, away) => { - expect( - readDesktopAwayState({ getSystemIdleState: () => 'active', getSystemIdleTime: () => idle }) - ).toBe(away) -}) -it('allows immediate delivery when locked and fails open when presence cannot be read', () => { - expect( - readDesktopAwayState({ getSystemIdleState: () => 'locked', getSystemIdleTime: () => 0 }) - ).toBe(true) - expect( - readDesktopAwayState({ - getSystemIdleState: () => { - throw new Error('unsupported') - }, - getSystemIdleTime: () => 0 - }) - ).toBeUndefined() -}) diff --git a/src/main/orcad/orcad-ws-port-policy.test.ts b/src/main/orcad/orcad-ws-port-policy.test.ts deleted file mode 100644 index 234cd867985..00000000000 --- a/src/main/orcad/orcad-ws-port-policy.test.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { ORCAD_MANAGED_ACTIVATION_ROOT_ENV } from '../../shared/orcad-managed-launch-env' -import { orcadWsPortOptions } from './orcad-ws-port-policy' - -describe('orcadWsPortOptions', () => { - it('leaves the default port and its fallback alone without --port', () => { - expect(orcadWsPortOptions(undefined, {})).toEqual({}) - }) - - it('requires an operator --port', () => { - expect(orcadWsPortOptions(7001, {})).toEqual({ - wsPort: 7001, - preferPinnedWsPort: true, - requirePinnedWsPort: true - }) - }) - - it('lets a managed launch fall back when its port is taken', () => { - expect( - orcadWsPortOptions(6768, { [ORCAD_MANAGED_ACTIVATION_ROOT_ENV]: '/home/u/.orca-remote' }) - ).toEqual({ wsPort: 6768, preferPinnedWsPort: true }) - }) -}) diff --git a/src/main/pty/terminal-color-env.test.ts b/src/main/pty/terminal-color-env.test.ts deleted file mode 100644 index 1ade05c91b0..00000000000 --- a/src/main/pty/terminal-color-env.test.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { removeInheritedNoColor } from './terminal-color-env' - -describe('terminal color env', () => { - it('removes inherited color-disable variables from spawned terminal env', () => { - const env = { - NO_COLOR: '1', - FORCE_COLOR: '0', - CLICOLOR: '0', - TERM: 'xterm-256color' - } - - removeInheritedNoColor(env) - - expect(env).toEqual({ TERM: 'xterm-256color' }) - }) - - it('preserves explicit color-enable variables', () => { - const env = { - FORCE_COLOR: '1', - CLICOLOR: '1' - } - - removeInheritedNoColor(env) - - expect(env).toEqual({ - FORCE_COLOR: '1', - CLICOLOR: '1' - }) - }) -}) diff --git a/src/main/runtime/orchestration/db/lifecycle-rejection-marker.test.ts b/src/main/runtime/orchestration/db/lifecycle-rejection-marker.test.ts deleted file mode 100644 index 72152e781e4..00000000000 --- a/src/main/runtime/orchestration/db/lifecycle-rejection-marker.test.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - addLifecycleRejectionMarker, - hasLifecycleRejectionMarker -} from './lifecycle-rejection-marker' - -describe('lifecycle-rejection-marker', () => { - it('adds a marker onto an object payload and recognizes it', () => { - const marked = addLifecycleRejectionMarker('{"keep":true}', 'rejected', 'not current') - expect(JSON.parse(marked)).toMatchObject({ - keep: true, - _orcaLifecycleRejection: { code: 'rejected', reason: 'not current' } - }) - expect(hasLifecycleRejectionMarker(marked)).toBe(true) - }) - - it('treats missing, non-object, and incomplete markers as absent', () => { - expect(hasLifecycleRejectionMarker(null)).toBe(false) - expect(hasLifecycleRejectionMarker('[]')).toBe(false) - expect(hasLifecycleRejectionMarker('{"_orcaLifecycleRejection":{"code":1}}')).toBe(false) - expect(hasLifecycleRejectionMarker('not-json')).toBe(false) - }) -}) diff --git a/src/main/runtime/proven-absent-leaf-pty-verdicts.test.ts b/src/main/runtime/proven-absent-leaf-pty-verdicts.test.ts deleted file mode 100644 index eb6580c2e43..00000000000 --- a/src/main/runtime/proven-absent-leaf-pty-verdicts.test.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { pruneExpiredProvenAbsentLeafPtyVerdicts } from './proven-absent-leaf-pty-verdicts' - -describe('pruneExpiredProvenAbsentLeafPtyVerdicts', () => { - it('removes only entries at or past the TTL without a re-probe', () => { - const map = new Map([ - ['live-dead', 1_000], - ['still-fresh', 1_400], - ['exact-expiry', 1_000] - ]) - pruneExpiredProvenAbsentLeafPtyVerdicts(map, 1_000 + 15_000, 15_000) - expect([...map.keys()]).toEqual(['still-fresh']) - }) - - it('leaves an empty map alone', () => { - const map = new Map() - pruneExpiredProvenAbsentLeafPtyVerdicts(map, Date.now(), 15_000) - expect(map.size).toBe(0) - }) - - it('clears everything when ttl is non-positive', () => { - const map = new Map([['a', 1]]) - pruneExpiredProvenAbsentLeafPtyVerdicts(map, 100, 0) - expect(map.size).toBe(0) - }) -}) diff --git a/src/main/runtime/push/push-outcome-counters.test.ts b/src/main/runtime/push/push-outcome-counters.test.ts deleted file mode 100644 index 67ccc475cfc..00000000000 --- a/src/main/runtime/push/push-outcome-counters.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { expect, it, vi } from 'vitest' -import { PushOutcomeCounters } from './push-outcome-counters' -it('limits failure logs while retaining category counts', () => { - let now = 0 - const log = vi.spyOn(console, 'warn').mockImplementation(() => {}) - try { - const counters = new PushOutcomeCounters(() => now) - counters.record('rejected') - counters.record('error') - counters.record('error') - expect(log).toHaveBeenCalledTimes(1) - now += 60_000 - counters.record('rate_limited') - expect(JSON.parse(String(log.mock.calls[1]![0]))).toEqual({ - event: 'orca_desktop_push_failures', - error: 2, - rate_limited: 1 - }) - counters.record('unreachable') - counters.flush() - expect(log).toHaveBeenCalledTimes(3) - } finally { - log.mockRestore() - } -}) diff --git a/src/main/runtime/runtime-repository-ref-queries.test.ts b/src/main/runtime/runtime-repository-ref-queries.test.ts deleted file mode 100644 index ee0027b781d..00000000000 --- a/src/main/runtime/runtime-repository-ref-queries.test.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { describe, expect, it } from 'vitest' -import type { Repo } from '../../shared/repo-types' -import { RuntimeRepositoryRefQueries } from './runtime-repository-ref-queries' - -const repo: Repo = { - id: 'remote-repo', - path: '/repo', - displayName: 'remote', - badgeColor: 'blue', - addedAt: 1, - connectionId: 'ssh-1' -} - -describe('qualified refs in repository searches', () => { - it('keeps folder workspaces outside Git searches', async () => { - const queries = new RuntimeRepositoryRefQueries({ - resolveRepo: async () => ({ ...repo, kind: 'folder' }) - }) - expect(await queries.search('id:remote-repo', 'feature', 2, false)).toEqual({ - refs: [], - truncated: false - }) - }) -}) diff --git a/src/main/runtime/runtime-server-git-availability.test.ts b/src/main/runtime/runtime-server-git-availability.test.ts deleted file mode 100644 index 22a58b218de..00000000000 --- a/src/main/runtime/runtime-server-git-availability.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** Report no Git only when spawn never started; other failures reject so remote create dialogs retain unknown instead of false absence. */ -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' - -const { gitExecFileAsyncMock } = vi.hoisted(() => ({ gitExecFileAsyncMock: vi.fn() })) - -vi.mock('../git/runner', () => ({ gitExecFileAsync: gitExecFileAsyncMock })) - -import { RuntimeServerEnvironmentCommands } from './runtime-server-environment-commands' - -describe('RuntimeServerEnvironmentCommands.isGitAvailable', () => { - const commands = new RuntimeServerEnvironmentCommands() - - beforeEach(() => { - gitExecFileAsyncMock.mockReset() - }) - - afterEach(() => { - vi.restoreAllMocks() - }) - - it('answers true when git reports its version', async () => { - gitExecFileAsyncMock.mockResolvedValue({ stdout: 'git version 2.25.1\n', stderr: '' }) - await expect(commands.isGitAvailable()).resolves.toBe(true) - }) -}) diff --git a/src/main/runtime/structured-agent-launch-parity-coverage.test.ts b/src/main/runtime/structured-agent-launch-parity-coverage.test.ts deleted file mode 100644 index c2a6615c9f5..00000000000 --- a/src/main/runtime/structured-agent-launch-parity-coverage.test.ts +++ /dev/null @@ -1,24 +0,0 @@ -// A newly registered agent must get launch parity snapshots: the oracle lists its agents by hand. - -import { readFileSync } from 'node:fs' -import { fileURLToPath } from 'node:url' -import { expect, it } from 'vitest' -import { STRUCTURED_AGENT_RUNTIME_REGISTRATIONS } from './structured-agent-runtime-registrations' - -const SNAPSHOT = new URL( - './__snapshots__/structured-agent-launch-parity.test.ts.snap', - import.meta.url -) - -it('snapshots the launch of every registered native-chat agent, and of no other', () => { - const snapshots = readFileSync(fileURLToPath(SNAPSHOT), 'utf8') - const snapshotted = new Set( - [...snapshots.matchAll(/^exports\[`native-chat launch parity > (\S+) /gm)].map( - ([, agent]) => agent - ) - ) - const registered = STRUCTURED_AGENT_RUNTIME_REGISTRATIONS.map( - ({ definition }) => definition.agent - ) - expect([...snapshotted].sort()).toEqual([...registered].sort()) -}) diff --git a/src/main/runtime/terminal-wait-results.test.ts b/src/main/runtime/terminal-wait-results.test.ts deleted file mode 100644 index ec5c3e76687..00000000000 --- a/src/main/runtime/terminal-wait-results.test.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - buildPtyTerminalWaitBlockedResult, - buildPtyTerminalWaitResult, - buildTerminalWaitBlockedResult, - buildTerminalWaitResult -} from './terminal-wait-results' - -describe('terminal wait results', () => { - it('preserves exit provenance for every wait result shape', () => { - const terminal = { - connected: false, - lastExitCode: 0, - lastExitCause: { kind: 'operator_close' as const } - } - const results = [ - buildTerminalWaitResult('terminal', 'exit', terminal), - buildTerminalWaitBlockedResult('terminal', 'exit', terminal, 'agent-approval-prompt'), - buildPtyTerminalWaitResult('pty', 'exit', terminal), - buildPtyTerminalWaitBlockedResult('pty', 'exit', terminal, 'agent-approval-prompt') - ] - - expect(results.map((result) => result.exitCause)).toEqual([ - { kind: 'operator_close' }, - { kind: 'operator_close' }, - { kind: 'operator_close' }, - { kind: 'operator_close' } - ]) - }) -}) diff --git a/src/main/skills/skill-discovery-source-filter.test.ts b/src/main/skills/skill-discovery-source-filter.test.ts deleted file mode 100644 index 29d6ac6ca7e..00000000000 --- a/src/main/skills/skill-discovery-source-filter.test.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { describe, expect, it } from 'vitest' -import type { SkillScanRoot } from './skill-discovery-sources' -import { rootMayContainSourceKind } from './skill-discovery-source-filter' - -const homeRoot: SkillScanRoot = { - id: 'home', - owner: 'agents', - path: '/home/alice/.agents/skills', - label: 'Home', - sourceKind: 'home', - providers: ['agent-skills'] -} - -describe('rootMayContainSourceKind', () => { - it('treats an empty list as no filter', () => { - expect(rootMayContainSourceKind(homeRoot, undefined)).toBe(true) - expect(rootMayContainSourceKind(homeRoot, [])).toBe(true) - }) - - it('keeps home roots for bundled classification', () => { - expect(rootMayContainSourceKind(homeRoot, ['bundled'])).toBe(true) - expect(rootMayContainSourceKind(homeRoot, ['plugin'])).toBe(false) - }) -}) diff --git a/src/main/startup/bootstrap-fatal-exit-guard.test.ts b/src/main/startup/bootstrap-fatal-exit-guard.test.ts deleted file mode 100644 index cff8b372578..00000000000 --- a/src/main/startup/bootstrap-fatal-exit-guard.test.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { afterEach, describe, expect, it, vi } from 'vitest' -import { - BOOTSTRAP_FATAL_EXIT_GUARD_KEY, - removeBootstrapFatalExitGuard -} from './bootstrap-fatal-exit-guard' - -type BootstrapFatalExitGlobal = typeof globalThis & { - [BOOTSTRAP_FATAL_EXIT_GUARD_KEY]?: () => void -} - -const bootstrapGlobal = globalThis as BootstrapFatalExitGlobal - -afterEach(() => { - delete bootstrapGlobal[BOOTSTRAP_FATAL_EXIT_GUARD_KEY] -}) - -describe('bootstrap fatal exit guard', () => { - it('removes the generated pre-import guard', () => { - const removeGuard = vi.fn() - bootstrapGlobal[BOOTSTRAP_FATAL_EXIT_GUARD_KEY] = removeGuard - - removeBootstrapFatalExitGuard() - - expect(removeGuard).toHaveBeenCalledOnce() - expect(bootstrapGlobal[BOOTSTRAP_FATAL_EXIT_GUARD_KEY]).toBeUndefined() - }) -}) diff --git a/src/main/startup/cloud-session-shutdown-flush.test.ts b/src/main/startup/cloud-session-shutdown-flush.test.ts deleted file mode 100644 index 7df52acdf6c..00000000000 --- a/src/main/startup/cloud-session-shutdown-flush.test.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' - -const flush = vi.hoisted(() => vi.fn()) - -vi.mock('electron', async () => { - const { EventEmitter } = await import('node:events') - return { powerMonitor: new EventEmitter() } -}) -vi.mock('../orca-profiles/profile-cloud-session-owner', () => ({ - flushUnsavedCloudSessions: flush -})) - -import { powerMonitor } from 'electron' -import { installCloudSessionShutdownFlush } from './cloud-session-shutdown-flush' - -describe('cloud session shutdown flush', () => { - it('writes unsaved rotations when the OS shuts down', () => { - installCloudSessionShutdownFlush() - powerMonitor.emit('shutdown') - expect(flush).toHaveBeenCalledTimes(1) - }) -}) diff --git a/src/main/startup/gpu-fallback-switches.test.ts b/src/main/startup/gpu-fallback-switches.test.ts deleted file mode 100644 index a132b037bb1..00000000000 --- a/src/main/startup/gpu-fallback-switches.test.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' -import { applyGpuFallbackCommandLineSwitches } from './gpu-fallback-switches' - -describe('GPU fallback command-line switches', () => { - it('applies nothing outside Windows', () => { - for (const platform of ['darwin', 'linux'] as const) { - const appendSwitch = vi.fn() - expect(applyGpuFallbackCommandLineSwitches({ appendSwitch }, platform)).toEqual([]) - expect(appendSwitch).not.toHaveBeenCalled() - } - }) - - // Windows 11/Electron 43.1: disable-gpu leaves one GPU child; in-process-gpu removes it. - it('appends exactly the measured switch set to the Electron command line', () => { - const appendSwitch = vi.fn() - const appliedSwitches = applyGpuFallbackCommandLineSwitches({ appendSwitch }, 'win32') - expect(appliedSwitches).toEqual([ - 'disable-gpu', - 'disable-software-rasterizer', - 'in-process-gpu' - ]) - expect(appendSwitch.mock.calls.map(([name]) => name)).toEqual(appliedSwitches) - }) -}) diff --git a/src/main/text-generation/omp-model-discovery-policy.test.ts b/src/main/text-generation/omp-model-discovery-policy.test.ts deleted file mode 100644 index 3b70966f141..00000000000 --- a/src/main/text-generation/omp-model-discovery-policy.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { expect, it } from 'vitest' -import { getAgentModelProbeSpec } from '../../shared/agent-model-probe-spec' -import { finalizeModelDiscoveryOutput } from './commit-message-model-discovery-policy' - -const output = JSON.stringify({ - models: [ - { - provider: 'provider', - id: 'exact-model', - selector: 'provider/exact-model', - name: 'Exact model' - } - ] -}) -it('keeps the OMP configured default out of generic terminal discovery results', () => { - const spec = getAgentModelProbeSpec('omp') - if (!spec) { - throw new Error('Missing OMP probe spec') - } - expect(finalizeModelDiscoveryOutput(spec, output, '', 0)).toMatchObject({ - success: true, - defaultModelId: 'provider/exact-model', - models: [{ id: 'provider/exact-model' }] - }) -}) diff --git a/src/main/updater-lifecycle-diagnostics.test.ts b/src/main/updater-lifecycle-diagnostics.test.ts deleted file mode 100644 index 1ad3c26768b..00000000000 --- a/src/main/updater-lifecycle-diagnostics.test.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' - -const { recordDurableCrashBreadcrumbMock } = vi.hoisted(() => ({ - recordDurableCrashBreadcrumbMock: vi.fn() -})) - -vi.mock('./crash-reporting/durable-crash-breadcrumb', () => ({ - recordDurableCrashBreadcrumb: recordDurableCrashBreadcrumbMock -})) - -import { recordUpdaterLifecycle } from './updater-lifecycle-diagnostics' - -beforeEach(() => { - recordDurableCrashBreadcrumbMock.mockClear() - vi.spyOn(console, 'info').mockImplementation(() => {}) -}) - -afterEach(() => { - vi.restoreAllMocks() -}) - -describe('recordUpdaterLifecycle', () => { - it('records updater events in the durable lifecycle trace', () => { - recordUpdaterLifecycle('quit_and_install', { version: '1.2.3' }) - - expect(recordDurableCrashBreadcrumbMock).toHaveBeenCalledWith('updater_quit_and_install', { - version: '1.2.3' - }) - }) -}) diff --git a/src/main/window/main-window-visibility.test.ts b/src/main/window/main-window-visibility.test.ts deleted file mode 100644 index 335dc4a87d6..00000000000 --- a/src/main/window/main-window-visibility.test.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { describe, expect, it } from 'vitest' - -import { isMainWindowVisible } from './main-window-visibility' - -describe('main window visibility helpers', () => { - it('treats a minimal alive window double as visible', () => { - expect(isMainWindowVisible({ isDestroyed: () => false })).toBe(true) - }) - - it('parks work when the real window is hidden, minimized, destroyed, or missing', () => { - expect( - isMainWindowVisible({ - isDestroyed: () => false, - isVisible: () => false, - isMinimized: () => false - }) - ).toBe(false) - expect( - isMainWindowVisible({ - isDestroyed: () => false, - isVisible: () => true, - isMinimized: () => true - }) - ).toBe(false) - expect(isMainWindowVisible({ isDestroyed: () => true })).toBe(false) - expect(isMainWindowVisible(null)).toBe(false) - }) -}) diff --git a/src/main/window/renderer-launch-failure-backoff.test.ts b/src/main/window/renderer-launch-failure-backoff.test.ts deleted file mode 100644 index 193e6bd4d20..00000000000 --- a/src/main/window/renderer-launch-failure-backoff.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - createRendererLaunchFailureBackoff, - RENDERER_LAUNCH_FAILURE_RETRY_DELAYS_MS -} from './renderer-launch-failure-backoff' - -describe('createRendererLaunchFailureBackoff', () => { - it('keeps the 250ms first retry and spreads the rest over about two minutes', () => { - expect(RENDERER_LAUNCH_FAILURE_RETRY_DELAYS_MS[0]).toBe(250) - const total = RENDERER_LAUNCH_FAILURE_RETRY_DELAYS_MS.reduce((sum, ms) => sum + ms, 0) - expect(total).toBeGreaterThanOrEqual(90_000) - expect(total).toBeLessThanOrEqual(125_000) - }) - - it('walks the schedule, then reports it spent until reset', () => { - const backoff = createRendererLaunchFailureBackoff([10, 20]) - expect(backoff.nextDelayMs()).toBe(10) - expect(backoff.nextDelayMs()).toBe(20) - expect(backoff.nextDelayMs()).toBeNull() - expect(backoff.attempts()).toBe(2) - backoff.reset() - expect(backoff.attempts()).toBe(0) - expect(backoff.nextDelayMs()).toBe(10) - }) -}) diff --git a/src/main/wsl-bash-command.test.ts b/src/main/wsl-bash-command.test.ts deleted file mode 100644 index a6440a7fd8d..00000000000 --- a/src/main/wsl-bash-command.test.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { buildEncodedWslBashCommand } from './wsl-bash-command' - -describe('buildEncodedWslBashCommand', () => { - it('wraps Bash scripts without exposing local shell variables to wsl.exe', () => { - const command = [ - 'set -euo pipefail', - "candidate='/home/alice/.local/share/orca/codex-accounts/a/home'", - 'candidate_real=$(readlink -f -- "$candidate")', - 'printf "%s\\n" "$candidate_real"' - ].join('\n') - - const wrapped = buildEncodedWslBashCommand(command) - const encoded = wrapped.match( - /^set -o pipefail; printf %s '([^']+)' \| base64 -d \| bash$/ - )?.[1] - - expect(wrapped).not.toContain('$candidate') - expect(wrapped).not.toContain('\n') - expect(encoded).toBeTruthy() - expect(Buffer.from(encoded as string, 'base64').toString('utf8')).toBe(command) - }) -}) diff --git a/src/main/wsl/wsl-executable-path.win32.test.ts b/src/main/wsl/wsl-executable-path.win32.test.ts index 30d37757e28..f4b768806c2 100644 --- a/src/main/wsl/wsl-executable-path.win32.test.ts +++ b/src/main/wsl/wsl-executable-path.win32.test.ts @@ -13,8 +13,4 @@ describeOnWindows('resolveWslExecutablePath on a real Windows host', () => { expect(resolved.toLowerCase()).toContain('system32') expect(existsSync(resolved)).toBe(true) }) - - it('memoises, so a spawn does not pay a stat', () => { - expect(resolveWslExecutablePath()).toBe(resolveWslExecutablePath()) - }) }) diff --git a/src/renderer/src/components/browser-pane/navigate/chromium-error-page-polling.test.ts b/src/renderer/src/components/browser-pane/navigate/chromium-error-page-polling.test.ts deleted file mode 100644 index f7ad76c4f6c..00000000000 --- a/src/renderer/src/components/browser-pane/navigate/chromium-error-page-polling.test.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { shouldPollChromiumErrorPage } from './chromium-error-page-polling' - -describe('shouldPollChromiumErrorPage', () => { - it('runs the fallback chrome-error poll only for the active loading browser pane', () => { - expect(shouldPollChromiumErrorPage({ isActive: true, loading: true })).toBe(true) - expect(shouldPollChromiumErrorPage({ isActive: false, loading: true })).toBe(false) - expect(shouldPollChromiumErrorPage({ isActive: true, loading: false })).toBe(false) - expect(shouldPollChromiumErrorPage({ isActive: false, loading: false })).toBe(false) - }) -}) diff --git a/src/renderer/src/components/browser-pane/stream-remote/remote-browser-frame-style.test.ts b/src/renderer/src/components/browser-pane/stream-remote/remote-browser-frame-style.test.ts deleted file mode 100644 index d7a6a23374c..00000000000 --- a/src/renderer/src/components/browser-pane/stream-remote/remote-browser-frame-style.test.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { getRemoteBrowserFrameStyle } from './remote-browser-frame-style' - -describe('getRemoteBrowserFrameStyle', () => { - it('fits the frame by the CSS viewport it shows, not by the bitmap size', () => { - expect( - getRemoteBrowserFrameStyle({ - imageWidth: 2266, - imageHeight: 1309, - deviceWidth: 958, - deviceHeight: 609 - }) - ).toEqual({ - inset: 0, - margin: 'auto', - width: `min(100cqw, calc(100cqh * ${958 / 609}))`, - height: `min(100cqh, calc(100cqw / ${958 / 609}))`, - objectFit: 'fill' - }) - }) - - it('fills the pane when the frame does not say what it shows', () => { - expect(getRemoteBrowserFrameStyle({ imageWidth: 800, imageHeight: 600 })).toEqual({ - width: '100%', - height: '100%', - objectFit: 'fill', - objectPosition: 'top left' - }) - }) -}) diff --git a/src/renderer/src/components/dictation/DictationIndicator.localization.test.ts b/src/renderer/src/components/dictation/DictationIndicator.localization.test.ts deleted file mode 100644 index 8b2863d7613..00000000000 --- a/src/renderer/src/components/dictation/DictationIndicator.localization.test.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { describe, expect, it } from 'vitest' -import en from '@/i18n/locales/en.json' -import es from '@/i18n/locales/es.json' -import ja from '@/i18n/locales/ja.json' -import ko from '@/i18n/locales/ko.json' -import zh from '@/i18n/locales/zh.json' - -const englishLabels = en.auto.components.dictation.DictationIndicator as Record -const translatedLabels = { es, ja, ko, zh } - -describe('DictationIndicator localization', () => { - it('uses generated localization keys', () => { - expect(Object.keys(englishLabels).every((key) => /^[a-f0-9]{10}$/.test(key))).toBe(true) - }) - - it.each(Object.entries(translatedLabels))('translates every label in %s', (_locale, catalog) => { - const labels = catalog.auto.components.dictation.DictationIndicator as Record - - for (const [key, englishLabel] of Object.entries(englishLabels)) { - expect(labels[key]).toBeTruthy() - expect(labels[key]).not.toBe(englishLabel) - } - }) -}) diff --git a/src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-initial-section-load.test.ts b/src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-initial-section-load.test.ts deleted file mode 100644 index 31e30f05758..00000000000 --- a/src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-initial-section-load.test.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { getInitialCombinedDiffSectionLoadIndices } from './combined-diff-initial-section-load' - -describe('combined diff initial section load', () => { - it('queues the initial section window', () => { - expect( - getInitialCombinedDiffSectionLoadIndices({ - sectionCount: 10, - loadedIndices: new Set(), - maxCount: 4 - }) - ).toEqual([0, 1, 2, 3]) - }) - - it('skips sections that were restored from cache', () => { - expect( - getInitialCombinedDiffSectionLoadIndices({ - sectionCount: 6, - loadedIndices: new Set([0, 2, 5]), - maxCount: 6 - }) - ).toEqual([1, 3, 4]) - }) - - it('handles an empty diff', () => { - expect( - getInitialCombinedDiffSectionLoadIndices({ - sectionCount: 0, - loadedIndices: new Set(), - maxCount: 6 - }) - ).toEqual([]) - }) -}) diff --git a/src/renderer/src/components/jira-issue-workspace-actions.test.ts b/src/renderer/src/components/jira-issue-workspace-actions.test.ts deleted file mode 100644 index 09053c71b18..00000000000 --- a/src/renderer/src/components/jira-issue-workspace-actions.test.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' - -vi.mock('@/lib/jira-issue-key-casing', () => ({ - getJiraIssueKeyCasingSeedOptions: () => ({}) -})) - -import { buildJiraBranchName } from './jira-issue-workspace-actions' - -describe('buildJiraBranchName', () => { - const issue = { key: 'PROJ-123', title: 'Android feature' } - - it('lowercases the whole suggested branch name by default', () => { - expect(buildJiraBranchName(issue)).toBe('proj-123-android-feature') - expect(buildJiraBranchName(issue, { jiraIssueKeyCasing: 'lowercase' })).toBe( - 'proj-123-android-feature' - ) - }) - - it('keeps the canonical uppercase key when the casing policy preserves it', () => { - expect(buildJiraBranchName(issue, { jiraIssueKeyCasing: 'preserve' })).toBe( - 'PROJ-123-android-feature' - ) - expect( - buildJiraBranchName({ key: 'TEAM_ALPHA9-7', title: '' }, { jiraIssueKeyCasing: 'preserve' }) - ).toBe('TEAM_ALPHA9-7') - }) -}) diff --git a/src/renderer/src/components/linear-project-search-query.test.ts b/src/renderer/src/components/linear-project-search-query.test.ts deleted file mode 100644 index 3da1a5d14c2..00000000000 --- a/src/renderer/src/components/linear-project-search-query.test.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { describe, expect, it } from 'vitest' - -import { RUNTIME_PROVIDER_SEARCH_QUERY_MAX_BYTES } from '@/runtime/runtime-provider-search-bounds' - -import { getLinearProjectSearchRequestQuery } from './linear-project-search-query' - -describe('getLinearProjectSearchRequestQuery', () => { - it('keeps project queries within the provider search budget', () => { - expect(getLinearProjectSearchRequestQuery('roadmap')).toBe('roadmap') - }) - - it('rejects oversized ASCII project queries before provider lookup', () => { - const query = 'x'.repeat(RUNTIME_PROVIDER_SEARCH_QUERY_MAX_BYTES + 1) - - expect(getLinearProjectSearchRequestQuery(query)).toBeNull() - }) - - it('counts UTF-8 bytes rather than UTF-16 code units', () => { - const query = 'é'.repeat(RUNTIME_PROVIDER_SEARCH_QUERY_MAX_BYTES / 2 + 1) - - expect(getLinearProjectSearchRequestQuery(query)).toBeNull() - }) -}) diff --git a/src/renderer/src/components/native-chat/NativeChatEmptyState.test.tsx b/src/renderer/src/components/native-chat/NativeChatEmptyState.test.tsx deleted file mode 100644 index b666ae6e5f5..00000000000 --- a/src/renderer/src/components/native-chat/NativeChatEmptyState.test.tsx +++ /dev/null @@ -1,24 +0,0 @@ -// @vitest-environment happy-dom - -import '@testing-library/jest-dom/vitest' - -import { cleanup, render, screen } from '@testing-library/react' -import { afterEach, expect, it } from 'vitest' -import { NativeChatEmptyState } from './NativeChatEmptyState' - -afterEach(cleanup) - -it('keeps pointing the terminal-backed chat back to its terminal when a read fails', () => { - render() - expect( - screen.getByText( - 'The transcript could not be read. Toggle back to the terminal to keep working.' - ) - ).toBeInTheDocument() -}) - -it('shows the host message in place of the terminal-backed default', () => { - render() - expect(screen.getByText('disk full')).toBeInTheDocument() - expect(screen.queryByText(/Toggle back to the terminal/)).toBeNull() -}) diff --git a/src/renderer/src/components/pet/pet-overlay-visibility.test.ts b/src/renderer/src/components/pet/pet-overlay-visibility.test.ts deleted file mode 100644 index 9a6ffc6ffd7..00000000000 --- a/src/renderer/src/components/pet/pet-overlay-visibility.test.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { shouldRenderPetOverlay } from './pet-overlay-visibility' - -describe('shouldRenderPetOverlay', () => { - it('does not render before persisted UI hydration even when the feature is enabled', () => { - expect( - shouldRenderPetOverlay({ - persistedUIReady: false, - petEnabled: true, - petVisible: true - }) - ).toBe(false) - }) - - it('renders only after hydration when both pet switches allow it', () => { - expect( - shouldRenderPetOverlay({ - persistedUIReady: true, - petEnabled: true, - petVisible: true - }) - ).toBe(true) - expect( - shouldRenderPetOverlay({ - persistedUIReady: true, - petEnabled: true, - petVisible: false - }) - ).toBe(false) - expect( - shouldRenderPetOverlay({ - persistedUIReady: true, - petEnabled: false, - petVisible: true - }) - ).toBe(false) - }) -}) diff --git a/src/renderer/src/components/right-sidebar/ChecksPanel.updated-at-metadata.test.tsx b/src/renderer/src/components/right-sidebar/ChecksPanel.updated-at-metadata.test.tsx deleted file mode 100644 index 48e9dc210ea..00000000000 --- a/src/renderer/src/components/right-sidebar/ChecksPanel.updated-at-metadata.test.tsx +++ /dev/null @@ -1,28 +0,0 @@ -// @vitest-environment happy-dom - -import { renderToStaticMarkup } from 'react-dom/server' -import { describe, expect, it } from 'vitest' -import { ChecksPanelUpdatedAtMetadata } from './checks-panel-updated-at-metadata' - -function renderMetadataText(reviewShortLabel: string): string { - const container = document.createElement('div') - container.innerHTML = renderToStaticMarkup( - - ) - return container.textContent ?? '' -} - -describe('ChecksPanel updated-at metadata', () => { - it.each(['PR', 'MR'])( - 'renders a whitespace boundary between the %s updated label and timestamp', - (reviewShortLabel) => { - const text = renderMetadataText(reviewShortLabel) - - expect(text).toMatch(new RegExp(`${reviewShortLabel} updated\\s+\\S`)) - expect(text).not.toMatch(new RegExp(`${reviewShortLabel} updated\\S`)) - } - ) -}) diff --git a/src/renderer/src/components/right-sidebar/file-explorer-read-error.test.ts b/src/renderer/src/components/right-sidebar/file-explorer-read-error.test.ts deleted file mode 100644 index c3824f0e489..00000000000 --- a/src/renderer/src/components/right-sidebar/file-explorer-read-error.test.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { expect, it } from 'vitest' -import { describeFileExplorerReadError } from './file-explorer-read-error' - -it('drops the IPC wrapper a runtime-host read error arrives with', () => { - expect( - describeFileExplorerReadError( - new Error( - "Error invoking remote method 'runtimeEnvironments:call': Error: WSL hosts are turned off in Settings → Experimental." - ) - ) - ).toBe('WSL hosts are turned off in Settings → Experimental.') -}) - -it('keeps an empty message empty so the read still reads as failed', () => { - const empty = new Error('replaced below') - empty.message = '' - expect(describeFileExplorerReadError(empty)).toBe('') -}) - -it('keeps a plain error and a non-Error rejection as-is', () => { - expect(describeFileExplorerReadError(new Error('Permission denied'))).toBe('Permission denied') - expect(describeFileExplorerReadError('EACCES')).toBe('EACCES') -}) diff --git a/src/renderer/src/components/settings/BrowserUseSkillStep.test.tsx b/src/renderer/src/components/settings/BrowserUseSkillStep.test.tsx deleted file mode 100644 index dc7a22f1602..00000000000 --- a/src/renderer/src/components/settings/BrowserUseSkillStep.test.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { renderToStaticMarkup } from 'react-dom/server' -import { describe, expect, it, vi } from 'vitest' -import { BrowserUseSkillStep } from './BrowserUseSkillStep' - -const capturedPanel = vi.hoisted(() => ({ - props: null as null | Record -})) - -vi.mock('./AgentSkillSetupPanel', () => ({ - AgentSkillSetupPanel: (props: Record) => { - capturedPanel.props = props - return
- } -})) - -describe('BrowserUseSkillStep', () => { - it('installs the orca-cli skill, which also updates it once installed', () => { - renderToStaticMarkup( - - ) - - expect(capturedPanel.props).toEqual( - expect.objectContaining({ skillNames: ['orca-cli'], installed: true }) - ) - expect(capturedPanel.props?.installedSkillNames).toBeUndefined() - }) -}) diff --git a/src/renderer/src/components/settings/codex-config-sync-warning.test.ts b/src/renderer/src/components/settings/codex-config-sync-warning.test.ts deleted file mode 100644 index 933352b739e..00000000000 --- a/src/renderer/src/components/settings/codex-config-sync-warning.test.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { getCodexConfigSyncWarning } from './codex-config-sync-warning' - -const systemConfigPath = '/home/user/.codex/config.toml' - -describe('getCodexConfigSyncWarning', () => { - it('stays silent while syncing normally', () => { - expect( - getCodexConfigSyncWarning({ state: 'synced', reason: null, systemConfigPath }) - ).toBeNull() - }) - - it('stays silent before the status has loaded', () => { - expect(getCodexConfigSyncWarning(null)).toBeNull() - expect(getCodexConfigSyncWarning(undefined)).toBeNull() - }) - - it('surfaces the stall reason so the component can localize it', () => { - for (const reason of ['missing-source', 'blank-source', 'unreadable-source'] as const) { - expect(getCodexConfigSyncWarning({ state: 'stalled', reason, systemConfigPath })).toBe(reason) - } - }) -}) diff --git a/src/renderer/src/components/settings/general-editor-search.test.ts b/src/renderer/src/components/settings/general-editor-search.test.ts deleted file mode 100644 index 7b2a8db9862..00000000000 --- a/src/renderer/src/components/settings/general-editor-search.test.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { getGeneralEditorSearchEntries, getGeneralPaneSearchEntries } from './general-search' -import { matchesSettingsSearch } from './settings-search' - -describe('collapse unchanged settings search', () => { - it.each(['collapse unchanged', 'collapse', 'hide unchanged', 'fold', 'diff'])( - 'keeps the setting reachable through both search gates for "%s"', - (query) => { - const editorEntries = getGeneralEditorSearchEntries() - const entry = editorEntries.find((item) => item.title === 'Collapse Unchanged Regions') - - expect(entry).toBeDefined() - expect(matchesSettingsSearch(query, entry!)).toBe(true) - expect(matchesSettingsSearch(query, editorEntries)).toBe(true) - expect(matchesSettingsSearch(query, getGeneralPaneSearchEntries())).toBe(true) - } - ) -}) diff --git a/src/renderer/src/components/settings/general-preview-tab-search.test.ts b/src/renderer/src/components/settings/general-preview-tab-search.test.ts deleted file mode 100644 index 52a831d56dd..00000000000 --- a/src/renderer/src/components/settings/general-preview-tab-search.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { getGeneralNavigationSearchEntries, getGeneralPaneSearchEntries } from './general-search' -import { matchesSettingsSearch } from './settings-search' - -describe('preview tab setting search', () => { - it.each(['preview', 'reuse', 'italic', 'explorer', 'browsing', 'preview tab'])( - 'keeps the setting reachable through both search gates for "%s"', - (query) => { - const navigationEntries = getGeneralNavigationSearchEntries() - const entry = navigationEntries.find( - (item) => item.title === 'Reuse a preview tab when browsing files' - ) - - expect(entry).toBeDefined() - expect(matchesSettingsSearch(query, entry!)).toBe(true) - // The outer Navigation gate must match too or it hides the matching control. - expect(matchesSettingsSearch(query, navigationEntries)).toBe(true) - expect(matchesSettingsSearch(query, getGeneralPaneSearchEntries())).toBe(true) - } - ) -}) diff --git a/src/renderer/src/components/sidebar/project-header-action-selector-lockstep.test.ts b/src/renderer/src/components/sidebar/project-header-action-selector-lockstep.test.ts deleted file mode 100644 index f77d1a29b9f..00000000000 --- a/src/renderer/src/components/sidebar/project-header-action-selector-lockstep.test.ts +++ /dev/null @@ -1,23 +0,0 @@ -// @vitest-environment happy-dom -import { describe, expect, it } from 'vitest' - -import { isProjectGroupHeaderActionTarget } from './project-group-header-drag-contract' -import { - isRepoHeaderActionTarget, - REPO_HEADER_ACTION_SELECTOR -} from './project-header-drag-contract' - -describe('project header action selectors', () => { - it('includes the actions overlay for both repo and group helpers', () => { - expect(REPO_HEADER_ACTION_SELECTOR).toContain('[data-repo-header-actions]') - - const header = document.createElement('div') - const actions = document.createElement('div') - actions.setAttribute('data-repo-header-actions', '') - header.append(actions) - document.body.append(header) - - expect(isRepoHeaderActionTarget(actions, header)).toBe(true) - expect(isProjectGroupHeaderActionTarget(actions, header)).toBe(true) - }) -}) diff --git a/src/renderer/src/components/sidebar/worktree-list/rows/host-header-detail.test.ts b/src/renderer/src/components/sidebar/worktree-list/rows/host-header-detail.test.ts deleted file mode 100644 index 491845244fd..00000000000 --- a/src/renderer/src/components/sidebar/worktree-list/rows/host-header-detail.test.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { getHostHeaderDetail } from './host-header-detail' - -const runtimeRow = { kind: 'runtime', detail: 'Orca server' } as const - -describe('getHostHeaderDetail', () => { - it('asks for a re-pair when the host revoked this client', () => { - expect( - getHostHeaderDetail({ - ...runtimeRow, - health: 'blocked', - blockedReason: 'access-revoked' - }) - ).toEqual({ text: 'Re-pair required', isWarning: true }) - }) - - it('keeps the update label for an incompatible or unlabeled block', () => { - expect( - getHostHeaderDetail({ - ...runtimeRow, - health: 'blocked', - blockedReason: 'incompatible' - }) - ).toEqual({ text: 'Update required', isWarning: true }) - expect(getHostHeaderDetail({ ...runtimeRow, health: 'blocked' })).toEqual({ - text: 'Update required', - isWarning: true - }) - }) -}) diff --git a/src/renderer/src/components/sidebar/worktree-scroll-to-current-button.test.ts b/src/renderer/src/components/sidebar/worktree-scroll-to-current-button.test.ts deleted file mode 100644 index fb984cb2d54..00000000000 --- a/src/renderer/src/components/sidebar/worktree-scroll-to-current-button.test.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { getScrollTopToRevealBounds } from './worktree-sidebar-reveal' - -describe('getScrollTopToRevealBounds', () => { - const makeContainer = (scrollTop: number, clientHeight: number) => - ({ - scrollTop, - clientHeight - }) as HTMLElement - - it('scrolls upward to reveal a mounted current workspace card above the viewport', () => { - expect(getScrollTopToRevealBounds(makeContainer(100, 200), { start: 60, end: 120 })).toBe(60) - }) - - it('scrolls downward to reveal a mounted current workspace card below the viewport', () => { - expect(getScrollTopToRevealBounds(makeContainer(100, 200), { start: 250, end: 340 })).toBe(140) - }) - - it('does not scroll when the current workspace card is already fully visible', () => { - expect(getScrollTopToRevealBounds(makeContainer(100, 200), { start: 125, end: 260 })).toBeNull() - }) -}) diff --git a/src/renderer/src/components/skills/skill-description-length.test.ts b/src/renderer/src/components/skills/skill-description-length.test.ts deleted file mode 100644 index d521ce9e8ae..00000000000 --- a/src/renderer/src/components/skills/skill-description-length.test.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { isLongSkillDescription, SKILL_DESCRIPTION_CLAMP_CHARS } from './skill-description-length' - -describe('isLongSkillDescription', () => { - it('leaves a description that fits the clamp alone', () => { - expect(isLongSkillDescription('Interact with Discord servers.')).toBe(false) - expect(isLongSkillDescription('a'.repeat(SKILL_DESCRIPTION_CLAMP_CHARS))).toBe(false) - }) - - it('offers the toggle once a description runs past the clamp', () => { - expect(isLongSkillDescription('a'.repeat(SKILL_DESCRIPTION_CLAMP_CHARS + 1))).toBe(true) - }) - - it('ignores surrounding whitespace and missing values', () => { - expect(isLongSkillDescription(` ${'a'.repeat(20)} `)).toBe(false) - expect(isLongSkillDescription(null)).toBe(false) - expect(isLongSkillDescription(undefined)).toBe(false) - }) -}) diff --git a/src/renderer/src/components/status-bar/icons.test.tsx b/src/renderer/src/components/status-bar/icons.test.tsx deleted file mode 100644 index d46d9a65cce..00000000000 --- a/src/renderer/src/components/status-bar/icons.test.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { renderToStaticMarkup } from 'react-dom/server' -import { MiniMaxIcon } from './icons' - -describe('MiniMaxIcon', () => { - it('renders the official MiniMax mark as an image', () => { - const markup = renderToStaticMarkup() - expect(markup.startsWith(' { - const markup = renderToStaticMarkup() - expect(markup).toContain('width="20"') - expect(markup).toContain('height="20"') - }) - - it('does not render the legacy "M" placeholder text', () => { - const markup = renderToStaticMarkup() - expect(markup).not.toContain('>M<') - }) -}) diff --git a/src/renderer/src/components/status-bar/usage-percentage-label.test.ts b/src/renderer/src/components/status-bar/usage-percentage-label.test.ts deleted file mode 100644 index ca69b6d4df4..00000000000 --- a/src/renderer/src/components/status-bar/usage-percentage-label.test.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' - -vi.mock('@/i18n/i18n', () => ({ - translate: (_key: string, fallback: string, values?: Record) => - fallback.replace('{{value0}}', values?.value0 ?? '') -})) - -import { formatBareUsagePercentage, formatUsagePercentageLabel } from './usage-percentage-label' - -describe('formatUsagePercentageLabel', () => { - it('formats used and remaining percentages without changing source semantics', () => { - expect(formatUsagePercentageLabel(8, 'used')).toBe('8% used') - expect(formatUsagePercentageLabel(8, 'remaining')).toBe('92% left') - }) -}) - -describe('formatBareUsagePercentage', () => { - it('drops the used/left word but keeps the chosen display value', () => { - expect(formatBareUsagePercentage(8, 'used')).toBe('8%') - expect(formatBareUsagePercentage(8, 'remaining')).toBe('92%') - }) -}) diff --git a/src/renderer/src/components/task-page-jira-status-catalog.test.ts b/src/renderer/src/components/task-page-jira-status-catalog.test.ts deleted file mode 100644 index 4aeac5532d4..00000000000 --- a/src/renderer/src/components/task-page-jira-status-catalog.test.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { expect, it } from 'vitest' -import { - includeSelectedJiraStatuses, - orderJiraStatusCatalog -} from './task-page-jira-status-catalog' - -it('orders actual workflow statuses by category and name', () => { - expect( - orderJiraStatusCatalog([ - { name: 'Done', categoryKey: 'done' }, - { name: 'Ready', categoryKey: 'indeterminate' }, - { name: 'Open', categoryKey: 'new' }, - { name: 'Blocked', categoryKey: 'indeterminate' } - ]).map((status) => status.name) - ).toEqual(['Open', 'Blocked', 'Ready', 'Done']) -}) -it('keeps selected statuses visible even when a new scope has not loaded them', () => { - expect( - includeSelectedJiraStatuses([{ name: 'Open', categoryKey: 'new' }], ['Open', 'Developed']) - ).toEqual([ - { name: 'Open', categoryKey: 'new' }, - { name: 'Developed', categoryKey: 'other' } - ]) -}) diff --git a/src/renderer/src/components/terminal-pane/terminal-error-remote-closed-localization.test.ts b/src/renderer/src/components/terminal-pane/terminal-error-remote-closed-localization.test.ts deleted file mode 100644 index 51807676c72..00000000000 --- a/src/renderer/src/components/terminal-pane/terminal-error-remote-closed-localization.test.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' - -// Use a non-English catalog to expose mixed-language message/chrome regression (#9194). -vi.mock('@/i18n/i18n', () => ({ - translate: (key: string, fallback: string) => - key === 'auto.components.terminal.pane.TerminalErrorToast.remoteTerminalClosed' - ? '远程终端已关闭。' - : fallback -})) - -import { humanizeTerminalError } from './TerminalErrorToast' - -describe('remote-closed terminal banner localization', () => { - it('translates the remote-closed line instead of pinning it to English', () => { - expect(humanizeTerminalError('Remote terminal was closed.')).toBe('远程终端已关闭。') - }) - - it('translates the line when it is accumulated with other errors', () => { - expect(humanizeTerminalError('Paste failed.\nRemote terminal was closed.')).toBe( - 'Paste failed.\n远程终端已关闭。' - ) - }) -}) diff --git a/src/renderer/src/components/terminal-pane/terminal-link-click-behavior.test.ts b/src/renderer/src/components/terminal-pane/terminal-link-click-behavior.test.ts deleted file mode 100644 index 2ba4a4a24d2..00000000000 --- a/src/renderer/src/components/terminal-pane/terminal-link-click-behavior.test.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { terminalLinkClickBehaviorFor } from './terminal-link-click-behavior' - -describe('terminalLinkClickBehaviorFor', () => { - it('defaults to actions and preserves legacy profiles', () => { - expect(terminalLinkClickBehaviorFor(undefined)).toBe('actions') - expect(terminalLinkClickBehaviorFor({ terminalLinkActionPopoverEnabled: true })).toBe('actions') - expect(terminalLinkClickBehaviorFor({ terminalLinkActionPopoverEnabled: false })).toBe('none') - }) - - it('prefers the explicit behavior for new profiles', () => { - expect( - terminalLinkClickBehaviorFor({ - terminalLinkActionPopoverEnabled: false, - terminalLinkClickBehavior: 'open' - }) - ).toBe('open') - expect(terminalLinkClickBehaviorFor({ terminalLinkClickBehavior: 'none' })).toBe('none') - }) -}) diff --git a/src/renderer/src/components/terminal-pane/terminal-remote-runtime-recovery-ui-state.test.ts b/src/renderer/src/components/terminal-pane/terminal-remote-runtime-recovery-ui-state.test.ts deleted file mode 100644 index 129cdd14e43..00000000000 --- a/src/renderer/src/components/terminal-pane/terminal-remote-runtime-recovery-ui-state.test.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { updateTerminalRemoteRuntimeRecoveryUiState } from './terminal-remote-runtime-recovery-ui-state' - -describe('updateTerminalRemoteRuntimeRecoveryUiState', () => { - it('tracks only recovery phases that need pane UI', () => { - const recovering = updateTerminalRemoteRuntimeRecoveryUiState({}, 7, { - phase: 'recovering', - epoch: 2, - attempt: 1 - }) - - expect(recovering[7]?.phase).toBe('recovering') - expect( - updateTerminalRemoteRuntimeRecoveryUiState(recovering, 7, { - phase: 'connected', - epoch: 2, - attempt: 0 - }) - ).toEqual({}) - }) - - it('drops disconnected state when the owning pane closes', () => { - const disconnected = updateTerminalRemoteRuntimeRecoveryUiState({}, 7, { - phase: 'disconnected', - epoch: 2, - attempt: 4 - }) - - expect(updateTerminalRemoteRuntimeRecoveryUiState(disconnected, 7, null)).toEqual({}) - }) -}) diff --git a/src/renderer/src/hooks/ipc-events/normalize-agent-status-event.test.ts b/src/renderer/src/hooks/ipc-events/normalize-agent-status-event.test.ts deleted file mode 100644 index b3f3c0e2540..00000000000 --- a/src/renderer/src/hooks/ipc-events/normalize-agent-status-event.test.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { normalizeAgentStatusEvent } from './normalize-agent-status-event' - -describe('normalizeAgentStatusEvent', () => { - it('preserves tool-output provenance for native chat gating', () => { - const normalized = normalizeAgentStatusEvent({ - paneKey: 'tab-1:1', - state: 'working', - prompt: 'inspect the failure', - agentType: 'claude', - lastAssistantMessage: 'Exit code 1\nraw output', - lastAssistantMessageIsToolOutput: true, - connectionId: null, - receivedAt: 1, - stateStartedAt: 1 - }) - - expect(normalized?.lastAssistantMessageIsToolOutput).toBe(true) - }) -}) diff --git a/src/renderer/src/i18n/pseudo-localization.test.ts b/src/renderer/src/i18n/pseudo-localization.test.ts index a56dc15de68..d36080926a2 100644 --- a/src/renderer/src/i18n/pseudo-localization.test.ts +++ b/src/renderer/src/i18n/pseudo-localization.test.ts @@ -1,23 +1,9 @@ import { describe, expect, it } from 'vitest' -import { - isPseudoLocalizationLocale, - pseudoLocalizeString, - PSEUDO_LOCALIZATION_LOCALE -} from './pseudo-localization' +import { PSEUDO_LOCALIZATION_LOCALE } from './pseudo-localization' import { i18n, translate } from './i18n' describe('pseudo-localization', () => { - it('wraps strings for the pseudo locale', () => { - expect(pseudoLocalizeString('Language')).toBe('[Language]') - expect(pseudoLocalizeString('[Already wrapped]')).toBe('[Already wrapped]') - }) - - it('recognizes the pseudo locale id', () => { - expect(isPseudoLocalizationLocale(PSEUDO_LOCALIZATION_LOCALE)).toBe(true) - expect(isPseudoLocalizationLocale('en')).toBe(false) - }) - it('applies pseudo wrapping through translate when active', async () => { const previous = i18n.language await i18n.changeLanguage(PSEUDO_LOCALIZATION_LOCALE) diff --git a/src/renderer/src/lib/monaco-languages/register-shell-markdown-aliases.test.ts b/src/renderer/src/lib/monaco-languages/register-shell-markdown-aliases.test.ts deleted file mode 100644 index d977b4322e5..00000000000 --- a/src/renderer/src/lib/monaco-languages/register-shell-markdown-aliases.test.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' -import { registerShellMarkdownAliases } from './register-shell-markdown-aliases' - -function createMonacoMock(aliases: string[] = ['Shell', 'sh']) { - return { - languages: { - getLanguages: vi.fn(() => [{ id: 'shell', aliases }]), - register: vi.fn() - } - } -} - -describe('registerShellMarkdownAliases', () => { - it('registers bash alongside the built-in shell aliases', () => { - const monaco = createMonacoMock() - - registerShellMarkdownAliases(monaco) - - expect(monaco.languages.register).toHaveBeenCalledWith({ - id: 'shell', - aliases: ['Shell', 'sh', 'bash'] - }) - }) - - it('does not register the alias again when Monaco already exposes it', () => { - const monaco = createMonacoMock(['Shell', 'sh', 'Bash']) - - registerShellMarkdownAliases(monaco) - - expect(monaco.languages.register).not.toHaveBeenCalled() - }) -}) diff --git a/src/renderer/src/lib/pane-manager/xterm-instance-disposed.test.ts b/src/renderer/src/lib/pane-manager/xterm-instance-disposed.test.ts index 4dd77fd3ea5..83d340da235 100644 --- a/src/renderer/src/lib/pane-manager/xterm-instance-disposed.test.ts +++ b/src/renderer/src/lib/pane-manager/xterm-instance-disposed.test.ts @@ -10,10 +10,4 @@ describe('isXtermInstanceDisposed', () => { terminal.dispose() expect(isXtermInstanceDisposed(terminal)).toBe(true) }) - - it('answers false for non-terminal shapes', () => { - expect(isXtermInstanceDisposed(null)).toBe(false) - expect(isXtermInstanceDisposed(undefined)).toBe(false) - expect(isXtermInstanceDisposed({})).toBe(false) - }) }) diff --git a/src/renderer/src/lib/settings-navigation-types.test.ts b/src/renderer/src/lib/settings-navigation-types.test.ts deleted file mode 100644 index 93bb5b5c163..00000000000 --- a/src/renderer/src/lib/settings-navigation-types.test.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { isSettingsNavigationTarget } from './settings-navigation-types' - -describe('isSettingsNavigationTarget', () => { - it('accepts a page-level host scope', () => { - expect( - isSettingsNavigationTarget({ - pane: 'accounts', - repoId: null, - hostScope: { kind: 'environment', environmentId: 'linux-box' } - }) - ).toBe(true) - expect( - isSettingsNavigationTarget({ pane: 'accounts', repoId: null, hostScope: { kind: 'local' } }) - ).toBe(true) - }) - - it('rejects a malformed host scope', () => { - for (const hostScope of ['linux-box', { kind: 'environment' }, { kind: 'ssh' }]) { - expect(isSettingsNavigationTarget({ pane: 'accounts', repoId: null, hostScope })).toBe(false) - } - }) -}) diff --git a/src/renderer/src/runtime/native-chat-launch-draft-runtime-resolution.test.ts b/src/renderer/src/runtime/native-chat-launch-draft-runtime-resolution.test.ts deleted file mode 100644 index 205392eebe8..00000000000 --- a/src/renderer/src/runtime/native-chat-launch-draft-runtime-resolution.test.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' -import { applyNativeChatLaunchDraftResolved } from './native-chat-launch-draft-runtime-resolution' - -describe('applyNativeChatLaunchDraftResolved', () => { - it('routes the exact generation to the store action', () => { - const resolveNativeChatLaunchDraft = vi.fn() - - applyNativeChatLaunchDraftResolved( - { resolveNativeChatLaunchDraft }, - { type: 'nativeChatLaunchDraftResolved', tabId: 'tab-1', text: 'seed', createdAt: 7 } - ) - - expect(resolveNativeChatLaunchDraft).toHaveBeenCalledWith('tab-1', { - text: 'seed', - createdAt: 7 - }) - }) -}) diff --git a/src/renderer/src/runtime/sync-runtime-graph/active-group-publication.test.ts b/src/renderer/src/runtime/sync-runtime-graph/active-group-publication.test.ts deleted file mode 100644 index ae3e2d1a292..00000000000 --- a/src/renderer/src/runtime/sync-runtime-graph/active-group-publication.test.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { changedActiveGroups } from './active-group-publication' - -describe('the active groups a graph publication carries', () => { - it('names only the workspaces whose group changed', () => { - expect(changedActiveGroups({ a: 'g1', b: 'g3' }, { a: 'g1', b: 'g2' })).toEqual({ b: 'g3' }) - }) - - it('names a workspace that no longer shows a group as none', () => { - expect(changedActiveGroups({}, { a: 'g1' })).toEqual({ a: null }) - }) - - it('carries nothing when nothing changed', () => { - expect(changedActiveGroups({ a: 'g1' }, { a: 'g1' })).toBeUndefined() - }) -}) diff --git a/src/renderer/src/runtime/worktree-create-base.test.ts b/src/renderer/src/runtime/worktree-create-base.test.ts deleted file mode 100644 index 2ece667beef..00000000000 --- a/src/renderer/src/runtime/worktree-create-base.test.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { resolveWorktreeCreateBaseBranch } from './worktree-create-base' - -describe('resolveWorktreeCreateBaseBranch', () => { - it('uses an explicit Start-from selection', async () => { - await expect( - resolveWorktreeCreateBaseBranch({ - explicitBaseBranch: ' origin/feature ' - }) - ).resolves.toBe('origin/feature') - }) - - it('omits repo defaults so backend create owns base selection', async () => { - await expect( - resolveWorktreeCreateBaseBranch({ - explicitBaseBranch: undefined - }) - ).resolves.toBeUndefined() - }) - - it('omits blank explicit selections', async () => { - await expect( - resolveWorktreeCreateBaseBranch({ - explicitBaseBranch: ' ' - }) - ).resolves.toBeUndefined() - }) -}) diff --git a/src/renderer/src/store/copy-on-write-record.test.ts b/src/renderer/src/store/copy-on-write-record.test.ts deleted file mode 100644 index 79c351e63fe..00000000000 --- a/src/renderer/src/store/copy-on-write-record.test.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { copyOnWriteRecord } from './copy-on-write-record' - -describe('copyOnWriteRecord', () => { - it('returns the source untouched when nothing is written', () => { - const source = { a: 1 } - const record = copyOnWriteRecord(source) - record.delete('missing') - expect(record.read()).toBe(source) - expect(source).toEqual({ a: 1 }) - }) - - it('clones once and never mutates the source', () => { - const source = { a: 1, b: 2 } - const record = copyOnWriteRecord(source) - record.set('c', 3) - const afterFirstWrite = record.read() - record.delete('a') - expect(record.read()).toBe(afterFirstWrite) - expect(record.read()).toEqual({ b: 2, c: 3 }) - expect(source).toEqual({ a: 1, b: 2 }) - }) - - it('deletes a key added after the clone', () => { - const record = copyOnWriteRecord({}) - record.set('a', 1) - record.delete('a') - expect(record.read()).toEqual({}) - }) -}) diff --git a/src/renderer/src/store/slices/worktrees/create/worktree-create-payload-creation-id.test.ts b/src/renderer/src/store/slices/worktrees/create/worktree-create-payload-creation-id.test.ts deleted file mode 100644 index 10ee00423e9..00000000000 --- a/src/renderer/src/store/slices/worktrees/create/worktree-create-payload-creation-id.test.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { afterEach, describe, expect, it, vi } from 'vitest' - -const request = { - repoId: 'repo-1', - name: 'feature', - setupDecision: 'inherit', - creationId: 'creation-1' -} as const - -async function runtimeParams(switchedOn: boolean): Promise> { - vi.resetModules() - vi.doMock('../../../../../../shared/sidebar-inputs-switch', () => ({ - ORCA_SIDEBAR_INPUTS_IS_MAIN: switchedOn - })) - const { buildRuntimeWorktreeCreateParams } = await import('./worktree-create-payload') - return buildRuntimeWorktreeCreateParams(request, { name: request.name }) -} - -describe('the creation id sent to a paired server', () => { - afterEach(() => { - vi.doUnmock('../../../../../../shared/sidebar-inputs-switch') - }) - - it('rides the request only when main produces the sidebar inputs', async () => { - expect(await runtimeParams(true)).toMatchObject({ creationId: 'creation-1' }) - expect(await runtimeParams(false)).not.toHaveProperty('creationId') - }) -}) diff --git a/src/renderer/src/store/slices/worktrees/teardown/record-key-omission.test.ts b/src/renderer/src/store/slices/worktrees/teardown/record-key-omission.test.ts deleted file mode 100644 index 7c7dcee026a..00000000000 --- a/src/renderer/src/store/slices/worktrees/teardown/record-key-omission.test.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { omitRecordKeys } from './record-key-omission' - -describe('omitRecordKeys', () => { - it('returns the same record when none of the keys are present', () => { - const record = { a: 1 } - expect(omitRecordKeys(record, ['b', 'c'])).toBe(record) - expect(omitRecordKeys(record, new Set())).toBe(record) - }) - - it('copies once and drops every present key', () => { - const record = { a: 1, b: 2, c: 3 } - const next = omitRecordKeys(record, new Set(['a', 'c', 'missing'])) - expect(next).not.toBe(record) - expect(next).toEqual({ b: 2 }) - expect(record).toEqual({ a: 1, b: 2, c: 3 }) - }) - - it('drops a key whose value is undefined', () => { - expect(omitRecordKeys({ a: undefined }, ['a'])).toEqual({}) - }) - - it('normalizes a missing record to an empty one, as spread-then-delete did', () => { - expect(omitRecordKeys(undefined, ['a'])).toEqual({}) - }) -}) diff --git a/src/renderer/src/web/preload-api/web-gitlab-api.test.ts b/src/renderer/src/web/preload-api/web-gitlab-api.test.ts deleted file mode 100644 index a52729a139c..00000000000 --- a/src/renderer/src/web/preload-api/web-gitlab-api.test.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { beforeEach, describe, expect, it, vi } from 'vitest' - -const callRuntimeResult = vi.hoisted(() => vi.fn()) - -vi.mock('./web-runtime-calls', () => ({ callRuntimeResult })) - -import { createGitLabApi } from './web-gitlab-api' - -describe('web GitLab API routing', () => { - beforeEach(() => { - callRuntimeResult.mockReset().mockResolvedValue(null) - }) - - it('does not forward the desktop repo-owner guard over runtime RPC', async () => { - await createGitLabApi().workItemDetails({ - repoPath: '/workspace/repo', - repoId: 'repo-1', - repoOwnerExecutionHostId: 'ssh:ssh-1', - iid: 42, - type: 'mr' - }) - - expect(callRuntimeResult).toHaveBeenCalledWith('gitlab.workItemDetails', { - repo: 'id:repo-1', - repoId: 'repo-1', - repoPath: '/workspace/repo', - iid: 42, - type: 'mr' - }) - }) -}) diff --git a/src/renderer/src/web/web-shell-paths-exist.test.ts b/src/renderer/src/web/web-shell-paths-exist.test.ts deleted file mode 100644 index dc0819afa7d..00000000000 --- a/src/renderer/src/web/web-shell-paths-exist.test.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' - -vi.mock('./preload-api/web-runtime-worktree-catalog', () => ({ - resolveRuntimeFilePath: vi.fn(async (path: string) => { - if (path.includes('missing')) { - throw new Error('not found') - } - return path - }) -})) - -describe('web shell path existence', () => { - it('defines pathsExist so withFallback cannot substitute an undefined-returning proxy', async () => { - const { createShellApi } = await import('./preload-api/web-shell-api') - const { withFallback } = await import('./preload-api/web-fallback-api') - const shell = withFallback(createShellApi(), ['shell']) - expect(shell.pathsExist).toBeTypeOf('function') - const values = await shell.pathsExist?.(['/repo/present.ts', '/repo/missing.ts']) - expect(values).toEqual([true, false]) - }) -}) diff --git a/src/shared/serve-option-validation.test.ts b/src/shared/serve-option-validation.test.ts index 70473c57477..d43243c3fb0 100644 --- a/src/shared/serve-option-validation.test.ts +++ b/src/shared/serve-option-validation.test.ts @@ -1,35 +1,5 @@ import { describe, expect, it } from 'vitest' -import { getServeFlagTypoError, getServeOptionValidationError } from './serve-option-validation' - -const validOptions = { - noPairing: false, - mobilePairing: false, - recipeJson: false, - projectRoot: null -} - -describe('getServeOptionValidationError', () => { - it('accepts compatible options', () => { - expect(getServeOptionValidationError(validOptions)).toBeNull() - }) - - it.each([ - [{ noPairing: true, mobilePairing: true }, /either --mobile-pairing or --no-pairing/i], - [ - { recipeJson: true, noPairing: true, projectRoot: '/tmp/repo' }, - /requires runtime pairing.*--no-pairing/i - ], - [ - { recipeJson: true, mobilePairing: true, projectRoot: '/tmp/repo' }, - /requires runtime pairing.*--mobile-pairing/i - ], - [{ recipeJson: true }, /requires --project-root/i] - ])('rejects incompatible options', (override, expected) => { - expect( - getServeOptionValidationError({ ...validOptions, ...override } as typeof validOptions) - ).toMatch(expected) - }) -}) +import { getServeFlagTypoError } from './serve-option-validation' describe('getServeFlagTypoError', () => { it('accepts exact serve flags and arbitrary Chromium switches', () => { diff --git a/src/shared/sidebar-list/sort-settle.test.ts b/src/shared/sidebar-list/sort-settle.test.ts index 80f93ed603b..f5ac5d592c4 100644 --- a/src/shared/sidebar-list/sort-settle.test.ts +++ b/src/shared/sidebar-list/sort-settle.test.ts @@ -51,12 +51,6 @@ describe('reduceSortSettle', () => { }) }) - it('settles Manual and mode switches without waiting', () => { - for (const modes of [{ sortBy: 'manual' }, { previousSortBy: 'smart' }] as const) { - expect(reduceSortSettle(settled, write(modes), 0)).toEqual({ state: settled, settle: true }) - } - }) - it('retires a pending deadline when a write lands settled', () => { const pending = reduceSortSettle(settled, write({}), 0).state const reset = reduceSortSettle(pending, write({ change: null, settled: true }), 10) diff --git a/src/shared/skill-install-failure.test.ts b/src/shared/skill-install-failure.test.ts index a5da6899aa7..552f51112cb 100644 --- a/src/shared/skill-install-failure.test.ts +++ b/src/shared/skill-install-failure.test.ts @@ -2,26 +2,10 @@ import { describe, expect, it } from 'vitest' import { SKILL_INSTALL_BUSY_FAILURE, SKILL_INSTALL_CANCELLED_FAILURE, - SkillInstallFailureCategorySchema, - SkillInstallFailureSchema, - classifySkillInstallFailureCode + SkillInstallFailureSchema } from './skill-install-failure' describe('skill install failure contract', () => { - it('freezes every V1 failure category', () => { - expect(SkillInstallFailureCategorySchema.options).toEqual([ - 'admission', - 'transport', - 'archive', - 'filesystem', - 'conflict', - 'recovery', - 'provider-placement', - 'compatibility', - 'cancelled' - ]) - }) - it('keeps retryability explicit and rejects unstable codes', () => { expect(SkillInstallFailureSchema.parse(SKILL_INSTALL_BUSY_FAILURE).retryable).toBe(true) expect(SkillInstallFailureSchema.parse(SKILL_INSTALL_CANCELLED_FAILURE).category).toBe( @@ -35,18 +19,4 @@ describe('skill install failure contract', () => { }) ).toThrow() }) - - it.each([ - ['skill-install-workspace-required', 'admission'], - ['skill-download-transport-failed', 'transport'], - ['skill-package-tar-truncated', 'archive'], - ['skill-install-busy', 'filesystem'], - ['skill-install-conflict-modified', 'conflict'], - ['skill-install-recovery-conflict', 'recovery'], - ['skill-placement-create-failed', 'provider-placement'], - ['skill-install-ssh-update-required', 'compatibility'], - ['skill-install-cancelled', 'cancelled'] - ] as const)('classifies %s as %s', (code, category) => { - expect(classifySkillInstallFailureCode(code)?.category).toBe(category) - }) }) diff --git a/src/shared/ssh-pty-id.test.ts b/src/shared/ssh-pty-id.test.ts index 752f9068a35..1145990a796 100644 --- a/src/shared/ssh-pty-id.test.ts +++ b/src/shared/ssh-pty-id.test.ts @@ -7,16 +7,6 @@ describe('ssh pty id routing', () => { const HOST_ID = toSshExecutionHostId(CONNECTION) // "ssh:ssh-1779863656395-57g1q1" const APP_ID = toAppSshPtyId(CONNECTION, 'pty-3') // "ssh:ssh-1779863656395-57g1q1@@pty-3" - it('encodes the bare target id into the app pty id', () => { - expect(APP_ID).toBe('ssh:ssh-1779863656395-57g1q1@@pty-3') - expect(parseAppSshPtyId(APP_ID)).toEqual({ connectionId: CONNECTION, relayPtyId: 'pty-3' }) - }) - - it('round-trips app <-> relay ids for the matching bare connection', () => { - expect(toRelaySshPtyId(CONNECTION, APP_ID)).toBe('pty-3') - expect(toAppSshPtyId(CONNECTION, APP_ID)).toBe(APP_ID) - }) - // Reconnect callers may supply workspace hostId (ssh:); it must route identically to the bare target ID. it('accepts the execution-host id form as the same connection', () => { expect(toRelaySshPtyId(HOST_ID, APP_ID)).toBe('pty-3') diff --git a/src/shared/ssh-target-generation.test.ts b/src/shared/ssh-target-generation.test.ts index 8b9969dd522..20fb58bb199 100644 --- a/src/shared/ssh-target-generation.test.ts +++ b/src/shared/ssh-target-generation.test.ts @@ -1,24 +1,9 @@ import { describe, expect, it } from 'vitest' import { nextSshTargetGeneration, - resolveSshTargetGenerationHighWaterMark, - sanitizeSshTargetGeneration + resolveSshTargetGenerationHighWaterMark } from './ssh-target-generation' -describe('sanitizeSshTargetGeneration', () => { - it.each([0, -1, 1.5, Number.NaN, Number.POSITIVE_INFINITY, '3', null, undefined, {}])( - 'rejects %p', - (value) => { - expect(sanitizeSshTargetGeneration(value)).toBeUndefined() - } - ) - - it('accepts issued generations', () => { - expect(sanitizeSshTargetGeneration(1)).toBe(1) - expect(sanitizeSshTargetGeneration(42)).toBe(42) - }) -}) - describe('resolveSshTargetGenerationHighWaterMark', () => { it('never reissues a generation an automation already captured', () => { // A rolled-back counter cannot reissue an automation’s captured generation. diff --git a/src/shared/stable-pane-id.test.ts b/src/shared/stable-pane-id.test.ts index 9c77a95539b..1a2d07dcffb 100644 --- a/src/shared/stable-pane-id.test.ts +++ b/src/shared/stable-pane-id.test.ts @@ -1,38 +1,9 @@ import { describe, expect, it } from 'vitest' -import { - isStablePaneId, - isTerminalLeafId, - makePaneKey, - parseLegacyNumericPaneKey, - parsePaneKey -} from './stable-pane-id' +import { makePaneKey, parseLegacyNumericPaneKey, parsePaneKey } from './stable-pane-id' const LEAF_ID = '11111111-1111-4111-8111-111111111111' describe('stable pane ids', () => { - it('recognizes UUID leaf ids as stable pane ids', () => { - expect(isStablePaneId(LEAF_ID)).toBe(true) - expect(isTerminalLeafId(LEAF_ID)).toBe(true) - }) - - it('rejects legacy numeric pane ids and malformed UUIDs', () => { - for (const value of ['1', 'pane:1', '11111111-1111-6111-8111-111111111111', '']) { - expect(isStablePaneId(value)).toBe(false) - expect(isTerminalLeafId(value)).toBe(false) - } - }) - - it('builds and parses pane keys using the tab id and UUID leaf id', () => { - const paneKey = makePaneKey('tab-1', LEAF_ID) - - expect(paneKey).toBe(`tab-1:${LEAF_ID}`) - expect(parsePaneKey(paneKey)).toEqual({ - tabId: 'tab-1', - leafId: LEAF_ID, - stablePaneId: LEAF_ID - }) - }) - it('rejects ambiguous tab ids and non-UUID leaf ids when building keys', () => { expect(() => makePaneKey('', LEAF_ID)).toThrow(/tabId/) expect(() => makePaneKey('tab:1', LEAF_ID)).toThrow(/tabId/) diff --git a/src/shared/startup-command-submission.test.ts b/src/shared/startup-command-submission.test.ts index 1caa3a08ad1..e4889e89dc4 100644 --- a/src/shared/startup-command-submission.test.ts +++ b/src/shared/startup-command-submission.test.ts @@ -1,15 +1,7 @@ import { describe, expect, it } from 'vitest' -import { - buildStartupCommandSubmission, - isBracketedPasteSafeShell -} from './startup-command-submission' +import { buildStartupCommandSubmission } from './startup-command-submission' describe('buildStartupCommandSubmission', () => { - it('submits a single-line command with CR', () => { - expect(buildStartupCommandSubmission('claude', { bracketedPasteSafe: true })).toBe('claude\r') - expect(buildStartupCommandSubmission('claude', { bracketedPasteSafe: false })).toBe('claude\r') - }) - it('replaces a caller-supplied trailing terminator with CR', () => { for (const command of ['claude\n', 'claude\r', 'claude\r\n']) { expect(buildStartupCommandSubmission(command, { bracketedPasteSafe: true })).toBe('claude\r') @@ -30,12 +22,6 @@ describe('buildStartupCommandSubmission', () => { ) }) - it('keeps the raw path for multiline commands when bracketed paste is unsafe', () => { - expect(buildStartupCommandSubmission('echo one\necho two', { bracketedPasteSafe: false })).toBe( - 'echo one\recho two\r' - ) - }) - // Interior LF is remappable Ctrl+J too; every raw line must submit with CR (#23250). it('submits every line of a raw multiline command with CR', () => { for (const command of ['echo one\necho two', 'echo one\r\necho two', 'echo one\recho two']) { @@ -45,22 +31,3 @@ describe('buildStartupCommandSubmission', () => { } }) }) - -describe('isBracketedPasteSafeShell', () => { - it('always trusts bash and zsh', () => { - for (const shellName of ['bash', 'zsh', 'BASH']) { - expect(isBracketedPasteSafeShell({ shellName, waitsForShellReady: false })).toBe(true) - } - }) - - it('trusts fish only behind the shell-ready barrier', () => { - expect(isBracketedPasteSafeShell({ shellName: 'fish', waitsForShellReady: true })).toBe(true) - expect(isBracketedPasteSafeShell({ shellName: 'fish', waitsForShellReady: false })).toBe(false) - }) - - it('rejects shells with no known bracketed-paste line editor', () => { - for (const shellName of ['sh', 'dash', 'nu', 'powershell.exe', '']) { - expect(isBracketedPasteSafeShell({ shellName, waitsForShellReady: true })).toBe(false) - } - }) -}) diff --git a/src/shared/structured-agent-session-draft-hand-off.spec.ts b/src/shared/structured-agent-session-draft-hand-off.spec.ts deleted file mode 100644 index 6fe11eeb1ce..00000000000 --- a/src/shared/structured-agent-session-draft-hand-off.spec.ts +++ /dev/null @@ -1,36 +0,0 @@ -// Match queued drafts through queuedMessageId, never by comparing draft and submission IDs. - -import { describe, expect, it } from 'vitest' -import type { AgentJournalSubmission } from './agent-session-journal-types' -import { handedOffQueuedMessageIds } from './structured-agent-session-draft-hand-off' - -function handOff( - dispatchState: AgentJournalSubmission['dispatchState'], - queuedMessageId?: string -): AgentJournalSubmission { - return { - clientMessageId: 'hand-off', - fence: 1, - payloadFingerprint: 'fingerprint', - dispatchState, - providerItemId: null, - reason: dispatchState === 'rejected' ? 'refused' : null, - submittedAt: 10, - resolvedAt: null, - ...(queuedMessageId !== undefined ? { queuedMessageId } : {}) - } -} - -describe('a queued draft handed off under a fresh submission id', () => { - it('is handed off in every dispatch state', () => { - for (const state of ['pending', 'accepted', 'rejected', 'unknown'] as const) { - expect(handedOffQueuedMessageIds([handOff(state, 'draft')])).toEqual(new Set(['draft'])) - } - }) - - it('is never matched by the submission id itself', () => { - const ids = handedOffQueuedMessageIds([handOff('pending', 'draft'), handOff('accepted')]) - expect(ids.has('hand-off')).toBe(false) - expect([...ids]).toEqual(['draft']) - }) -}) diff --git a/src/shared/structured-agent-session-mutation.spec.ts b/src/shared/structured-agent-session-mutation.spec.ts index 44096d32161..ea92d8f0fd6 100644 --- a/src/shared/structured-agent-session-mutation.spec.ts +++ b/src/shared/structured-agent-session-mutation.spec.ts @@ -1,8 +1,5 @@ import { describe, expect, it } from 'vitest' -import { - structuredAgentSessionDomainFingerprint, - structuredAgentSessionPayloadFingerprint -} from './structured-agent-session-mutation' +import { structuredAgentSessionPayloadFingerprint } from './structured-agent-session-mutation' import { computeAgentSessionPayloadFingerprint } from './agent-session-mutation-envelope' describe('structured agent session client mutations', () => { @@ -33,22 +30,4 @@ describe('structured agent session client mutations', () => { computeAgentSessionPayloadFingerprint(input) ) }) - - it('preserves the digest when a local fingerprint domain is not an RPC method', () => { - const fields = { text: 'hello' } - - expect( - structuredAgentSessionDomainFingerprint({ - domain: 'mobile.agentSession.send.intent', - sessionId: 'session-1', - fields - }) - ).toBe( - structuredAgentSessionPayloadFingerprint({ - method: 'mobile.agentSession.send.intent', - sessionId: 'session-1', - fields - }) - ) - }) }) diff --git a/src/shared/structured-agent-session-send-settlement.spec.ts b/src/shared/structured-agent-session-send-settlement.spec.ts deleted file mode 100644 index 7607120ae54..00000000000 --- a/src/shared/structured-agent-session-send-settlement.spec.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { describe, expect, it } from 'vitest' -import type { AgentJournalSubmission } from './agent-session-journal-types' -import { structuredAgentSessionSettledSends } from './structured-agent-session-send-settlement' - -function submission(clientMessageId: string, queuedMessageId?: string): AgentJournalSubmission { - return { - clientMessageId, - ...(queuedMessageId ? { queuedMessageId } : {}), - fence: 1, - payloadFingerprint: clientMessageId, - dispatchState: 'accepted', - providerItemId: null, - reason: null, - submittedAt: 1, - resolvedAt: 1 - } -} - -describe('structuredAgentSessionSettledSends', () => { - it('reads a send as a card while queued or once handed off, else as recorded under its id', () => { - const handOff = submission('hand-off', 'was-queued') - const sent = submission('sent') - const { cards, recorded } = structuredAgentSessionSettledSends([handOff, sent], ['on-queue']) - expect([...cards]).toEqual(['on-queue', 'was-queued']) - expect(recorded.get('sent')).toBe(sent) - expect(recorded.get('hand-off')).toBe(handOff) - expect(recorded.has('on-queue')).toBe(false) - }) -}) diff --git a/src/shared/structured-session-message-contracts.test.ts b/src/shared/structured-session-message-contracts.test.ts index bc747dd2a31..b1627b3ec39 100644 --- a/src/shared/structured-session-message-contracts.test.ts +++ b/src/shared/structured-session-message-contracts.test.ts @@ -4,9 +4,7 @@ import './structured-agent-session-unknown-item.spec' import './structured-session-foreground-commands.spec' import './structured-agent-session-first-prompt.spec' import './agent-session-journal-submission-schema.spec' -import './structured-agent-session-send-settlement.spec' import './structured-agent-session-projection-sender.spec' -import './structured-agent-session-draft-hand-off.spec' import './structured-agent-session-mutation.spec' import './structured-agent-session-option-codec.spec' import './structured-agent-session-first-frame-picker.spec' diff --git a/src/shared/terminal-custom-themes.test.ts b/src/shared/terminal-custom-themes.test.ts index 46dc08d3189..b4a82f34a53 100644 --- a/src/shared/terminal-custom-themes.test.ts +++ b/src/shared/terminal-custom-themes.test.ts @@ -1,10 +1,5 @@ import { describe, expect, it } from 'vitest' -import { - makeCustomTerminalThemeSelection, - normalizeTerminalCustomThemes, - normalizeTerminalHexColor, - parseCustomTerminalThemeSelection -} from './terminal-custom-themes' +import { normalizeTerminalCustomThemes } from './terminal-custom-themes' describe('terminal custom themes', () => { it('normalizes colors and drops invalid theme records', () => { @@ -80,14 +75,4 @@ describe('terminal custom themes', () => { ]) ).toEqual([]) }) - - it('round-trips custom selection values', () => { - expect(makeCustomTerminalThemeSelection('warp:tokyo-night')).toBe('custom:warp:tokyo-night') - expect(parseCustomTerminalThemeSelection('custom:warp:tokyo-night')).toBe('warp:tokyo-night') - expect(parseCustomTerminalThemeSelection('Builtin Tango Light')).toBeNull() - }) - - it('expands short hex colors', () => { - expect(normalizeTerminalHexColor('abc')).toBe('#aabbcc') - }) }) diff --git a/src/shared/terminal-escape-introducer.test.ts b/src/shared/terminal-escape-introducer.test.ts deleted file mode 100644 index 71e719e06fe..00000000000 --- a/src/shared/terminal-escape-introducer.test.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - classifyTerminalEscapeIntroducer, - type TerminalEscapeIntroducer -} from './terminal-escape-introducer' - -/** Derive the oracle independently from VT500 byte ranges so implementation branch errors remain visible. */ -function expected(code: number): TerminalEscapeIntroducer { - if ('[' === String.fromCharCode(code)) { - return 'csi' - } - if (']' === String.fromCharCode(code)) { - return 'osc' - } - if ('PX^_'.includes(String.fromCharCode(code))) { - return 'string' - } - if (String.fromCharCode(code) >= ' ' && String.fromCharCode(code) <= '/') { - return 'intermediate' - } - if (code < 0x20 || code === 0x7f) { - return 'execute' - } - return 'final' -} - -describe('terminal escape introducer', () => { - it('classifies every single-byte introducer the way the VT500 table does', () => { - for (let code = 0; code <= 0xff; code += 1) { - expect([code, classifyTerminalEscapeIntroducer(code)]).toEqual([code, expected(code)]) - } - }) - - it('opens ST-terminated strings for DCS, SOS, PM and APC only', () => { - const strings = Array.from({ length: 0x100 }, (_, code) => code).filter( - (code) => classifyTerminalEscapeIntroducer(code) === 'string' - ) - expect(strings.map((code) => String.fromCharCode(code))).toEqual(['P', 'X', '^', '_']) - }) - - it('reads a missing byte (ESC at end of input) as a completed two-byte sequence', () => { - // `charCodeAt` past the end is NaN; callers rely on that not becoming csi/osc/string. - expect(classifyTerminalEscapeIntroducer(''.charCodeAt(0))).toBe('final') - }) -}) diff --git a/src/shared/terminal-pane-placement.test.ts b/src/shared/terminal-pane-placement.test.ts index 1ff106cf846..1f83a35ec32 100644 --- a/src/shared/terminal-pane-placement.test.ts +++ b/src/shared/terminal-pane-placement.test.ts @@ -5,13 +5,6 @@ const LEAF = '11111111-1111-4111-8111-111111111111' const OTHER_LEAF = '22222222-2222-4222-8222-222222222222' describe('parseTerminalPanePlacement', () => { - it('accepts each kind', () => { - const split = { kind: 'split', parentLeafId: LEAF, direction: 'vertical' } - expect(parseTerminalPanePlacement({ kind: 'new-tab' })).toEqual({ kind: 'new-tab' }) - expect(parseTerminalPanePlacement(split)).toEqual(split) - expect(parseTerminalPanePlacement({ kind: 'root' })).toEqual({ kind: 'root' }) - }) - it('keeps a new tab row and a split ratio and proposed tree', () => { const newTab = { kind: 'new-tab', diff --git a/src/shared/terminal-reply-query-extraction.test.ts b/src/shared/terminal-reply-query-extraction.test.ts index 1d42e0df997..43d4a401a45 100644 --- a/src/shared/terminal-reply-query-extraction.test.ts +++ b/src/shared/terminal-reply-query-extraction.test.ts @@ -1,27 +1,9 @@ import { describe, expect, it } from 'vitest' import { containsStatefulRendererQuery, - extractHiddenStartupRendererQueryData, - findCsiFinalByteIndex + extractHiddenStartupRendererQueryData } from './terminal-reply-query-extraction' -describe('findCsiFinalByteIndex', () => { - it('returns the final byte of a complete CSI', () => { - expect(findCsiFinalByteIndex('\x1b[38;2;1;2;3m', 2)).toBe(12) - }) - - it('keeps a CSI with no final byte open', () => { - expect(findCsiFinalByteIndex('\x1b[38;2;177;1', 2)).toBe(-1) - }) - - it('ends a CSI where ESC, CAN or SUB aborts it, as xterm does', () => { - // Why: without the abort, the `]` of the next OSC read as this CSI's final byte. - expect(findCsiFinalByteIndex('\x1b[38;2;177;1\x1b]104;255\x07', 2)).toBe(11) - expect(findCsiFinalByteIndex('\x1b[38;2\x18A', 2)).toBe(5) - expect(findCsiFinalByteIndex('\x1b[38;2\x1aA', 2)).toBe(5) - }) -}) - describe('reply query extraction after an aborted CSI', () => { it('finds a CPR that follows a carried partial CSI', () => { const result = extractHiddenStartupRendererQueryData('\x1b[6n', '\x1b[38;2;177;1') diff --git a/src/shared/terminal-stream-json-byte-length.test.ts b/src/shared/terminal-stream-json-byte-length.test.ts index 81b9830b2d7..954652996ed 100644 --- a/src/shared/terminal-stream-json-byte-length.test.ts +++ b/src/shared/terminal-stream-json-byte-length.test.ts @@ -35,12 +35,4 @@ describe('the JSON size of a terminal payload', () => { Buffer.byteLength(JSON.stringify(mixed), 'utf8') ) }) - - it('costs an ANSI snapshot far more than its text, which is the whole reason it exists', () => { - // Raw text fits the desktop budget while its escaped JSON can exceed the bridge frame cap. - const screen = '\u001b[38;5;196m#'.repeat(20_000) - expect(terminalStreamJsonByteLength(screen)).toBeGreaterThan( - Buffer.byteLength(screen, 'utf8') * 1.4 - ) - }) }) diff --git a/src/shared/terminal-theme-selection.test.ts b/src/shared/terminal-theme-selection.test.ts index d661336ed59..f245cfe158b 100644 --- a/src/shared/terminal-theme-selection.test.ts +++ b/src/shared/terminal-theme-selection.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import { resolveConfiguredTerminalColors, selectTerminalTheme } from './terminal-theme-selection' +import { resolveConfiguredTerminalColors } from './terminal-theme-selection' import { TERMINAL_THEME_CATALOG } from './terminal-themes' const base = { @@ -43,10 +43,4 @@ describe('the terminal colours a host configures', () => { resolveConfiguredTerminalColors({ ...base, terminalThemeDark: 'no such theme' }, true) ).toEqual({ foreground: '#ffffff', background: '#282c34' }) }) - - it('keeps using the dark theme in light mode when no separate light theme is set', () => { - expect( - selectTerminalTheme({ ...base, theme: 'light', terminalUseSeparateLightTheme: false }, true) - ).toEqual({ mode: 'light', useLightVariant: false, themeName: 'Ghostty Default Style Dark' }) - }) }) diff --git a/src/shared/terminal-wait-blocked-reason-legacy-alias.test.ts b/src/shared/terminal-wait-blocked-reason-legacy-alias.test.ts deleted file mode 100644 index ca02824d03a..00000000000 --- a/src/shared/terminal-wait-blocked-reason-legacy-alias.test.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - agentNeutralTerminalWaitBlockedReason, - describeTerminalWaitBlockedReason -} from './terminal-wait-blocked-reason-legacy-alias' -import type { RuntimeTerminalWaitBlockedReason } from './runtime-terminal-contracts' - -describe('agentNeutralTerminalWaitBlockedReason', () => { - it.each([ - ['codex-update-prompt', 'agent-update-prompt'], - ['codex-trust-workspace', 'agent-trust-workspace'], - ['codex-cwd-prompt', 'agent-cwd-prompt'], - ['codex-hooks-review-prompt', 'agent-hooks-review-prompt'], - ['codex-interactive-prompt', 'agent-interactive-prompt'] - ] as const)('renames %s published by an older host to %s', (legacy, neutral) => { - expect(agentNeutralTerminalWaitBlockedReason(legacy)).toBe(neutral) - }) - - // This build still publishes the Codex-specific migration reason; aliasing would rename a live reason, not interpret an old host. - it('leaves the agent-specific codex-model-migration-prompt alone', () => { - expect(agentNeutralTerminalWaitBlockedReason('codex-model-migration-prompt')).toBeNull() - }) - - it.each(['agent-approval-prompt', 'agent-trust-workspace', 'agent-hooks-review-prompt'] as const)( - 'reports no alias for the already-neutral %s', - (reason) => { - expect(agentNeutralTerminalWaitBlockedReason(reason)).toBeNull() - } - ) - - // Wire tokens are unvalidated; prototype keys must not resolve to Object.prototype functions. - it.each(['constructor', 'toString', 'valueOf', '__proto__', 'hasOwnProperty'])( - 'reports no alias for the prototype key %s', - (reason) => { - expect( - agentNeutralTerminalWaitBlockedReason(reason as RuntimeTerminalWaitBlockedReason) - ).toBeNull() - } - ) -}) - -// Share neutral rendering across CLI wait/show and worker/federation startup-blocked receipts. -describe('describeTerminalWaitBlockedReason', () => { - it('names the neutral spelling beside a legacy token', () => { - expect(describeTerminalWaitBlockedReason('codex-trust-workspace')).toBe( - 'codex-trust-workspace (agent-trust-workspace)' - ) - }) - - it.each(['agent-trust-workspace', 'codex-model-migration-prompt'] as const)( - 'renders %s unannotated', - (reason) => { - expect(describeTerminalWaitBlockedReason(reason)).toBe(reason) - } - ) -}) diff --git a/src/shared/test-code-path.test.ts b/src/shared/test-code-path.test.ts index 778158c47a7..8394625ab5d 100644 --- a/src/shared/test-code-path.test.ts +++ b/src/shared/test-code-path.test.ts @@ -52,10 +52,4 @@ describe('isTestCodePath', () => { expect(isTestCodePath('src/cli/specs/account.test.ts')).toBe(true) expect(isTestCodePath('spec/models/user_spec.rb')).toBe(true) }) - - it('handles a bare filename and an empty path without throwing', () => { - expect(isTestCodePath('chip.test.ts')).toBe(true) - expect(isTestCodePath('chip.ts')).toBe(false) - expect(isTestCodePath('')).toBe(false) - }) }) diff --git a/src/shared/tui-agent-fork-startup.spec.ts b/src/shared/tui-agent-fork-startup.spec.ts index e56b5b0892b..e40ef1a2981 100644 --- a/src/shared/tui-agent-fork-startup.spec.ts +++ b/src/shared/tui-agent-fork-startup.spec.ts @@ -1,35 +1,9 @@ import { describe, expect, it } from 'vitest' -import { agentForksConversations, getAgentForkArgv } from './agent-resume-argv' import { buildAgentResumeStartupPlan } from './tui-agent-startup' const SESSION = { key: 'session_id', id: 's1' } as const describe('agent fork startup', () => { - it('forks with each CLI that can copy a conversation', () => { - expect(getAgentForkArgv('grok', SESSION)).toEqual(['grok', '--resume', 's1', '--fork-session']) - expect(getAgentForkArgv('pi', { ...SESSION, transcriptPath: '/s/a.jsonl' })).toEqual([ - 'pi', - '--fork', - '/s/a.jsonl' - ]) - expect(getAgentForkArgv('pi', SESSION)).toBeNull() - expect(getAgentForkArgv('opencode', SESSION)).toBeNull() - expect(getAgentForkArgv('omp', SESSION)).toBeNull() - expect(agentForksConversations('constructor')).toBe(false) - }) - - it('forks Claude and Codex', () => { - expect(getAgentForkArgv('claude', SESSION)).toEqual([ - 'claude', - '--resume', - 's1', - '--fork-session' - ]) - expect(getAgentForkArgv('codex', SESSION)).toEqual(['codex', 'fork', 's1']) - expect(getAgentForkArgv('gemini', SESSION)).toBeNull() - expect(getAgentForkArgv('claude', { key: 'conversation_id', id: 's1' })).toBeNull() - }) - it('builds a Claude fork plan that replaces a stored resume selector', () => { const plan = buildAgentResumeStartupPlan({ agent: 'claude', diff --git a/src/shared/tui-agent-prompt-transport.spec.ts b/src/shared/tui-agent-prompt-transport.spec.ts index 7bb1b814399..736b05d1ea3 100644 --- a/src/shared/tui-agent-prompt-transport.spec.ts +++ b/src/shared/tui-agent-prompt-transport.spec.ts @@ -21,18 +21,6 @@ function planFor(agent: TuiAgent) { describe('the prompt-transport predicate against the plan it predicts', () => { // An empty agent list would make the contract vacuously pass. - it('covers every configured agent', () => { - expect(ALL_AGENTS.length).toBeGreaterThan(30) - expect(ALL_AGENTS).toContain('claude') - expect(ALL_AGENTS).toContain('aider') - }) - - it.each(ALL_AGENTS)('agrees with the built plan for %s', (agent) => { - const plan = planFor(agent) - expect(plan).not.toBeNull() - // The pre-launch predicate must agree with the built plan’s null followupPrompt. - expect(plan!.followupPrompt === null).toBe(agentPromptRidesLaunchCommand(agent)) - }) it('puts the prompt in the launch command exactly when it says it does', () => { for (const agent of ALL_AGENTS) { @@ -50,13 +38,4 @@ describe('the prompt-transport predicate against the plan it predicts', () => { expect(carried, `${agent} claims its launch command carries the prompt`).toBe(true) } }) - - it('splits the table into both halves, so neither branch is untested', () => { - const folded = ALL_AGENTS.filter(agentPromptRidesLaunchCommand) - const written = ALL_AGENTS.filter((agent) => !agentPromptRidesLaunchCommand(agent)) - expect(folded.length).toBeGreaterThan(0) - expect(written.length).toBeGreaterThan(0) - expect(folded).toContain('claude') - expect(written).toContain('aider') - }) }) diff --git a/src/shared/tui-agent-rest-signal.test.ts b/src/shared/tui-agent-rest-signal.test.ts deleted file mode 100644 index 7861f4f08ca..00000000000 --- a/src/shared/tui-agent-rest-signal.test.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { describe, expect, it } from 'vitest' -import type { TuiAgent } from './tui-agent' -import { isTuiAgent, TUI_AGENT_CONFIG } from './tui-agent-config' -import { getTuiAgentRestSignal, type TuiAgentRestSignal } from './tui-agent-rest-signal' - -// Exhaustive Record forces each new agent’s evidence choice into review. -const EXPECTED_REST_SIGNALS: Record = { - dsh: 'hook-done', - codex: 'synthetic-title', - cursor: 'synthetic-title', - pi: 'synthetic-title', - omp: 'synthetic-title', - droid: 'synthetic-title', - hermes: 'synthetic-title', - devin: 'synthetic-title', - zcode: 'synthetic-title', - claude: 'title', - 'claude-agent-teams': 'title', - openclaude: 'title', - opencode: 'title', - opencode2: 'title', - 'mimo-code': 'title', - gemini: 'title', - antigravity: 'title', - // Jcode has a classified identity title; hook-done is trusted only for DSH’s enabled profile. - jcode: 'title', - aider: 'title', - openclaw: 'title', - copilot: 'title', - grok: 'title', - muse: 'ready-body', - qoder: 'ready-body', - 'qoder-cn': 'ready-body', - codebuddy: 'none', - autohand: 'none', - ante: 'none', - trae: 'none', - 'prime-agent': 'none', - goose: 'none', - amp: 'none', - kilo: 'none', - kiro: 'none', - crush: 'none', - aug: 'none', - cline: 'none', - codebuff: 'none', - freebuff: 'none', - 'command-code': 'none', - continue: 'none', - kimi: 'none', - 'mistral-vibe': 'none', - 'qwen-code': 'none', - rovo: 'none' -} - -describe('getTuiAgentRestSignal', () => { - it('declares a rest signal for every launchable agent', () => { - const derived = Object.fromEntries( - Object.keys(TUI_AGENT_CONFIG) - .filter(isTuiAgent) - .map((agent) => [agent, getTuiAgentRestSignal(agent)]) - ) - expect(derived).toEqual(EXPECTED_REST_SIGNALS) - }) -}) diff --git a/src/shared/updater-windows-signature-check.test.ts b/src/shared/updater-windows-signature-check.test.ts deleted file mode 100644 index 648630f58a2..00000000000 --- a/src/shared/updater-windows-signature-check.test.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - isWindowsSignatureCheckUnavailableFailure, - isWindowsSignatureMismatchFailure -} from './updater-windows-signature-check' - -describe('isWindowsSignatureCheckUnavailableFailure', () => { - it('matches the PowerShell command failure shape (timeout / non-zero exit)', () => { - expect( - isWindowsSignatureCheckUnavailableFailure( - 'Command failed: set "PSModulePath=" & chcp 65001 >NUL & powershell.exe -NoProfile ' + - '-NonInteractive -InputFormat None -Command "Get-AuthenticodeSignature -LiteralPath ' + - "'C:\\Users\\u\\AppData\\Local\\orca-updater\\pending\\orca-windows-setup.exe' | " + - 'ConvertTo-Json -Compress"' - ) - ).toBe(true) - }) - - it('matches the stderr failure shape', () => { - expect( - isWindowsSignatureCheckUnavailableFailure( - 'Cannot execute Get-AuthenticodeSignature, stderr: Access is denied. ' + - 'Failing signature validation due to unknown stderr.' - ) - ).toBe(true) - }) - - it('does not match a genuine signature mismatch', () => { - expect( - isWindowsSignatureCheckUnavailableFailure( - 'New version 1.4.144 is not signed by the application owner: ' + - 'publisherNames: SignPath Foundation, raw info: {"Status": 0}' - ) - ).toBe(false) - }) - - it('does not match unrelated update errors', () => { - expect(isWindowsSignatureCheckUnavailableFailure('net::ERR_HTTP2_PROTOCOL_ERROR')).toBe(false) - expect( - isWindowsSignatureCheckUnavailableFailure('Cannot find channel "latest.yml" (404)') - ).toBe(false) - }) -}) - -describe('isWindowsSignatureMismatchFailure', () => { - it('matches the wrong-publisher integrity failure', () => { - expect( - isWindowsSignatureMismatchFailure( - 'New version 1.4.144 is not signed by the application owner: ' + - 'publisherNames: SignPath Foundation, raw info: {"Status": 0}' - ) - ).toBe(true) - }) - - it('is mutually exclusive with the check-unavailable classifier', () => { - const mismatch = 'New version 1.4.144 is not signed by the application owner: publisherNames: X' - expect(isWindowsSignatureMismatchFailure(mismatch)).toBe(true) - expect(isWindowsSignatureCheckUnavailableFailure(mismatch)).toBe(false) - - const blocked = 'Command failed: … Get-AuthenticodeSignature -LiteralPath …' - expect(isWindowsSignatureCheckUnavailableFailure(blocked)).toBe(true) - expect(isWindowsSignatureMismatchFailure(blocked)).toBe(false) - }) - - it('does not match unrelated errors', () => { - expect(isWindowsSignatureMismatchFailure('net::ERR_HTTP2_PROTOCOL_ERROR')).toBe(false) - }) -}) diff --git a/src/shared/windows-cmd-runner-delayed-launch.test.ts b/src/shared/windows-cmd-runner-delayed-launch.test.ts index 73c137725ab..809912fcc1e 100644 --- a/src/shared/windows-cmd-runner-delayed-launch.test.ts +++ b/src/shared/windows-cmd-runner-delayed-launch.test.ts @@ -10,16 +10,6 @@ function decodePayload(command: string): string { } describe('buildWindowsCmdRunnerDelayedLaunchCommand', () => { - it('spells no -ExecutionPolicy switch', () => { - const command = buildWindowsCmdRunnerDelayedLaunchCommand('C:\\work\\setup.cmd') - const switches = command.replace(/ -EncodedCommand \S+$/, '') - - // EncodedCommand is not policy-gated (only File is); Bypass adds an EDR signal without changing execution. - expect(switches).not.toMatch(/-ExecutionPolicy/i) - expect(switches).not.toMatch(/Bypass/i) - expect(switches).toBe('powershell.exe -NoProfile -NonInteractive') - }) - it('keeps the base64 that shields the runner path from the pane shell', () => { // This command is typed into a pane shell; base64 must protect cmd metacharacters in its path. const command = buildWindowsCmdRunnerDelayedLaunchCommand('C:\\work (x86)\\se&tup.cmd') diff --git a/src/shared/windows-console-input.test.ts b/src/shared/windows-console-input.test.ts index 9a8b0aeb372..586ca359791 100644 --- a/src/shared/windows-console-input.test.ts +++ b/src/shared/windows-console-input.test.ts @@ -47,14 +47,4 @@ describe('stdioForWindowsInteractiveChild', () => { expect(stdio).toEqual([11, process.stderr, 'inherit']) dispose() }) - - it('preserves inherited output outside JSON mode', () => { - const { stdio, dispose } = stdioForWindowsInteractiveChild(false, { - platform: 'win32', - openSync: vi.fn(() => 11), - closeSync: vi.fn() - }) - expect(stdio).toEqual([11, 'inherit', 'inherit']) - dispose() - }) }) diff --git a/src/shared/worker-transcript-text-scaling.test.ts b/src/shared/worker-transcript-text-scaling.test.ts deleted file mode 100644 index 92283cb2431..00000000000 --- a/src/shared/worker-transcript-text-scaling.test.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { expect, it, vi } from 'vitest' -import { formatWorkerTranscriptMessage } from './worker-transcript-text' -import type { NativeChatMessage } from './native-chat-types' - -it('does not shift the remaining twin list for each matching roster', () => { - const blocks: NativeChatMessage['blocks'] = Array.from({ length: 1000 }, (_, index) => ({ - type: 'subagent-group', - groupId: `g-${index}`, - agents: [{ id: 'child', label: 'task', state: 'working' }] - })) - blocks.push( - ...Array.from({ length: 1000 }, () => ({ - type: 'text' as const, - text: 'Kicked off 1 subagent' - })) - ) - const original = Array.prototype.splice - let shifted = 0 - const spy = vi.spyOn(Array.prototype, 'splice').mockImplementation(function ( - this: unknown[], - ...args: [number, number, ...unknown[]] - ) { - if (this[0] === 'Kicked off 1 subagent') { - shifted += this.length - args[0] - args[1] - } - return original.apply(this, args) - }) - let output: string - try { - output = formatWorkerTranscriptMessage({ - id: 'm', - role: 'assistant', - timestamp: 1, - source: 'transcript', - blocks - }) - } finally { - spy.mockRestore() - } - expect(output!).toBe(`[assistant] ${Array(1000).fill('Kicked off 1 subagent').join('\n')}`) - expect(shifted).toBe(0) -}) diff --git a/src/shared/workspace-attachment-normalization.test.ts b/src/shared/workspace-attachment-normalization.test.ts index db92737fe5c..76da7cd09d9 100644 --- a/src/shared/workspace-attachment-normalization.test.ts +++ b/src/shared/workspace-attachment-normalization.test.ts @@ -14,28 +14,6 @@ function pr(number: number, repository?: string): WorkspaceAttachment { afterEach(() => vi.unstubAllGlobals()) describe('workspace attachment normalization', () => { - it('scales URL parsing with references instead of comparing unrelated identities', () => { - const NativeURL = URL - let parses = 0 - vi.stubGlobal( - 'URL', - class extends NativeURL { - constructor(...args: ConstructorParameters) { - super(...args) - parses++ - } - } - ) - const counts = [23, 230].map((count) => { - const items = Array.from({ length: count }, (_, index) => pr(index + 1, 'repo')) - parses = 0 - expect(normalizeWorkspaceAttachments(items)).toEqual(items) - return parses - }) - expect(counts[0]).toBeGreaterThan(0) - expect(counts[1]).toBeLessThanOrEqual(counts[0] * 11) - }) - it('preserves global order, enrichment chains and ambiguous sources across identity groups', () => { const origin = { kind: 'observed', tabId: 'terminal' } as const const second = pr(2, 'repo') diff --git a/src/shared/workspace-layout/pane-column-split-drop-no-op.test.ts b/src/shared/workspace-layout/pane-column-split-drop-no-op.test.ts deleted file mode 100644 index 2fd39a6dab2..00000000000 --- a/src/shared/workspace-layout/pane-column-split-drop-no-op.test.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { describe, expect, it } from 'vitest' -import type { TabGroupLayoutNode } from '../tab-types' -import { - findLayoutSiblingOnSplitSide, - isPaneColumnSplitDropNoOp -} from './pane-column-split-drop-no-op' - -function horizontalSplit(firstGroupId: string, secondGroupId: string): TabGroupLayoutNode { - return { - type: 'split', - direction: 'horizontal', - ratio: 0.5, - first: { type: 'leaf', groupId: firstGroupId }, - second: { type: 'leaf', groupId: secondGroupId } - } -} - -describe('findLayoutSiblingOnSplitSide', () => { - const layout = horizontalSplit('group-left', 'group-right') - - it('finds the right sibling when splitting the left column to the right', () => { - expect(findLayoutSiblingOnSplitSide(layout, 'group-left', 'right')).toBe('group-right') - }) - - it('finds the left sibling when splitting the right column to the left', () => { - expect(findLayoutSiblingOnSplitSide(layout, 'group-right', 'left')).toBe('group-left') - }) - - it('returns null for split directions that would not target the adjacent sibling', () => { - expect(findLayoutSiblingOnSplitSide(layout, 'group-left', 'left')).toBeNull() - expect(findLayoutSiblingOnSplitSide(layout, 'group-right', 'right')).toBeNull() - }) -}) - -describe('isPaneColumnSplitDropNoOp', () => { - const layout = horizontalSplit('group-left', 'group-right') - - it('treats splitting the only tab in a group onto itself as a no-op', () => { - expect( - isPaneColumnSplitDropNoOp({ - sourceGroupId: 'group-left', - targetGroupId: 'group-left', - splitDirection: 'right', - sourceTabCount: 1, - layout - }) - ).toBe(true) - }) - - it('treats dragging the only tab onto the adjacent sibling edge as a no-op', () => { - expect( - isPaneColumnSplitDropNoOp({ - sourceGroupId: 'group-right', - targetGroupId: 'group-left', - splitDirection: 'right', - sourceTabCount: 1, - layout - }) - ).toBe(true) - expect( - isPaneColumnSplitDropNoOp({ - sourceGroupId: 'group-left', - targetGroupId: 'group-right', - splitDirection: 'left', - sourceTabCount: 1, - layout - }) - ).toBe(true) - }) - - it('allows splits when the source group would still have other tabs', () => { - expect( - isPaneColumnSplitDropNoOp({ - sourceGroupId: 'group-right', - targetGroupId: 'group-left', - splitDirection: 'right', - sourceTabCount: 2, - layout - }) - ).toBe(false) - }) -}) diff --git a/src/shared/workspace-session-browser-history.test.ts b/src/shared/workspace-session-browser-history.test.ts index bded3667611..b2825127ec8 100644 --- a/src/shared/workspace-session-browser-history.test.ts +++ b/src/shared/workspace-session-browser-history.test.ts @@ -22,24 +22,6 @@ describe('normalizeBrowserHistoryEntries', () => { expect(normalized[0]?.url).toBe('https://example.com/499') expect(normalized.at(-1)?.url).toBe('https://example.com/300') }) - it('stops reading URLs once enough unique recent entries have been retained', () => { - let reads = 0 - const history = Array.from({ length: 10_000 }, (_, index) => ({ - get url() { - reads++ - return `https://example.com/${index}` - }, - normalizedUrl: `https://example.com/${index}`, - title: `Example ${index}`, - lastVisitedAt: index, - visitCount: 1 - })) - const normalized = normalizeBrowserHistoryEntries(history) - expect(reads).toBeLessThanOrEqual(400) - expect(normalized).toHaveLength(200) - expect(normalized[0]).toBe(history[9999]) - expect(normalized[199]).toBe(history[9800]) - }) it('preserves the session on repeated normalization while still repairing and deduplicating history', () => { const entry = { diff --git a/src/shared/worktree/card-properties.test.ts b/src/shared/worktree/card-properties.test.ts deleted file mode 100644 index 06eb982f70a..00000000000 --- a/src/shared/worktree/card-properties.test.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - getWorktreeCardDetails, - getWorktreeCardModeProperties, - getWorktreeCardModeUpdates, - isDefaultedCompactWorktreeCardProperties, - normalizeWorktreeCardProperties -} from './card-properties' - -describe('worktree card properties', () => { - it('normalizes fixed and legacy properties while preserving selected properties', () => { - expect(normalizeWorktreeCardProperties(['ci', 'branch', 'pr', 'automation', 'unread'])).toEqual( - ['status', 'unread', 'ci', 'branch', 'pr', 'automation'] - ) - }) - - it('returns combined mode update payloads', () => { - expect(getWorktreeCardModeUpdates('Compact')).toEqual({ - settings: { compactWorktreeCards: true }, - ui: { - worktreeCardProperties: getWorktreeCardModeProperties('Compact'), - _worktreeCardModeDefaulted: true - } - }) - }) - - it('recognizes only exact defaulted Compact presets', () => { - expect(isDefaultedCompactWorktreeCardProperties(['status'])).toBe(true) - expect(isDefaultedCompactWorktreeCardProperties(['status', 'unread'])).toBe(true) - expect(isDefaultedCompactWorktreeCardProperties(['status', 'automation'])).toBe(true) - expect(isDefaultedCompactWorktreeCardProperties(['status', 'unread', 'automation'])).toBe(true) - expect(isDefaultedCompactWorktreeCardProperties(['automation', 'status'])).toBe(false) - expect(isDefaultedCompactWorktreeCardProperties(['status', 'automation', 'pr'])).toBe(false) - }) -}) - -describe('getWorktreeCardDetails', () => { - it('shows each chosen property, and compact cards leave out the host and agent rows', () => { - const chosen = ['pr', 'host', 'inline-agents'] as const - expect( - getWorktreeCardDetails(chosen, { compactWorktreeCards: false, newCardStyle: false }) - ).toMatchObject({ - compactCards: false, - repoInTitle: false, - metaRow: true, - pr: true, - host: true, - inlineAgents: true, - comment: false - }) - expect( - getWorktreeCardDetails(chosen, { compactWorktreeCards: true, newCardStyle: false }) - ).toMatchObject({ - compactCards: true, - repoInTitle: true, - metaRow: false, - pr: true, - host: false, - inlineAgents: false - }) - }) - - it('lets the new card style override the Compact layout', () => { - expect( - getWorktreeCardDetails(['host', 'inline-agents'], { - compactWorktreeCards: true, - newCardStyle: true - }) - ).toMatchObject({ - compactCards: false, - repoInTitle: true, - metaRow: true, - host: true, - inlineAgents: true - }) - }) -}) diff --git a/src/shared/worktree/catalog-version.test.ts b/src/shared/worktree/catalog-version.test.ts index ba5f1172723..63f5e857e51 100644 --- a/src/shared/worktree/catalog-version.test.ts +++ b/src/shared/worktree/catalog-version.test.ts @@ -1,20 +1,10 @@ import { describe, expect, it } from 'vitest' -import { - isWorktreeCatalogVersion, - isWorktreeCatalogVersionBefore, - laterWorktreeCatalogVersion -} from './catalog-version' +import { isWorktreeCatalogVersionBefore, laterWorktreeCatalogVersion } from './catalog-version' const host = (sequence: number) => ({ epoch: 'host-a', sequence }) const restarted = (sequence: number) => ({ epoch: 'host-a-restarted', sequence }) describe('WorktreeCatalogVersion ordering', () => { - it('orders by sequence within one host process', () => { - expect(isWorktreeCatalogVersionBefore(host(3), host(4))).toBe(true) - expect(isWorktreeCatalogVersionBefore(host(4), host(4))).toBe(false) - expect(isWorktreeCatalogVersionBefore(host(5), host(4))).toBe(false) - }) - it('never calls a restarted host older, whatever its numbers', () => { expect(isWorktreeCatalogVersionBefore(restarted(1), host(900))).toBe(false) expect(laterWorktreeCatalogVersion(host(900), restarted(1))).toEqual(restarted(1)) @@ -30,14 +20,4 @@ describe('WorktreeCatalogVersion ordering', () => { const applied = host(5) expect(laterWorktreeCatalogVersion(applied, host(5))).toBe(applied) }) - - it('recognizes the wire shape and nothing looser', () => { - expect(isWorktreeCatalogVersion({ epoch: 'e', sequence: 1 })).toBe(true) - expect(isWorktreeCatalogVersion({ epoch: 'e' })).toBe(false) - expect(isWorktreeCatalogVersion({ sequence: 1 })).toBe(false) - expect(isWorktreeCatalogVersion(null)).toBe(false) - expect(isWorktreeCatalogVersion('e:1')).toBe(false) - expect(isWorktreeCatalogVersion({ epoch: 'e', sequence: '1' })).toBe(false) - expect(isWorktreeCatalogVersion({ epoch: 'e', sequence: Number.NaN })).toBe(false) - }) }) diff --git a/src/shared/worktree/removal-force-classification.test.ts b/src/shared/worktree/removal-force-classification.test.ts index 77b2e61b866..69e02845add 100644 --- a/src/shared/worktree/removal-force-classification.test.ts +++ b/src/shared/worktree/removal-force-classification.test.ts @@ -3,8 +3,7 @@ import { classifyWorktreeForceDeleteReason, isProvenLivePtyRemovalError, UNSTOPPED_PTY_REMOVAL_PREFIX, - WORKTREE_TEARDOWN_FORCE_HINT, - WORKTREE_TEARDOWN_TIMEOUT_PREFIX + WORKTREE_TEARDOWN_FORCE_HINT } from './removal' const liveError = `${UNSTOPPED_PTY_REMOVAL_PREFIX} repo-1::/w — still live: term_a. ${WORKTREE_TEARDOWN_FORCE_HINT}` @@ -12,14 +11,6 @@ const unverifiableError = `${UNSTOPPED_PTY_REMOVAL_PREFIX} repo-1::/w — could // The classifier controls Force Delete visibility; an unclassified teardown refusal hides the action its message recommends (#11960). describe('classifyWorktreeForceDeleteReason for unstopped PTYs', () => { - it('offers force for a PTY that is still live', () => { - expect(classifyWorktreeForceDeleteReason(liveError)).toBe('unstopped-pty') - }) - - it('offers force when the stop could not be verified', () => { - expect(classifyWorktreeForceDeleteReason(unverifiableError)).toBe('unstopped-pty') - }) - // Ordinary desktop confirmation already sets force to skip dirty prompts; it does not waive terminal-stop proof (#11960). it('still offers force when the failed attempt only set force', () => { expect(classifyWorktreeForceDeleteReason(liveError, true)).toBe('unstopped-pty') @@ -31,17 +22,6 @@ describe('classifyWorktreeForceDeleteReason for unstopped PTYs', () => { }) // A timed-out sweep has no per-PTY verdict but needs the same explicit waiver affordance (#11960). - it('offers force when the teardown sweep itself timed out', () => { - expect( - classifyWorktreeForceDeleteReason( - `${WORKTREE_TEARDOWN_TIMEOUT_PREFIX} repo-1::/w. ${WORKTREE_TEARDOWN_FORCE_HINT}` - ) - ).toBe('unstopped-pty') - }) - - it('leaves unrelated failures unclassified', () => { - expect(classifyWorktreeForceDeleteReason('some other failure')).toBeNull() - }) }) // Only Orca’s verdict may escalate the toast to killing live PTYs; user-chosen paths cannot supply it. diff --git a/src/shared/zcode-orchestration-contract.test.ts b/src/shared/zcode-orchestration-contract.test.ts index 0b819ce417e..daa05e1a181 100644 --- a/src/shared/zcode-orchestration-contract.test.ts +++ b/src/shared/zcode-orchestration-contract.test.ts @@ -1,32 +1,7 @@ import { describe, expect, it } from 'vitest' -import { getAgentSessionOptionCatalog } from './agent-session-option-catalog' -import { buildAgentStartupPlan, agentPromptRidesLaunchCommand } from './tui-agent-startup' -import { TUI_AGENT_CONFIG } from './tui-agent-config' -import { YOLO_TUI_AGENT_ARGS } from './tui-agent-permissions' -import { recognizeAgentProcess } from './agent-process-recognition' +import { buildAgentStartupPlan } from './tui-agent-startup' describe('ZCode orchestration and send-to-agent contract', () => { - it('is dispatchable: its foreground process resolves back to the zcode agent', () => { - // ZCode names its process zcode-cli; inject dispatch must recognize it. - expect(TUI_AGENT_CONFIG.zcode.expectedProcess).toBe('zcode-cli') - expect(recognizeAgentProcess('zcode-cli')?.agent).toBe('zcode') - }) - - it('has no session-option catalog, so worker --model is refused rather than swallowed', () => { - // ZCode chooses models in its config/TUI and has no --model; a catalog would accept and silently drop the option. - expect(getAgentSessionOptionCatalog('zcode')).toBeNull() - }) - - it("bypasses permissions with ZCode's own yolo mode, not a --yolo flag", () => { - expect(YOLO_TUI_AGENT_ARGS.zcode).toBe('--mode yolo') - }) - - it('delivers prompts over stdin, never as argv', () => { - // Positional prompts are parsed as subcommands; -p exits headlessly, so interactive prompts need stdin. - expect(TUI_AGENT_CONFIG.zcode.promptInjectionMode).toBe('stdin-after-start') - expect(agentPromptRidesLaunchCommand('zcode')).toBe(false) - }) - it('keeps the prompt out of the launch command and hands it back as a follow-up', () => { const plan = buildAgentStartupPlan({ agent: 'zcode', @@ -50,9 +25,4 @@ describe('ZCode orchestration and send-to-agent contract', () => { }) expect(plan?.launchCommand).toBe("zcode '--mode' 'plan'") }) - - it('waits for the composer instead of a quiet window before pasting a draft', () => { - // The banner keeps repainting, so quiet-render readiness never settles; use the captured composer prompt. - expect(TUI_AGENT_CONFIG.zcode.draftPasteReadySignal).toBe('zcode-composer-prompt') - }) }) diff --git a/src/shared/zod-salvage-absence.test.ts b/src/shared/zod-salvage-absence.test.ts index b05b9b7ab59..bbd91fb48cb 100644 --- a/src/shared/zod-salvage-absence.test.ts +++ b/src/shared/zod-salvage-absence.test.ts @@ -3,24 +3,12 @@ import { describe, expect, it } from 'vitest' import { z } from 'zod' import { salvagingArray, salvagingRecord } from './zod-salvage' -type Optionality = { optin?: unknown; optout?: unknown } - -function optionalityOf(schema: z.ZodType): Optionality { - return (schema as unknown as { _zod: Optionality })._zod -} - const CONTAINERS: [string, () => z.ZodType, unknown][] = [ ['salvagingRecord', () => salvagingRecord(z.string(), z.string()), { k: 'v' }], ['salvagingArray', () => salvagingArray(z.string()), ['v']] ] describe('salvaging containers used bare in an object schema', () => { - it.each(CONTAINERS)('%s is neither optional-in nor optional-out', (_name, build) => { - const { optin, optout } = optionalityOf(build()) - expect(optin).toBeUndefined() - expect(optout).toBeUndefined() - }) - it.each(CONTAINERS)('%s rejects an absent key and an explicit undefined', (_name, build, ok) => { const schema = z.object({ a: build() }) @@ -29,15 +17,4 @@ describe('salvaging containers used bare in an object schema', () => { // A valid control prevents rejection-only implementations passing. expect(schema.safeParse({ a: ok })).toMatchObject({ success: true }) }) - - it.each(CONTAINERS)( - '%s stays fatal on an absent key even if zod marks it optional-in', - (_name, build) => { - const container = build() - // Both optin and optout must be optional to suppress absence. - optionalityOf(container).optin = 'optional' - - expect(z.object({ a: container }).safeParse({}).success).toBe(false) - } - ) }) diff --git a/tests/e2e/cross-version-wire/published-field-shape.unit.test.ts b/tests/e2e/cross-version-wire/published-field-shape.unit.test.ts index 330f6a0e316..6fd9d5e648e 100644 --- a/tests/e2e/cross-version-wire/published-field-shape.unit.test.ts +++ b/tests/e2e/cross-version-wire/published-field-shape.unit.test.ts @@ -1,19 +1,7 @@ import { describe, expect, it } from 'vitest' -import { - comparePublishedFieldOccurrences, - comparePublishedFields, - publishedFieldNames -} from './published-field-shape' +import { comparePublishedFieldOccurrences, comparePublishedFields } from './published-field-shape' describe('published field shape', () => { - it('sorts the keys from one published frame occurrence', () => { - expect(publishedFieldNames({ seq: 27, kind: 'scrollback', requestId: 1 })).toEqual([ - 'kind', - 'requestId', - 'seq' - ]) - }) - it('detects a field removed from only one corresponding occurrence', () => { expect( comparePublishedFieldOccurrences({ @@ -44,10 +32,6 @@ describe('published field shape', () => { ).toThrow(/occurrence count differs: older 2, newer 1/) }) - it('reads an empty payload as no fields, which is what the anti-vacuous check tests', () => { - expect(publishedFieldNames({})).toEqual([]) - }) - it('reports an added field as added and nothing as removed', () => { expect( comparePublishedFields({ diff --git a/tests/e2e/helpers/electron-main-evaluate-retry.unit.test.ts b/tests/e2e/helpers/electron-main-evaluate-retry.unit.test.ts index 95b5754e596..bd73bb7f711 100644 --- a/tests/e2e/helpers/electron-main-evaluate-retry.unit.test.ts +++ b/tests/e2e/helpers/electron-main-evaluate-retry.unit.test.ts @@ -9,17 +9,6 @@ const transientMessages = [ afterEach(() => vi.useRealTimers()) describe('retryTransientMainEvaluate', () => { - it('returns the first successful read without retrying', async () => { - let calls = 0 - await expect( - retryTransientMainEvaluate(async () => { - calls += 1 - return '/isolated/home' - }) - ).resolves.toBe('/isolated/home') - expect(calls).toBe(1) - }) - it.each(transientMessages)('retries a transient startup failure: %s', async (message) => { vi.useFakeTimers({ toFake: ['setTimeout', 'clearTimeout'] }) let calls = 0 diff --git a/tests/e2e/helpers/terminal-inventory-observation.unit.test.ts b/tests/e2e/helpers/terminal-inventory-observation.unit.test.ts index 85b2cc90e13..c0a99930db6 100644 --- a/tests/e2e/helpers/terminal-inventory-observation.unit.test.ts +++ b/tests/e2e/helpers/terminal-inventory-observation.unit.test.ts @@ -1,14 +1,7 @@ import { describe, expect, it } from 'vitest' -import type { RuntimeTerminalListResult } from '../../../src/shared/runtime-types' import { readFreshTerminalInventory } from './terminal-inventory-observation' -const listed: RuntimeTerminalListResult = { terminals: [], totalCount: 0, truncated: false } - describe('readFreshTerminalInventory', () => { - it('returns the inventory the host answered with', async () => { - await expect(readFreshTerminalInventory(async () => listed)).resolves.toBe(listed) - }) - // Retry first-mount adoption refusals; throwing from expect.poll would abort instead (CI 39256965951). it.each(['terminal_liveness_unavailable', 'terminal_surface_ownership_unavailable'])( 'treats %s as no observation yet', diff --git a/tests/e2e/helpers/terminal-pty-write-spy.unit.test.ts b/tests/e2e/helpers/terminal-pty-write-spy.unit.test.ts deleted file mode 100644 index c72ea255e98..00000000000 --- a/tests/e2e/helpers/terminal-pty-write-spy.unit.test.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { afterEach, expect, it, vi } from 'vitest' -import { setTerminalPtyWriteDelay } from './terminal-pty-write-spy' - -declare global { - var __terminalPtyWriteDelayMs: number | undefined -} - -afterEach(() => vi.unstubAllGlobals()) - -it('sets and clears paste backpressure using the main-process evaluate argument', async () => { - vi.stubGlobal('__terminalPtyWriteDelayMs', 0) - const evaluate = vi.fn() - evaluate.mockImplementation( - (callback: (electron: unknown, argument: number) => void, delay: number) => - callback(undefined, delay) - ) - const app = { evaluate } - - await setTerminalPtyWriteDelay(app, 35) - expect(globalThis.__terminalPtyWriteDelayMs).toBe(35) - await setTerminalPtyWriteDelay(app, 0) - expect(globalThis.__terminalPtyWriteDelayMs).toBe(0) -}) diff --git a/tests/e2e/runtime-graph-publication-probe.unit.test.ts b/tests/e2e/runtime-graph-publication-probe.unit.test.ts index d4844195446..eed024e92eb 100644 --- a/tests/e2e/runtime-graph-publication-probe.unit.test.ts +++ b/tests/e2e/runtime-graph-publication-probe.unit.test.ts @@ -33,24 +33,10 @@ describe('partitionSelfTestLongTask', () => { expect(result.selfTestLongTaskMs).toBe(0) }) - it('keeps every task when no self-test ran', () => { - const result = partitionSelfTestLongTask([setupTask, workloadTask], null) - expect(result.selfTestLongTaskMs).toBe(0) - expect(result.workloadLongTasks).toEqual([setupTask, workloadTask]) - }) - it('removes only the matched entry when another has identical values', () => { const twin: LongTaskSample = { ...selfTestTask } const result = partitionSelfTestLongTask([selfTestTask, twin], selfTestWindow) expect(result.workloadLongTasks).toHaveLength(1) expect(result.workloadLongTasks[0]).toBe(twin) }) - - it('rounds the reported duration to one decimal', () => { - const result = partitionSelfTestLongTask( - [{ startEpochMs: 5_000, durationMs: 251.2649 }], - selfTestWindow - ) - expect(result.selfTestLongTaskMs).toBe(251.3) - }) }) diff --git a/tests/e2e/terminal-probe-input-sequence.unit.test.ts b/tests/e2e/terminal-probe-input-sequence.unit.test.ts deleted file mode 100644 index e50f69fe612..00000000000 --- a/tests/e2e/terminal-probe-input-sequence.unit.test.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - buildFreshShellProbeInputSequence, - buildSettledShellProbeInputSequence -} from './terminal-probe-input-sequence' - -const command = "& 'C:\\node\\node.exe' '-e' 'console.log(1)'\r" - -describe('buildFreshShellProbeInputSequence', () => { - it('does not prefix fresh shell probes with interrupt or line-kill bytes', () => { - expect(buildFreshShellProbeInputSequence(command)).toEqual([command]) - expect(buildFreshShellProbeInputSequence(command).join('')).not.toContain('\x03') - expect(buildFreshShellProbeInputSequence(command).join('')).not.toContain('\x15') - }) -}) - -describe('buildSettledShellProbeInputSequence', () => { - it('resets PowerShell without sending the POSIX Ctrl+U binding', () => { - expect(buildSettledShellProbeInputSequence(command, 'win32')).toEqual(['\x03', command]) - expect(buildSettledShellProbeInputSequence(command, 'win32').join('')).not.toContain('\x15') - }) - - it.each(['linux', 'darwin'] as const)('preserves the POSIX reset on %s', (platform) => { - expect(buildSettledShellProbeInputSequence(command, platform)).toEqual(['\x03\x15', command]) - }) -}) diff --git a/tests/tools/omp-source-control-ui/README.md b/tests/tools/omp-source-control-ui/README.md index 7b320f0a8ea..740686f0e10 100644 --- a/tests/tools/omp-source-control-ui/README.md +++ b/tests/tools/omp-source-control-ui/README.md @@ -17,11 +17,8 @@ The settings persistence adapter is in-memory. This is a rendered production component check, not a full app IPC, restart-persistence, or generation test. No generator is called or mocked. Current Source Control AI settings expose action recipes with CLI arguments; they do not have a Discover Models button. The separate -`omp-model-discovery-policy.test.ts` and `omp-source-control-discovery.test.ts` -regressions cover real discovery-result policy and production generation selection -with cached models, including SSH host keys. The configured-default sentinel stays -out of generic terminal catalogs while generation without a model override still -uses OMP configuration. +`omp-source-control-discovery.test.ts` regression covers production generation +selection with cached models, including SSH host keys. `tests/tools/omp-source-control-runtime-smoke.mjs` separately validates argv against the actual OMP argument parser in a read-only reference checkout. It makes no model diff --git a/tests/tools/relay-bench/phone-e2ee-desktop-parity.test.mjs b/tests/tools/relay-bench/phone-e2ee-desktop-parity.test.mjs index f15095ae68e..3892bc79460 100644 --- a/tests/tools/relay-bench/phone-e2ee-desktop-parity.test.mjs +++ b/tests/tools/relay-bench/phone-e2ee-desktop-parity.test.mjs @@ -18,13 +18,6 @@ function handshake() { } describe('bench PhoneE2EE against the desktop E2EE v2 responder', () => { - it('derives the same transcript hash from the shipped hello', () => { - const { phone, desktop } = handshake() - expect(desktop).not.toBeNull() - phone.acceptReady(desktop.ready) - expect(phone.transcriptHashB64).toBe(desktop.transcriptHashB64) - }) - it('round-trips the e2ee_auth frame the bench sends', () => { const { phone, desktop } = handshake() phone.acceptReady(desktop.ready) diff --git a/tests/tools/relay-bench/relay-bench-state-file.test.mjs b/tests/tools/relay-bench/relay-bench-state-file.test.mjs index 5da9928273b..925874bc091 100644 --- a/tests/tools/relay-bench/relay-bench-state-file.test.mjs +++ b/tests/tools/relay-bench/relay-bench-state-file.test.mjs @@ -1,7 +1,6 @@ // Require safe storage of live resume/device tokens: reject symlink traversal, fix existing 0644 permissions, and create parents before provisioned credentials are lost. import { chmodSync, - existsSync, lstatSync, mkdtempSync, readFileSync, @@ -88,10 +87,4 @@ describe('readSecretFile', () => { symlinkSync(target, link) expect(() => readSecretFile(link)).toThrow(/symlink/) }) - - it('reports a missing file rather than returning empty text', () => { - const path = join(dir, 'absent.json') - expect(existsSync(path)).toBe(false) - expect(() => readSecretFile(path)).toThrow(/ENOENT/) - }) }) diff --git a/tests/tools/windows-pty-native-capability-smoke/run.test.mjs b/tests/tools/windows-pty-native-capability-smoke/run.test.mjs index bf34b0970bf..4d314330b37 100644 --- a/tests/tools/windows-pty-native-capability-smoke/run.test.mjs +++ b/tests/tools/windows-pty-native-capability-smoke/run.test.mjs @@ -1,27 +1,7 @@ -import { createRequire } from 'node:module' import { describe, expect, it } from 'vitest' -import { checkoutRunProcessPath, formatProbeFailure, packagedProbeInvocation } from './run.mjs' +import { formatProbeFailure } from './run.mjs' describe('packaged Windows native smoke runner boundary', () => { - it('uses one checkout-owned runner for current and affected package paths', () => { - const current = packagedProbeInvocation('/ci/current/dist/win-unpacked/Orca.exe') - const affected = packagedProbeInvocation('/ci/1.4.158/dist/win-unpacked/Orca.exe') - - expect(checkoutRunProcessPath()).toBe( - createRequire(import.meta.url).resolve('@orca/process-host') - ) - expect(current.program).not.toBe(affected.program) - expect(current.args[0]).toBe(affected.args[0]) - expect(current.args[1]).toBe('--exercise') - expect(current.args[2]).not.toBe(affected.args[2]) - expect(current.args[3]).toBe(process.execPath) - expect(affected.args[3]).toBe(process.execPath) - expect(current.env.ELECTRON_RUN_AS_NODE).toBe('1') - expect(affected.env.ELECTRON_RUN_AS_NODE).toBe('1') - expect(current.timeoutMs).toBe(affected.timeoutMs) - expect(current.timeoutMs).toBe(45_000) - }) - it('keeps timeout evidence bounded and preserves both output channels', () => { const failure = formatProbeFailure({ code: null,