Files
orca/src/main/runtime/runtime-skill-install-authority.test.ts
T
OrcaWinandm4air a4a96fee70 refactor(pty): delete the SSH PTY provider and its registry slot (#27499)
* refactor(pty): delete the SSH PTY provider and its registry slot

Nothing in production registers an SSH PTY provider, so the registry's SSH
map was always empty: every SSH lookup answered undefined or threw the
'No PTY provider for connection' error. Delete the provider stack, its
consumer-session and source-recovery contracts, the registry maps and the
getSshProvider dependency, keeping each caller's existing result for an
absent provider. The registry now dispatches only 'local'; any other host
throws PtyHostNotDispatchableError, which keeps the renderer-matched
message for SSH ids and is never read as a gone or exited PTY.

* test(pty): keep the no-provider SSH routing cases in local-only form

* test: reword a comment naming the deleted SSH PTY provider

* test: drop an import the rebase left unused

---------

Co-authored-by: m4air <m4air@Mac.localdomain>
2026-10-11 09:23:28 -07:00

45 lines
1.7 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import type { RuntimeSkillCommandHost } from './runtime-skill-command-contract'
import { createSkillInstallAuthority } from './runtime-skill-install-authority'
const WORKTREE_ID = 'repo-1::/workspace/app'
function createHost(overrides: Partial<RuntimeSkillCommandHost> = {}): RuntimeSkillCommandHost {
return {
getRuntimeId: () => 'runtime-1',
getUserDataPath: () => '/tmp/orca-skill-authority-test',
isPackaged: () => true,
getSettings: () => ({}),
listRepos: () => [{ id: 'repo-1', path: '/workspace/app' }],
listFolderWorkspaces: () => [],
listResolvedWorktrees: async () => [],
showManagedWorktree: async () => ({ id: WORKTREE_ID, path: '/workspace/app' }),
skillTransactionRecovery: Promise.resolve(),
...overrides
} as RuntimeSkillCommandHost
}
describe('createSkillInstallAuthority', () => {
// Why: collapsing a thrown lookup into null reports a transient git/IO failure as a missing
// workspace, which is unactionable — the real cause never reaches the caller or the logs.
it('surfaces a worktree lookup failure instead of reporting it as not found', async () => {
const authority = createSkillInstallAuthority(
createHost({
showManagedWorktree: async () => {
throw new Error('git-index-locked')
}
})
)
await expect(authority.resolveWorktree(WORKTREE_ID)).rejects.toThrow('git-index-locked')
})
it('returns null when the lookup resolves a different worktree', async () => {
const authority = createSkillInstallAuthority(
createHost({ showManagedWorktree: async () => ({ id: 'repo-1::/other', path: '/other' }) })
)
await expect(authority.resolveWorktree(WORKTREE_ID)).resolves.toBeNull()
})
})