diff --git a/config/scripts/ci/sharding/ci-shard-timings.json b/config/scripts/ci/sharding/ci-shard-timings.json index d92352fc618..0cfc612a085 100644 --- a/config/scripts/ci/sharding/ci-shard-timings.json +++ b/config/scripts/ci/sharding/ci-shard-timings.json @@ -329,7 +329,6 @@ "src/cli/handlers/automation-owner-fencing.test.ts": 529, "src/cli/handlers/computer-action-validation.test.ts": 317, "src/cli/handlers/computer-state-formatting.test.ts": 337, - "src/cli/handlers/connector.test.ts": 781, "src/cli/handlers/core.test.ts": 194, "src/cli/handlers/data-account-commands.test.ts": 431, "src/cli/handlers/emulator.test.ts": 303, @@ -347,11 +346,9 @@ "src/cli/handlers/orchestration-lifecycle-json-rejection.test.ts": 555, "src/cli/handlers/orchestration-lifecycle-rejection.test.ts": 781, "src/cli/handlers/orchestration-request-show-cli.test.ts": 581, - "src/cli/handlers/orchestration-send-receipt-warnings.test.ts": 565, "src/cli/handlers/orchestration-task-list-brief.test.ts": 494, "src/cli/handlers/orchestration-windows-ask-cli.test.ts": 801, "src/cli/handlers/orchestration-worker-cli.test.ts": 706, - "src/cli/handlers/orchestration-worker-show-wait-cli.test.ts": 748, "src/cli/handlers/orchestration.test.ts": 543, "src/cli/handlers/orchestration/agent-view.test.ts": 511, "src/cli/handlers/orchestration/concise-list-row-size.test.ts": 492, @@ -374,7 +371,6 @@ "src/cli/handlers/skill-guide-host-gate.test.ts": 596, "src/cli/handlers/skill-sharing.test.ts": 423, "src/cli/handlers/speech.test.ts": 454, - "src/cli/handlers/terminal-daemon.test.ts": 426, "src/cli/handlers/terminal-set-pane-title.test.ts": 623, "src/cli/handlers/terminal-split.test.ts": 452, "src/cli/handlers/terminal-switch-paired-reveal.test.ts": 487, @@ -4662,7 +4658,6 @@ "src/renderer/src/components/NativeChatResumeOnRestartGroups.test.tsx": 3472, "src/renderer/src/components/NewWorkspaceComposerCard.quick-file-drop.test.tsx": 4557, "src/renderer/src/components/NewWorkspaceComposerCard.set-location.test.tsx": 1301, - "src/renderer/src/components/NotificationCardStack.test.tsx": 272, "src/renderer/src/components/QuickOpen.selection.test.tsx": 1046, "src/renderer/src/components/SelectedTextCopyMenu.test.tsx": 329, "src/renderer/src/components/TerminalSearch.test.tsx": 458, diff --git a/src/cli/computer-format.test.ts b/src/cli/computer-format.test.ts index 11738fc65e0..5abab39b94d 100644 --- a/src/cli/computer-format.test.ts +++ b/src/cli/computer-format.test.ts @@ -1,6 +1,5 @@ import { describe, expect, it, vi } from 'vitest' -import type { ComputerActionResult } from '../shared/runtime-types' -import { formatComputerAction, prepareComputerCliJsonResult } from './computer-format' +import { prepareComputerCliJsonResult } from './computer-format' import { printResult } from './format' describe('prepareComputerCliJsonResult', () => { @@ -52,70 +51,3 @@ describe('prepareComputerCliJsonResult', () => { expect(prepareComputerCliJsonResult(response)).toBe(response) }) }) - -describe('formatComputerAction', () => { - it.each([ - { kind: 'full tree', treeText: 'tree', treeDiff: undefined }, - { - kind: 'diff', - treeText: '~ 1 button Save', - treeDiff: { baseSnapshotId: 'snap-before', changed: 1, added: 0, removed: 0 } - }, - { kind: 'empty tree', treeText: '', treeDiff: undefined } - ])('prints $kind without claiming unverified actions completed', ({ treeText, treeDiff }) => { - const result: ComputerActionResult = { - snapshot: { - id: 'snap-1', - app: { name: 'Finder', bundleId: 'com.apple.finder', pid: 100 }, - window: { title: 'Finder', id: 42, width: 800, height: 600 }, - coordinateSpace: 'window', - treeText, - treeDiff, - elementCount: 5, - focusedElementId: null - }, - screenshot: null, - screenshotStatus: { state: 'skipped', reason: 'no_screenshot_flag' } - } - - const output = formatComputerAction('click', result) - - expect(output).toContain('Click attempted, unverified (verification metadata unavailable)') - expect(output).toContain('Inspect with the command above') - expect(output).not.toContain('Click completed') - if (treeText) { - expect(output).toContain(`\n\n${treeText}`) - } else { - expect(output).not.toContain('\n\n') - } - }) - - it('does not treat accessibility actions without verification as completed', () => { - const result: ComputerActionResult = { - snapshot: { - id: 'snap-1', - app: { name: 'Finder', bundleId: 'com.apple.finder', pid: 100 }, - window: { title: 'Finder', id: 42, width: 800, height: 600 }, - coordinateSpace: 'window', - treeText: 'tree', - elementCount: 5, - focusedElementId: null - }, - screenshot: null, - screenshotStatus: { state: 'skipped', reason: 'no_screenshot_flag' }, - action: { - path: 'accessibility', - actionName: 'click', - targetWindowId: 42 - } - } - - const output = formatComputerAction('click', result) - - expect(output).toContain( - 'Click attempted via accessibility, unverified (accessibility action unasserted)' - ) - expect(output).toContain('Inspect with the command above') - expect(output).not.toContain('Click completed') - }) -}) diff --git a/src/cli/handlers/connector.test.ts b/src/cli/handlers/connector.test.ts deleted file mode 100644 index ab0c81ac89b..00000000000 --- a/src/cli/handlers/connector.test.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { RuntimeClientError } from '../runtime-client' -import { - callConnector, - formatConnectorStart, - formatDelivery, - formatPendingPrompt -} from './connector' - -function refusingClient(code: string) { - return { - call: async (): Promise => { - throw new RuntimeClientError(code, code) - } - } -} - -describe('orca connector', () => { - it('passes the host’s connectors_disabled refusal through, with no local flag check', async () => { - await expect( - callConnector(refusingClient('connectors_disabled'), 'connector.send', {}) - ).rejects.toMatchObject({ code: 'connectors_disabled' }) - }) - - it('names the update instead of surfacing method_not_found from an older host', async () => { - await expect( - callConnector(refusingClient('method_not_found'), 'connector.send', {}) - ).rejects.toThrow('Update Orca on the host') - }) - - it('claims a start only for a definite answer', () => { - expect(formatConnectorStart({ outcome: 'accepted' })).toBe('started; prompt accepted') - expect(formatConnectorStart({ outcome: 'refused', reason: 'unsupported_agent' })).toBe( - 'not started; prompt refused: unsupported_agent' - ) - expect(formatConnectorStart({ outcome: 'unknown', reason: 'replayed_after_restart' })).toBe( - 'prompt unknown: replayed_after_restart' - ) - }) - - it('says when a send reopened a closed agent', () => { - expect(formatDelivery({ outcome: 'accepted', reopened: true })).toBe( - 'accepted (reopened the agent)' - ) - expect(formatDelivery({ outcome: 'refused', reason: 'agent_asleep_in_window' })).toBe( - 'refused: agent_asleep_in_window' - ) - }) - - it('prints a prompt with its id and options, and an unknown kind as one to answer in Orca', () => { - expect( - formatPendingPrompt({ - kind: 'approval', - promptId: 'p_1', - tool: 'Bash', - summary: 'ls', - options: [ - { id: 'allow_once', label: 'Allow once' }, - { id: 'reject_once', label: 'Reject' } - ] - }) - ).toBe('approval Bash: ls\n prompt id: p_1\n allow_once: Allow once\n reject_once: Reject') - expect(formatPendingPrompt({ kind: 'free-text', promptId: 'p_2' })).toBe( - 'unsupported (answer in Orca)\n prompt id: p_2' - ) - expect(formatPendingPrompt(null)).toBe('no pending prompt') - }) -}) diff --git a/src/cli/handlers/orchestration-send-receipt-warnings.test.ts b/src/cli/handlers/orchestration-send-receipt-warnings.test.ts deleted file mode 100644 index 5e1edf218e8..00000000000 --- a/src/cli/handlers/orchestration-send-receipt-warnings.test.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { expect, it, vi } from 'vitest' - -const callMock = vi.fn() -vi.mock('../format', () => ({ printResult: vi.fn() })) -vi.mock('../selectors', () => ({ getTerminalHandle: vi.fn() })) - -import { printResult } from '../format' -import { ORCHESTRATION_HANDLERS } from './orchestration' -import { orchestrationTestContext } from './orchestration-handler-test-context' - -async function formatSend(result: unknown): Promise { - callMock.mockReset().mockResolvedValueOnce({ result }) - vi.mocked(printResult).mockClear() - await ORCHESTRATION_HANDLERS['orchestration send']( - orchestrationTestContext( - callMock, - new Map([ - ['full', true], - ['from', 'term_sender'], - ['to', 'term_recipient'], - ['subject', 'ping'] - ]), - false, - '/workspace' - ) - ) - expect(printResult).toHaveBeenCalledOnce() - const printCall = vi.mocked(printResult).mock.calls[0] - if (!printCall) { - throw new Error('send did not print its receipt') - } - expect(printCall[0]).toEqual({ result }) - expect(printCall[1]).toBe(false) - return printCall[2](printCall[0].result) -} - -it('prints a live terminal-only delivery limitation', async () => { - const line = await formatSend({ - message: { id: 'msg_1' }, - warnings: [ - { - code: 'legacy_terminal_recipient', - recipient: 'term_recipient', - message: 'term_recipient is live now, but its mailbox is not restart-durable.' - } - ] - }) - - expect(line).toBe( - 'Sent msg_1\nWarning: term_recipient is live now, but its mailbox is not restart-durable.' - ) -}) - -it('shows partial fan-out omissions without hiding delivered recipients', async () => { - const line = await formatSend({ - messages: [{ id: 'msg_1' }], - recipients: 1, - warnings: [ - { - code: 'recipient_unreachable', - recipient: 'term_gone', - message: 'Terminal term_gone has no live pane or durable mailbox.' - } - ] - }) - - expect(line).toBe( - 'Sent 1 messages to 1 recipients\nWarning: Terminal term_gone has no live pane or durable mailbox.' - ) -}) - -it('prints delivery limitations on relayed receipts', async () => { - const line = await formatSend({ - relay: { - messageId: 'relay_1', - sequence: 1, - dispatchId: 'ctx_remote', - destination: 'worker', - accepted: true - }, - warnings: [ - { - code: 'legacy_terminal_recipient', - recipient: 'term_remote', - message: 'term_remote is reachable through a compatibility address.' - } - ] - }) - - expect(line).toBe( - 'Queued relay_1 for worker Dispatch ctx_remote\nWarning: term_remote is reachable through a compatibility address.' - ) -}) diff --git a/src/cli/handlers/orchestration-task-list-brief.test.ts b/src/cli/handlers/orchestration-task-list-brief.test.ts index 7646f2befc3..4aee06fab3a 100644 --- a/src/cli/handlers/orchestration-task-list-brief.test.ts +++ b/src/cli/handlers/orchestration-task-list-brief.test.ts @@ -71,37 +71,3 @@ describe('orchestration task-list brief output', () => { expect(response).toHaveProperty('result.tasks', serverTasks) }) }) - -describe('orchestration task-list concise output', () => { - it('lists each task without its spec or result', async () => { - const log = vi.spyOn(console, 'log').mockImplementation(() => {}) - vi.spyOn(client, 'call').mockImplementation(callMock) - callMock.mockReset().mockResolvedValue( - okFixture('req_tasks', { - tasks: [ - { - id: 'task_1', - spec: 'long spec '.repeat(200), - task_title: 'Audit', - status: 'completed', - result: 'long result '.repeat(200), - dispatch_id: 'ctx_1' - } - ], - count: 1 - }) - ) - await ORCHESTRATION_HANDLERS['orchestration task-list']({ - flags: new Map([['run', 'run_1']]), - client, - cwd: '/tmp/repo', - json: true - }) - expect(JSON.parse(String(log.mock.calls[0]?.[0]))).toEqual({ - ok: true, - result: { - tasks: [{ id: 'task_1', status: 'completed', title: 'Audit', dispatchId: 'ctx_1' }] - } - }) - }) -}) diff --git a/src/cli/handlers/orchestration-worker-show-wait-cli.test.ts b/src/cli/handlers/orchestration-worker-show-wait-cli.test.ts deleted file mode 100644 index 280b2ef648e..00000000000 --- a/src/cli/handlers/orchestration-worker-show-wait-cli.test.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' - -const callMock = vi.fn() - -vi.mock('../format', async (importOriginal) => { - const original = await importOriginal<{ printResult: typeof printResult }>() - return { printResult: vi.fn(original.printResult) } -}) -vi.mock('../selectors', () => ({ getTerminalHandle: vi.fn() })) - -import { ORCHESTRATION_HANDLERS } from './orchestration' -import { printResult } from '../format' -import { okFixture } from '../test-fixtures' -import { orchestrationTestContext } from './orchestration-handler-test-context' - -async function showWorker(observation: unknown): Promise { - const result = { - dispatch: { id: 'ctx_1', taskId: 'task_1', status: 'dispatched' }, - worker: { state: 'ready', stage: 'dispatch_input', agentTerminalHandle: 'term_1' }, - ...(observation === undefined ? {} : { observation }) - } - callMock.mockResolvedValue(okFixture('req_show', result)) - await ORCHESTRATION_HANDLERS['orchestration worker-show']( - orchestrationTestContext( - callMock, - new Map([ - ['full', true], - ['dispatch', 'ctx_1'] - ]), - false - ) - ) - expect(callMock).toHaveBeenCalledExactlyOnceWith('orchestration.workerShow', { - dispatch: 'ctx_1' - }) - expect(console.log).toHaveBeenCalledOnce() - const output = vi.mocked(console.log).mock.calls[0]?.[0] - if (typeof output !== 'string') { - throw new Error('worker-show did not print text') - } - return output -} - -describe('orchestration worker-show interactive wait output', () => { - beforeEach(() => { - callMock.mockReset() - vi.mocked(printResult).mockClear() - vi.spyOn(console, 'log').mockImplementation(() => {}) - }) - - afterEach(() => { - vi.restoreAllMocks() - }) - - it('names the prompt when a worker is waiting on a human', async () => { - const line = await showWorker({ - status: 'live', - exactWorker: true, - agentWait: { source: 'prompt-text', reason: 'agent-approval-prompt', since: 1 } - }) - - expect(line).toContain('Waiting on a human: agent-approval-prompt (via prompt-text)') - }) - - it('says none when the pane was evaluated and nothing was waiting', async () => { - const line = await showWorker({ status: 'live', exactWorker: true, agentWait: null }) - - expect(line).toContain('Interactive wait: none') - }) - - it('says unknown when the field is absent, not none', async () => { - const line = await showWorker({ status: 'identity_changed', exactWorker: false }) - - expect(line).toContain('Interactive wait: unknown (not evaluated)') - expect(line).not.toContain('Interactive wait: none') - }) - - it('says unknown when the host sent no observation at all', async () => { - const line = await showWorker(undefined) - - expect(line).toContain('Interactive wait: unknown (not evaluated)') - }) -}) diff --git a/src/cli/handlers/orchestration/agent-view.test.ts b/src/cli/handlers/orchestration/agent-view.test.ts index cbc09aa345d..25d5e019b04 100644 --- a/src/cli/handlers/orchestration/agent-view.test.ts +++ b/src/cli/handlers/orchestration/agent-view.test.ts @@ -64,21 +64,6 @@ describe('orchestration agent views', () => { vi.restoreAllMocks() }) - it('prints a worker-start as the ids a reuse needs, and --full as the whole envelope', async () => { - const flags: [string, string][] = [ - ['task', 'task_1'], - ['from', 'term_coord'] - ] - const concise = await run('worker-start', flags, OLDER_RUNTIME_START, true) - expect(concise.stdout).toBe( - '{"ok":true,"result":{"dispatchId":"ctx_1","taskId":"task_1","runId":"run_1","state":"ready","terminal":"term_agent","workspace":"wt_1::/repo"}}' - ) - - const full = await run('worker-start', [...flags, ['full', true]], OLDER_RUNTIME_START, true) - expect(full.stdout).toBe(JSON.stringify(full.response, null, 2)) - expect(full.stderr).toBe('') - }) - it('makes a failed worker-start impossible to miss on stdout, stderr, and the exit code', async () => { const { stdout, stderr } = await run('worker-start', [['task', 'task_1']], { ...OLDER_RUNTIME_START, @@ -112,146 +97,6 @@ describe('orchestration agent views', () => { expect(stdout).toContain('failedStage=agent\\x1b]0;x\\x07') }) - it('prints a question with its payload kept apart and a reply command for this executable', async () => { - const question = { - id: 'msg_q', - run_id: 'run_1', - from_handle: 'dispatch:ctx_1', - to_handle: 'run:run_1', - subject: 'Question', - body: 'Remove the old flag now?', - type: 'question', - priority: 'normal', - thread_id: 'msg_q', - payload: JSON.stringify({ - taskId: 'task_1', - dispatchId: 'ctx_1', - question: 'Remove the old flag now?', - options: ['now', 'later'] - }), - created_at: '2026-10-30T18:02:11Z', - delivery_contract: 'current_delivery' - } - const result = { - runId: 'run_1', - deliveryId: 'delivery_1', - deliveryAcknowledged: true, - messages: [question], - count: 1, - timedOut: false - } - const flags: [string, string][] = [['run', 'run_1']] - - const json = await run('check', flags, result, true) - expect(JSON.parse(json.stdout)).toEqual({ - ok: true, - result: { - messages: [ - { - id: 'msg_q', - type: 'question', - from: 'ctx_1', - body: 'Remove the old flag now?', - payload: { taskId: 'task_1', dispatchId: 'ctx_1', options: ['now', 'later'] } - } - ] - } - }) - - const text = await run('check', flags, result) - expect(text.stdout).toBe( - [ - 'msg_q question from ctx_1', - ' Remove the old flag now?', - ' payload: taskId=task_1 dispatchId=ctx_1 options=now,later', - 'Reply: orca-dev orchestration reply --id msg_q --body "..."' - ].join('\n') - ) - }) - - it('never echoes a sent message back', async () => { - const { stdout } = await run( - 'send', - [ - ['from', 'term_worker'], - ['to', 'run:run_1'], - ['subject', 'Done'], - ['body', 'A long summary the worker just wrote.'] - ], - { - message: { id: 'msg_done', body: 'A long summary the worker just wrote.', subject: 'Done' }, - lifecycle: { action: 'completed', autoReleaseAt: '2026-10-30T18:12:11Z' }, - next: 'Recorded. End your turn.' - }, - true - ) - - expect(stdout).toBe( - '{"ok":true,"result":{"messageId":"msg_done","lifecycle":"completed","autoReleaseAt":"2026-10-30T18:12:11Z","next":"Recorded. End your turn."}}' - ) - }) - - it('prints a follow-up as where it went, naming the launch mode only for a fresh start', async () => { - const followUp = (delivery: string) => - run( - 'send', - [ - ['to', 'dispatch:ctx_1'], - ['subject', 'More'] - ], - { - ...OLDER_RUNTIME_START, - dispatchId: 'ctx_2', - delivery, - followUpOf: 'ctx_1', - turnStart: 'queued', - mode: { - mode: 'terminal', - preferred: 'terminal', - detail: 'Started a terminal agent worker.' - }, - next: 'Orca wakes you when workers report; end your turn.' - } - ) - - expect((await followUp('reopened')).stdout).toBe( - 'delivery=reopened followUpOf=ctx_1 dispatchId=ctx_2 taskId=task_1 runId=run_1 state=ready terminal=term_agent workspace=wt_1::/repo queued=true\n' + - 'Next: Orca wakes you when workers report; end your turn.' - ) - expect((await followUp('started_fresh')).stdout).toContain('mode=terminal') - }) - - it('lists each worker with its agent terminal and a runnable next action', async () => { - const { stdout } = await run('worker-list', [['run', 'run_1']], { - workers: [ - { - dispatchId: 'ctx_1', - taskId: 'task_1', - runId: 'run_1', - workerState: 'running', - dispatchStatus: 'dispatched', - agentTerminalHandle: 'term_agent', - terminalState: 'active', - resource: { endpointIncarnation: 'internal' }, - projection: { - host: { id: 'local' }, - workspace: { id: 'wt_1::/repo' }, - stage: { activity: 'working' }, - liveness: { verdict: 'live' }, - nextAction: { argv: ['orchestration', 'worker-stop', '--dispatch', 'ctx_1'] }, - attention: { categories: ['input', 'stale', 'root_completion'] } - } - } - ], - counts: { active: 1 } - }) - - expect(stdout).toBe( - 'scope.run=run_1 scope.source=flag\n' + - 'dispatchId=ctx_1 taskId=task_1 state=running liveness=live terminal=term_agent terminalState=active workspace=wt_1::/repo host=local attention=input next="orca-dev orchestration worker-stop --dispatch ctx_1"' - ) - }) - it('fails an interrupted check and an unconfirmed worker inventory on stderr and the exit code', async () => { const check = await run('check', [['run', 'run_1']], { messages: [], @@ -448,28 +293,6 @@ describe('orchestration agent views', () => { expect(JSON.parse(stdout)).toMatchObject({ ok: false, result: { workers: [] } }) }) - it('says when worker-show never evaluated an interactive wait', async () => { - const show = (observation: unknown) => - run('worker-show', [['dispatch', 'ctx_1']], { - dispatch: { id: 'ctx_1', taskId: 'task_1', status: 'dispatched' }, - worker: { state: 'running', stage: 'working', agentTerminalHandle: 'term_agent' }, - ...(observation === undefined ? {} : { observation }) - }) - expect((await show(undefined)).stdout).toContain('waitingOnHuman=unknown') - expect((await show({ agentWait: null })).stdout).not.toContain('waitingOnHuman') - }) - - it('does not echo the Run objective the caller just sent', async () => { - const { stdout } = await run( - 'worker-start', - [['spec', 'Review add']], - { ...OLDER_RUNTIME_START, run: { id: 'run_1', objective: 'Review add', created: true } }, - true - ) - expect(JSON.parse(stdout).result).toMatchObject({ runId: 'run_1', runCreated: true }) - expect(stdout).not.toContain('Review add') - }) - it('never lets a payload stand in for Orca-computed message fields', async () => { const { stdout } = await run('check', [['run', 'run_1']], { messages: [ diff --git a/src/cli/handlers/terminal-daemon.test.ts b/src/cli/handlers/terminal-daemon.test.ts deleted file mode 100644 index a4d27c080df..00000000000 --- a/src/cli/handlers/terminal-daemon.test.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { formatSeveredDaemonStatus } from './terminal-daemon' - -const live = { - verdict: 'live' as const, - pid: 4288, - detail: 'answered its health check', - processCeiling: { - state: 'on' as const, - limit: 200, - mechanism: 'systemd-slice' as const, - unit: 'orca_ptys_1.slice' - } -} - -describe('terminal-daemon status', () => { - it('reports a live daemon and its process ceiling', () => { - const text = formatSeveredDaemonStatus({ severed: null, daemon: live }) - expect(text).toContain('Terminal daemon: live (pid 4288)') - expect(text).toContain('Terminal process ceiling: on (200 processes') - expect(text).not.toContain('OK') - }) - - it('reports a ceiling that is off and why', () => { - const text = formatSeveredDaemonStatus({ - severed: null, - daemon: { ...live, processCeiling: { state: 'off', reason: 'no_user_manager' } } - }) - expect(text).toContain('Terminal process ceiling: off (no user manager)') - }) - - it('never says OK for a daemon that is gone', () => { - const text = formatSeveredDaemonStatus({ - severed: null, - daemon: { - verdict: 'exited', - pid: 4288, - detail: 'pid 4288 is gone; Orca starts a new daemon with the next terminal', - processCeiling: null - } - }) - expect(text).toContain('Terminal daemon: exited') - expect(text).toContain('next terminal') - expect(text).not.toContain('OK') - expect(text).not.toContain('ceiling') - }) - - it('reports unverifiable when the host cannot prove either way', () => { - const text = formatSeveredDaemonStatus({ - severed: null, - daemon: { - verdict: 'unverifiable', - pid: 4288, - detail: 'it did not answer', - processCeiling: null - } - }) - expect(text).toContain('Terminal daemon: unverifiable (pid 4288) — it did not answer') - }) - - it('says liveness is unverifiable against a host that does not report it', () => { - const text = formatSeveredDaemonStatus({ severed: null }) - expect(text).toContain('unverifiable') - expect(text).not.toContain('OK') - }) - - it('says a restart ends running processes and only resumable agents come back', () => { - const text = formatSeveredDaemonStatus({ - severed: { pid: 4288, linuxStartTicks: '777', bootId: 'b', liveSessionCount: 3 }, - daemon: live - }) - expect(text).toContain('PID 4288') - expect(text).toContain('3 running terminals') - expect(text).toContain('ENDS') - expect(text).toContain('Agents that support resume can be resumed') - expect(text).toContain('shells and other jobs cannot') - }) - - it('does not describe an exited severed daemon as still hosting terminals', () => { - const text = formatSeveredDaemonStatus({ - severed: { pid: 4288, linuxStartTicks: '777', bootId: 'b', liveSessionCount: 0 }, - daemon: { verdict: 'exited', pid: 4288, detail: 'pid 4288 is gone', processCeiling: null } - }) - expect(text).toContain('Terminal daemon: exited') - expect(text).not.toContain('still hosts') - }) -}) diff --git a/src/cli/linear-format.test.ts b/src/cli/linear-format.test.ts index b8b7ccbdcf1..650a1b8ca6b 100644 --- a/src/cli/linear-format.test.ts +++ b/src/cli/linear-format.test.ts @@ -1,14 +1,9 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' -import type { - LinearIssueContextResult, - LinearMcpIssueListResult, - LinearSearchResult -} from '../shared/linear/agent-access' +import type { LinearIssueContextResult } from '../shared/linear/agent-access' import { formatLinearIssue, formatLinearMcpIssueList, - printLinearMcpIssueListWarnings, - printLinearSearchWarnings + printLinearMcpIssueListWarnings } from './linear-format' describe('linear-format', () => { @@ -17,77 +12,6 @@ describe('linear-format', () => { vi.spyOn(console, 'error').mockImplementation(() => {}) }) - it('treats older search results without workspaceErrors as non-partial', () => { - const result = { - issues: [], - meta: { - query: 'auth', - workspaceId: 'all', - limit: 20, - returned: 0, - limitReached: false, - partial: false - } - } as unknown as LinearSearchResult - - printLinearSearchWarnings(result) - - expect(console.error).not.toHaveBeenCalled() - }) - - it('binds a list continuation hint to its Linear workspace', () => { - printLinearMcpIssueListWarnings({ - issues: [], - truncated: true, - meta: { - limit: 20, - returned: 20, - hasMore: true, - nextCursor: 'next-page', - orderBy: 'updatedAt', - workspaceId: 'workspace-1', - partial: false, - workspaceErrors: [] - } - } as LinearMcpIssueListResult) - - expect(console.error).toHaveBeenCalledWith( - 'warning: more results available; next cursor: next-page; continue with --workspace workspace-1' - ) - }) - - it('prints a stdout truncation marker when a list-issues page is partial', () => { - const output = formatLinearMcpIssueList({ - issues: [ - { - id: 'issue-1', - identifier: 'ENG-1', - title: 'Fix auth', - url: 'https://linear.app/acme/issue/ENG-1', - labels: [], - state: { name: 'In Progress' }, - assignee: { displayName: 'Ada' }, - workspace: { id: 'workspace-1', name: 'Acme' } - } - ], - truncated: true, - meta: { - limit: 1, - returned: 1, - hasMore: true, - nextCursor: 'next-page', - orderBy: 'updatedAt', - workspaceId: 'workspace-1', - partial: false, - workspaceErrors: [] - } - }) - - expect(output).toContain('ENG-1') - expect(output).toContain('truncated: showing 1') - expect(output).not.toContain(' of ') - }) - const OSC_52 = '\u001b]52;c;cGF5bG9hZA==\u0007' const CLEAR_SCREEN = '\u001b[2J' diff --git a/src/main/speech/stt-worker-cpu-fallback.test.ts b/src/main/speech/stt-worker-cpu-fallback.test.ts index ba8c2eed943..f6820f1ce98 100644 --- a/src/main/speech/stt-worker-cpu-fallback.test.ts +++ b/src/main/speech/stt-worker-cpu-fallback.test.ts @@ -93,16 +93,6 @@ describe('GPU speech process falling back to the CPU', () => { ]) }) - it('keeps the GPU for later sessions when only this audio failed', () => { - const { worker, children, marks } = setup() - const [gpu] = children - gpu.emit('message', { type: 'ready' }) - worker.postMessage(feed(100)) - gpu.emit('message', { type: 'error', streamId: '1', error: 'bad input' }) - children[1].emit('message', { type: 'ready' }) - expect(marks()).toBe(0) - }) - it('does not replay a canceled dictation', () => { const { worker, children } = setup() const [gpu] = children @@ -137,15 +127,4 @@ describe('GPU speech process falling back to the CPU', () => { children[1].emit('message', { type: 'error', error: 'model load failed' }) expect(exits).toEqual([1]) }) - - it('keeps a GPU process on IPC audio, which it can replay, and hands a CPU process the port', () => { - const { worker, children } = setup() - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the fakes never touch the port. - const port = {} as never - expect(worker.attachAudioPort('1', port)).toBe(false) - children[0].emit('message', { type: 'ready' }) - worker.postMessage(feed(100)) - children[0].emit('exit', 1) - expect(worker.attachAudioPort('2', port)).toBe(true) - }) }) diff --git a/src/renderer/src/attention/hidden-workspace-notification-mute.test.ts b/src/renderer/src/attention/hidden-workspace-notification-mute.test.ts index 7d73a64894a..e8e5944834f 100644 --- a/src/renderer/src/attention/hidden-workspace-notification-mute.test.ts +++ b/src/renderer/src/attention/hidden-workspace-notification-mute.test.ts @@ -3,9 +3,6 @@ import { getDefaultSettings } from '../../../shared/constants' import type { FolderWorkspace } from '../../../shared/folder-workspaces/folder-workspace-types' import { folderWorkspaceKey } from '../../../shared/workspace-scope' import { getDefaultNotificationSettings } from '../../../shared/notification-settings-defaults' -import { resolveAgentAttention } from '@/attention/agent-attention-policy' -import { createTerminalAttentionSurface } from '@/components/terminal-pane/notifications/terminal-attention-surface' -import { createStructuredAttentionSurface } from '@/components/native-chat/session/attention/structured-attention-surface' import { createTabsSliceMockApi } from '../store/slices/tabs/tabs-slice-test-harness' import { createTestStore } from '../store/testing/app-store-test-fixture' import { makeWorktree } from '../store/slices/worktrees/worktree.test-fixture' @@ -128,20 +125,6 @@ describe('isWorkspaceNotificationMutedBySidebarFilters', () => { }) describe('muted workspace attention', () => { - it('earns no unread and no delivery request from the attention policy', () => { - const decision = resolveAgentAttention( - { - subject: { workspaceId: CLI_ID, surfaceKey: 'tab-1:leaf-1' }, - reason: 'agent-completion', - settlesTurn: true, - hasFreshActivityEvidence: true - }, - createTerminalAttentionSurface(store.getState()) - ) - expect(decision).toEqual({ admitted: false, cause: 'muted-workspace' }) - expect(createStructuredAttentionSurface(store.getState()).isWorkspaceMuted(CLI_ID)).toBe(true) - }) - it('writes no bell marker for a muted workspace, and still does for a visible one', () => { const terminalTab = (id: string, worktreeId: string) => ({ id, diff --git a/src/renderer/src/components/GitLabItemDialog.test.tsx b/src/renderer/src/components/GitLabItemDialog.test.tsx index 41efad984ca..1f9c3b90364 100644 --- a/src/renderer/src/components/GitLabItemDialog.test.tsx +++ b/src/renderer/src/components/GitLabItemDialog.test.tsx @@ -40,30 +40,12 @@ function detailsFor(item: GitLabWorkItem, reviewer: string): GitLabWorkItemDetai } } -function renderDialog(item: GitLabWorkItem) { - return render() -} - afterEach(() => { cleanup() vi.clearAllMocks() }) describe('GitLabItemDialog reconciliation', () => { - it('drops the previous MR details when another MR opens', async () => { - api.workItemDetails.mockResolvedValueOnce(detailsFor(mr(7), 'alice')) - const view = renderDialog(mr(7)) - await waitFor(() => expect(screen.getByText('alice')).toBeTruthy()) - - api.workItemDetails.mockReturnValueOnce(new Promise(() => {})) - view.rerender( - - ) - - expect(screen.queryByText('alice')).toBeNull() - expect(screen.queryByText('Reviewers')).toBeNull() - }) - it('drops the previous source details when only the task source changes', async () => { const source: TaskSourceContext = { kind: 'task-source', diff --git a/src/renderer/src/components/NativeChatResumeOnRestartGroups.selection.test.tsx b/src/renderer/src/components/NativeChatResumeOnRestartGroups.selection.test.tsx index 6e79187ecaf..f6c3909762a 100644 --- a/src/renderer/src/components/NativeChatResumeOnRestartGroups.selection.test.tsx +++ b/src/renderer/src/components/NativeChatResumeOnRestartGroups.selection.test.tsx @@ -132,16 +132,3 @@ it('starts expanded; collapsing hides a node’s rows and keeps their selection' expect(state(chatBox('in-child'))).toBe('false') expect(state(chatBox('also-in-child'))).toBe('true') }) - -it('toggles the chats of a collapsed node', () => { - render({ candidates: seedTree(), initiallySelected: [] }) - - act(() => disclosureOf('parent').click()) - act(() => nodeBox('parent').click()) - expect(countOf('parent')).toBe('3 of 3') - expect(onToggleSpy.mock.calls.map(([sessionId]) => sessionId).toSorted()).toEqual([ - 'also-in-child', - 'in-child', - 'in-parent' - ]) -}) diff --git a/src/renderer/src/components/NotificationCardStack.test.tsx b/src/renderer/src/components/NotificationCardStack.test.tsx deleted file mode 100644 index 6dbbc3298cf..00000000000 --- a/src/renderer/src/components/NotificationCardStack.test.tsx +++ /dev/null @@ -1,67 +0,0 @@ -// @vitest-environment happy-dom - -import { act, useRef } from 'react' -import { createRoot, type Root } from 'react-dom/client' -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { NOTIFICATION_CARD_STACK_HEIGHT_VAR } from '@/lib/notification-card-stack-height' -import { useNotificationCardLayoutVarReader } from '@/lib/notification-card-layout-vars' -import { NotificationCardStack } from './NotificationCardStack' - -let resize: (() => void) | null = null -let height = 0 -let root: Root | null = null - -const toasterVar = (name: string): string => - document.querySelector('[data-toaster]')?.style.getPropertyValue(name) ?? '' -const published = (): string => toasterVar(NOTIFICATION_CARD_STACK_HEIGHT_VAR) - -function ToasterStandIn(): React.JSX.Element { - const ref = useRef(null) - useNotificationCardLayoutVarReader(ref) - return
-} - -function Corner(): React.JSX.Element { - return ( - <> - - card - - ) -} - -beforeEach(() => { - height = 0 - vi.stubGlobal( - 'ResizeObserver', - class { - callback: () => void - constructor(callback: () => void) { - this.callback = callback - resize = callback - } - observe(): void {} - disconnect(): void {} - } - ) - vi.spyOn(HTMLElement.prototype, 'offsetHeight', 'get').mockImplementation(() => height) - root = createRoot(document.body.appendChild(document.createElement('div'))) -}) - -afterEach(() => { - act(() => root?.unmount()) - vi.unstubAllGlobals() - vi.restoreAllMocks() -}) - -describe('NotificationCardStack', () => { - it('publishes its height plus the gap so toasts sit above the cards, and clears it when empty', () => { - height = 120 - act(() => root?.render()) - expect(published()).toBe('calc(120px + 0.5rem)') - - height = 0 - act(() => resize?.()) - expect(published()).toBe('') - }) -}) diff --git a/src/renderer/src/components/UpdateCard.error-card.test.tsx b/src/renderer/src/components/UpdateCard.error-card.test.tsx index 3449613c48d..839bb14ed30 100644 --- a/src/renderer/src/components/UpdateCard.error-card.test.tsx +++ b/src/renderer/src/components/UpdateCard.error-card.test.tsx @@ -131,14 +131,6 @@ function showPackageRecovery(recovery = PACKAGE_RECOVERY): void { } describe('UpdateCard Linux package-install recovery', () => { - it('uses the recovery version when cached update state is stale', () => { - renderWithInitialStatus({ state: 'available', version: '1.4.199', changelog: null }) - showPackageRecovery() - - fireEvent.click(screen.getByRole('button', { name: 'Download Manually' })) - expect(openUrl).toHaveBeenCalledWith('https://github.com/stablyai/orca/releases/tag/v1.4.200') - }) - it('resets command discovery when a newer package cycle replaces the recovery', async () => { getInstructions.mockResolvedValueOnce({ ok: false,