test: remove 17 low-value wrapper and private-state suites (#41292)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
OrcaWin
2026-11-11 15:51:03 -08:00
committed by GitHub
co-authored by OrcaWin
parent 97a8c9177c
commit c2e716dbbb
21 changed files with 0 additions and 521 deletions
-59
View File
@@ -1,59 +0,0 @@
import { describe, expect, it } from 'vitest'
import type { CommandSpec } from './args'
import { buildAgentContext } from './agent-context'
import { COMMAND_SPECS } from './specs'
describe('buildAgentContext', () => {
const specs: CommandSpec[] = [
{
path: ['worktree', 'rm'],
aliases: [
['worktree', 'remove'],
['worktree', 'delete']
],
summary: 'Remove a worktree',
usage: 'orca worktree rm',
allowedFlags: ['worktree', 'force']
},
{
path: ['agent-context'],
summary: 'Print the schema',
usage: 'orca agent-context',
allowedFlags: []
}
]
it('reports effective flags including globals, not just allowedFlags', () => {
const schema = buildAgentContext(specs)
const rm = schema.commands.find((command) => command.command === 'worktree rm')
expect(rm?.flags).toContain('worktree')
expect(rm?.flags).toContain('force')
expect(rm?.flags).toContain('json')
expect(rm?.flags).toContain('help')
})
it('omits hidden specs so agents do not discover an unadvertised command', () => {
const schema = buildAgentContext([
...specs,
{
path: ['terminal', 'stop'],
summary: 'Deprecated',
usage: 'orca terminal stop',
allowedFlags: [],
hidden: true
}
])
expect(schema.commandCount).toBe(2)
expect(schema.commands.map((command) => command.command)).not.toContain('terminal stop')
})
})
describe('agent-context over the live registry', () => {
it('marks raw passthrough commands without synthesizing Orca flags', () => {
const schema = buildAgentContext(COMMAND_SPECS)
const claudeTeams = schema.commands.find((command) => command.command === 'claude-teams')
expect(claudeTeams?.argumentMode).toBe('passthrough')
expect(claudeTeams?.flags).toEqual([])
})
})
-2
View File
@@ -49,5 +49,3 @@ export async function dispatch(commandPath: string[], ctx: HandlerContext): Prom
}
await handler(ctx)
}
export { buildRoutes as buildHandlerRoutes }
-24
View File
@@ -1,24 +0,0 @@
import { describe, expect, it } from 'vitest'
import { buildHandlerRoutes } from './dispatch'
import type { HandlerGroup } from './handler-group-manifest'
describe('duplicate command keys', () => {
const group = (name: string, keys: string[]): HandlerGroup => ({
name,
keys,
load: async () => ({})
})
it('rejects the same key claimed by two groups', () => {
expect(() =>
buildHandlerRoutes([group('alpha', ['ship it']), group('beta', ['ship it'])])
).toThrow('Duplicate CLI handler registration for "ship it" (alpha and beta)')
})
it('rejects a key duplicated inside one group list', () => {
expect(() => buildHandlerRoutes([group('alpha', ['ship it', 'ship it'])])).toThrow(
'Duplicate CLI handler registration for "ship it"'
)
})
})
-1
View File
@@ -15,7 +15,6 @@ export type HandlerGroup = {
load: () => Promise<Record<string, CommandHandler>>
}
// handler-group-manifest.test.ts checks keys against the real exports to prevent drift.
export const HANDLER_GROUPS: readonly HandlerGroup[] = [
JIRA_HANDLER_GROUP,
LINEAR_HANDLER_GROUP,
-24
View File
@@ -1,24 +0,0 @@
import { describe, expect, it } from 'vitest'
import { parseArgs, validateCommandAndFlags } from '../args'
import { PROFILE_STATE_COMMAND_SPECS } from './profile-state'
describe('profile state rollback discovery', () => {
it.each(
['current-json', 'latest-json'].flatMap((selector) => [
{ selector, argv: ['profile', 'state', 'rollback', `--${selector}`] },
{ selector, argv: [`--${selector}`, 'profile', 'state', 'rollback'] },
{ selector, argv: ['profile', `--${selector}`, 'state', 'rollback'] }
])
)('parses the JSON selector as a boolean: $argv', ({ argv, selector }) => {
const parsed = parseArgs(argv)
expect(parsed.commandPath).toEqual(['profile', 'state', 'rollback'])
expect(parsed.flags.get(selector)).toBe(true)
expect(() => validateCommandAndFlags(PROFILE_STATE_COMMAND_SPECS, parsed)).not.toThrow()
})
it('parses the current SQLite selector as a boolean', () => {
const parsed = parseArgs(['profile', 'state', 'rollback', '--current-sqlite'])
expect(parsed.flags.get('current-sqlite')).toBe(true)
expect(() => validateCommandAndFlags(PROFILE_STATE_COMMAND_SPECS, parsed)).not.toThrow()
})
})
@@ -1,39 +0,0 @@
import { describe, expect, it } from 'vitest'
import type { RuntimeWorktreeAgentRow } from '../shared/runtime-types'
import { formatWorktreePsProgramStatus } from './worktree-ps-program-status'
function agent(over: Partial<RuntimeWorktreeAgentRow>): RuntimeWorktreeAgentRow {
return {
paneKey: 'tab:leaf',
parentPaneKey: null,
state: 'working',
agentType: 'codex',
prompt: 'ship it',
taskTitle: null,
displayName: null,
lastAssistantMessage: null,
toolName: null,
toolInput: null,
interrupted: false,
stateStartedAt: 1,
updatedAt: 1,
...over
}
}
describe('formatWorktreePsProgramStatus', () => {
it('prefers a reported block over another agent progress', () => {
const working = agent({ programStatus: { state: 'working', progress: 42, observedAt: 1 } })
const signIn = agent({
paneKey: 'tab:leaf-2',
state: 'done',
programStatus: { state: 'blocked', kind: 'auth', observedAt: 1 }
})
expect(formatWorktreePsProgramStatus([working, signIn])).toBe(' (Sign-in required)')
})
it('hides progress on a finished row', () => {
const programStatus = { state: 'working' as const, progress: 42, observedAt: 1 }
expect(formatWorktreePsProgramStatus([agent({ state: 'done', programStatus })])).toBe('')
})
})
@@ -1,35 +0,0 @@
import { describe, expect, it } from 'vitest'
import {
formatWorktreePsTerminalFields,
projectWorktreePsTerminalVerdict
} from './worktree-ps-terminal-verdict'
describe('worktree ps terminal verdict', () => {
it('prints unverifiable, never zero or no, for an unreachable host', () => {
const row = { liveTerminalCount: 0, hasAttachedPty: false, unverifiableTerminalCount: 1 }
expect(formatWorktreePsTerminalFields(row)).toBe('live:unverifiable pty:unverifiable')
expect(projectWorktreePsTerminalVerdict(row), 'count fields keep their JSON types').toEqual({
...row,
terminalVerdict: 'unverifiable'
})
})
it('keeps verified terminals alongside unverifiable ones', () => {
const row = { liveTerminalCount: 1, hasAttachedPty: true, unverifiableTerminalCount: 2 }
expect(formatWorktreePsTerminalFields(row)).toBe('live:1+2 unverifiable pty:yes')
expect(
formatWorktreePsTerminalFields({ ...row, hasAttachedPty: false }),
'an unverifiable terminal may hold the pty'
).toBe('live:1+2 unverifiable pty:unverifiable')
expect(projectWorktreePsTerminalVerdict(row)).toEqual({ ...row, terminalVerdict: 'live' })
})
it('reports unverifiable for an idle row from a host that predates the count', () => {
const row = { liveTerminalCount: 0, hasAttachedPty: false }
expect(formatWorktreePsTerminalFields(row)).toBe('live:unverifiable pty:unverifiable')
expect(projectWorktreePsTerminalVerdict(row)).toEqual({
...row,
terminalVerdict: 'unverifiable'
})
})
})