mirror of
https://github.com/stablyai/orca.git
synced 2026-11-18 11:54:46 +00:00
test: remove low-value client plumbing and inventory readback tests (#43475)
Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
@@ -1,48 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { FakeSession } from '../../transport/connection/mobile-endpoint-supervisor-test-fakes'
|
||||
import type { RpcResponse } from '../../transport/rpc/rpc-wire-types'
|
||||
import { WORKTREE_RUN_APPROVED_SETUP_RUNTIME_CAPABILITY } from '../../../../src/shared/remote-runtime/protocol/worktree-runtime-capabilities'
|
||||
import { runReviewedCreatedSetup } from './created-worktree-setup-review'
|
||||
import { createWorktreeWithNameRetry } from './worktree-create-retry'
|
||||
|
||||
function reply(result: unknown): RpcResponse {
|
||||
return { id: 'rpc-1', ok: true, result, _meta: { runtimeId: 'runtime-1' } }
|
||||
}
|
||||
|
||||
describe('created workspace setup review', () => {
|
||||
it('reports setup the host skipped because the created branch differs', async () => {
|
||||
const client = new FakeSession('connected')
|
||||
client.sendRequest.mockResolvedValue(
|
||||
reply({
|
||||
worktree: { id: 'wt-1', displayName: 'marlin' },
|
||||
setupTrustMismatch: { contentHash: 'branch-hash', scriptContent: 'make branch' }
|
||||
})
|
||||
)
|
||||
const result = await createWorktreeWithNameRetry({
|
||||
client,
|
||||
baseName: 'marlin',
|
||||
worktreeCreateIdempotency: Promise.resolve(false),
|
||||
approvedSetupHash: 'shown-hash',
|
||||
buildParams: (name) => ({ repo: 'id:repo-1', name, setupDecision: 'run' })
|
||||
})
|
||||
expect(client.sendRequest.mock.calls[0]?.[1]).toMatchObject({ approvedSetupHash: 'shown-hash' })
|
||||
expect(result).toMatchObject({
|
||||
worktreeId: 'wt-1',
|
||||
setupTrustMismatch: { contentHash: 'branch-hash', scriptContent: 'make branch' }
|
||||
})
|
||||
})
|
||||
|
||||
it('runs only the reviewed content in the created workspace', async () => {
|
||||
const client = new FakeSession('connected')
|
||||
client.sendRequest.mockImplementation(async (method: string) =>
|
||||
method === 'status.get'
|
||||
? reply({ capabilities: [WORKTREE_RUN_APPROVED_SETUP_RUNTIME_CAPABILITY] })
|
||||
: reply({ status: 'started' })
|
||||
)
|
||||
await expect(runReviewedCreatedSetup(client, 'wt-1', 'branch-hash')).resolves.toBeUndefined()
|
||||
expect(client.sendRequest).toHaveBeenCalledWith('worktree.runApprovedSetup', {
|
||||
worktree: 'id:wt-1',
|
||||
approvedSetupHash: 'branch-hash'
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -78,22 +78,5 @@ export function registerPtyInventoryLivenessVerdictTests(): void {
|
||||
reason: 'relay disconnected during stop'
|
||||
})
|
||||
})
|
||||
|
||||
it('does not let a partial inventory overwrite a concurrent provider failure', async () => {
|
||||
const inventory = deferred<{ id: string; worktreeId: string }[]>()
|
||||
const listProcesses = vi.fn(() => inventory.promise)
|
||||
const runtime = await makeRuntimeMissingFromInventory(() => false, listProcesses)
|
||||
|
||||
const listing = runtime.listTerminals(`id:${WORKTREE_ID}`)
|
||||
await vi.waitFor(() => expect(listProcesses).toHaveBeenCalled())
|
||||
runtime.markPtyLivenessUnverifiable(REMOTE_PTY_ID, 'inventory transport failed')
|
||||
inventory.resolve([])
|
||||
await listing
|
||||
|
||||
expect(runtime.getPtyLivenessVerdict(REMOTE_PTY_ID)).toEqual({
|
||||
status: 'unverifiable',
|
||||
reason: 'inventory transport failed'
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user