test: remove low-value host caller and UI tests (#42465)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
OrcaWin
2026-11-14 11:30:47 -08:00
committed by GitHub
co-authored by OrcaWin
parent aee2f8abe9
commit 7348dca919
11 changed files with 7 additions and 745 deletions
@@ -47,14 +47,6 @@ describe('orchestration dispatch coordinator handle', () => {
json
} as never)
const invokeRun = (flags: Map<string, string | boolean>) =>
ORCHESTRATION_HANDLERS['orchestration coordinator-start']({
flags,
client: { call: callMock },
cwd: '/tmp/repo',
json: true
} as never)
it('rejects stale coordinator env handles when the caller pane cannot be proven', async () => {
process.env.ORCA_TERMINAL_HANDLE = 'term_stale_coord'
callMock.mockRejectedValueOnce(staleHandleError())
@@ -74,51 +66,4 @@ describe('orchestration dispatch coordinator handle', () => {
expect(callMock).toHaveBeenCalledTimes(1)
expect(getTerminalHandleMock).not.toHaveBeenCalled()
})
it('retires the legacy coordinator command without runtime effects', async () => {
await expect(
invokeRun(new Map<string, string | boolean>([['spec', 'run the plan']]))
).rejects.toMatchObject({
code: 'orchestration_migration_required',
data: {
reason: 'command_retired',
effectsApplied: false,
nextCommandArgs: ['skills', 'get', 'orchestration', '--full']
}
})
expect(callMock).not.toHaveBeenCalled()
})
})
describe('orchestration task-create caller handle', () => {
beforeEach(() => {
callMock.mockReset()
getTerminalHandleMock.mockReset()
delete process.env.ORCA_TERMINAL_HANDLE
delete process.env.ORCA_PANE_KEY
})
const invokeTaskCreate = (flags: Map<string, string | boolean>) =>
ORCHESTRATION_HANDLERS['orchestration task-create']({
flags,
client: { call: callMock },
cwd: '/tmp/repo',
json: true
} as never)
it('fails closed when a stale task creator handle cannot be reminted', async () => {
process.env.ORCA_TERMINAL_HANDLE = 'term_stale'
callMock.mockRejectedValueOnce(staleHandleError())
getTerminalHandleMock.mockResolvedValue('term_wrong_active')
await expect(
invokeTaskCreate(new Map<string, string | boolean>([['spec', 'do work']]))
).rejects.toMatchObject({ code: 'no_active_sender_terminal' })
expect(callMock).toHaveBeenNthCalledWith(1, 'terminal.resolveIdentity', {
terminal: 'term_stale'
})
expect(getTerminalHandleMock).not.toHaveBeenCalled()
expect(callMock).toHaveBeenCalledTimes(1)
})
})
@@ -1,139 +0,0 @@
// Inherited pane identity and an available sibling must never override the injected session caller.
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
const callMock = vi.hoisted(() => vi.fn())
const getTerminalHandleMock = vi.hoisted(() => vi.fn())
vi.mock('../../output/command-result-output', () => ({ printResult: vi.fn() }))
vi.mock('../../terminals/terminal-selector', () => ({ getTerminalHandle: getTerminalHandleMock }))
import { ORCHESTRATION_HANDLERS } from '../orchestration-handlers'
import { findCommandSpec } from '../../arguments/args'
import { COMMAND_SPECS } from '../../specs/index'
import { refuseConflictingSessionCallerFlags } from './session-caller-flags'
import { createOrchestrationCompatibilityEnvelope } from './orchestration-compatibility-envelope'
const SESSION = 'f7a1c0de-1111-4222-8333-444455556666'
const IDENTITY_ENV = [
'ORCA_AGENT_SESSION_ID',
'ORCA_TERMINAL_HANDLE',
'ORCA_PANE_KEY',
'ORCA_STRUCTURED_SESSION'
] as const
const originalEnv = Object.fromEntries(IDENTITY_ENV.map((name) => [name, process.env[name]]))
const RESULT = {
result: {
run: { id: 'run_1', objective: 'o', consumer_generation: 1 },
runs: [],
nextCursor: null,
messages: [],
count: 0,
message: { id: 'msg_1' },
lifecycle: { action: 'completed' },
dispatch: { id: 'dispatch_1', task_id: 'task_1', status: 'dispatched' },
gate: { id: 'gate_1', task_id: 'task_1', status: 'pending', resolution: 'r' },
gates: [],
task: { id: 'task_1', status: 'pending' },
tasks: [],
answer: 'yes',
messageId: 'msg_1',
threadId: 'thread_1',
timedOut: false,
state: 'ready',
runId: 'run_1',
taskId: 'task_1',
dispatchId: 'dispatch_1',
effects: [],
residualResources: [],
workers: [],
counts: {}
}
}
/** dispatch-show is excluded: its --from fills preview text rather than naming the caller. */
function flagMap(flags: Record<string, string | true>): Map<string, string | boolean> {
return new Map(Object.entries(flags))
}
async function invoke(
command: string,
flags: Map<string, string | boolean>,
json = true
): Promise<void> {
const handler = ORCHESTRATION_HANDLERS[`orchestration ${command}`]
if (!handler) {
throw new Error(`no handler for ${command}`)
}
refuseConflictingSessionCallerFlags(
findCommandSpec(COMMAND_SPECS, ['orchestration', command]),
flags
)
await handler({
flags,
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: these handlers read only `call`; RuntimeClient is a class, so a structural double cannot satisfy it without the cast.
client: { call: callMock } as never,
cwd: '/tmp/repo',
json
})
}
function setEnv(env: Partial<Record<(typeof IDENTITY_ENV)[number], string>>): void {
for (const name of IDENTITY_ENV) {
const value = env[name]
if (value === undefined) {
delete process.env[name]
} else {
process.env[name] = value
}
}
}
beforeEach(() => {
callMock.mockReset().mockResolvedValue(RESULT)
getTerminalHandleMock.mockReset().mockResolvedValue('term_sibling')
vi.spyOn(console, 'log').mockImplementation(() => {})
vi.spyOn(console, 'error').mockImplementation(() => {})
})
afterEach(() => {
vi.restoreAllMocks()
setEnv(originalEnv)
process.exitCode = undefined
})
describe('the identity a session presents', () => {
it('keeps the identity-less refusal, without --from advice, for a child that has no id', async () => {
setEnv({ ORCA_STRUCTURED_SESSION: '1' })
await expect(invoke('reply', flagMap({ id: 'msg_1', body: 'b' }))).rejects.toMatchObject({
code: 'no_active_sender_terminal',
message: expect.not.stringContaining('Pass --from')
})
expect(getTerminalHandleMock).not.toHaveBeenCalled()
expect(callMock).not.toHaveBeenCalled()
})
})
describe('the orchestration envelope', () => {
it('carries the injected id beside whatever terminal evidence the process also has', () => {
const envelope = createOrchestrationCompatibilityEnvelope({
ORCA_AGENT_SESSION_ID: ` ${SESSION} `,
ORCA_TERMINAL_HANDLE: 'term_inherited_pane'
})
expect(envelope.orchestrationCompatibilityEvidence).toEqual({
terminalHandle: 'term_inherited_pane',
agentSessionId: SESSION
})
})
it('claims no session without an injected id', () => {
expect(
createOrchestrationCompatibilityEnvelope({ ORCA_AGENT_SESSION_ID: ' ' })
.orchestrationCompatibilityEvidence
).toBeUndefined()
})
})