mirror of
https://github.com/stablyai/orca.git
synced 2026-10-09 08:02:35 +00:00
test(mobile): open the launch ledger the way admission now does
Launch admission reads its ledger from the runtime's own record store, not the installed chat host. The mobile launch suites still planted the store in the chat-host registry, so every launch they drove was refused with agent_session_record_store_unavailable. They now hand the store to the runtime stub, as the root launch suites already do.
This commit is contained in:
@@ -10,13 +10,14 @@ import {
|
||||
AGENT_SESSION_MAX_NEW_OPERATION_AGE_MS,
|
||||
AGENT_SESSION_OPERATION_FUTURE_SKEW_MS
|
||||
} from '../../../src/shared/agent-session-host-authority'
|
||||
import { setStructuredAgentSessionHost } from '../../../src/main/native-chat/agent-session-wire/structured-agent-session-registry'
|
||||
import type { StructuredAgentSessionHost } from '../../../src/main/native-chat/agent-session-wire/structured-agent-session-host'
|
||||
import type { AgentSessionRecordStore } from '../../../src/main/runtime/agent-session-record-store'
|
||||
import { openTestAgentSessionRecordStore } from '../../../src/main/runtime/agent-session-record-store-test-harness'
|
||||
import type { OrcaRuntimeService } from '../../../src/main/runtime/orca-runtime'
|
||||
import { RpcDispatcher } from '../../../src/main/runtime/rpc/dispatcher'
|
||||
import { runtimeStub } from '../../../src/main/runtime/rpc/methods/agent-launch.test-fixture'
|
||||
import {
|
||||
runtimeStub,
|
||||
setAgentLaunchRecordStore
|
||||
} from '../../../src/main/runtime/rpc/methods/agent-launch.test-fixture'
|
||||
import {
|
||||
AGENT_LAUNCH_REPLAY_REQUIRED_RUNTIME_CAPABILITY,
|
||||
AGENT_LAUNCH_RUNTIME_CAPABILITY
|
||||
@@ -40,13 +41,12 @@ beforeEach(async () => {
|
||||
createStructuredSession.mockResolvedValue({ ok: true, value: { sessionId: 'session-1' } })
|
||||
directory = await mkdtemp(join(tmpdir(), 'orca-mobile-launch-replay-'))
|
||||
store = await openTestAgentSessionRecordStore(directory)
|
||||
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the launch reads only deps.store; structured session creation is the injected boundary above.
|
||||
setStructuredAgentSessionHost({ deps: { store } } as unknown as StructuredAgentSessionHost)
|
||||
setAgentLaunchRecordStore(store)
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
vi.restoreAllMocks()
|
||||
setStructuredAgentSessionHost(null)
|
||||
setAgentLaunchRecordStore(null)
|
||||
await rm(directory, { recursive: true, force: true })
|
||||
})
|
||||
|
||||
|
||||
@@ -9,9 +9,10 @@ import { DeviceRegistry } from '../../../src/main/runtime/device-registry'
|
||||
import type { AuthenticatedMobileSocket } from '../../../src/main/runtime/rpc/mobile-socket-wiring'
|
||||
import { RpcDispatcher } from '../../../src/main/runtime/rpc/dispatcher'
|
||||
import { AgentLaunchFields } from '../../../src/main/runtime/rpc/methods/agent-launch-schemas'
|
||||
import { runtimeStub } from '../../../src/main/runtime/rpc/methods/agent-launch.test-fixture'
|
||||
import { setStructuredAgentSessionHost } from '../../../src/main/native-chat/agent-session-wire/structured-agent-session-registry'
|
||||
import type { StructuredAgentSessionHost } from '../../../src/main/native-chat/agent-session-wire/structured-agent-session-host'
|
||||
import {
|
||||
runtimeStub,
|
||||
setAgentLaunchRecordStore
|
||||
} from '../../../src/main/runtime/rpc/methods/agent-launch.test-fixture'
|
||||
import type { OrcaRuntimeService } from '../../../src/main/runtime/orca-runtime'
|
||||
import { markRpcDeliveryUnknown } from '../transport/rpc-delivery-ambiguity'
|
||||
import { createStableLogicalRpcClient } from '../transport/stable-logical-rpc-client'
|
||||
@@ -39,12 +40,11 @@ beforeEach(async () => {
|
||||
createStructuredSession.mockResolvedValue({ ok: true, value: { sessionId: 'session-1' } })
|
||||
directory = await mkdtemp(join(tmpdir(), 'orca-launch-architecture-'))
|
||||
store = await openTestAgentSessionRecordStore(directory)
|
||||
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the launch reads deps.store; session creation is injected above.
|
||||
setStructuredAgentSessionHost({ deps: { store } } as unknown as StructuredAgentSessionHost)
|
||||
setAgentLaunchRecordStore(store)
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
setStructuredAgentSessionHost(null)
|
||||
setAgentLaunchRecordStore(null)
|
||||
await rm(directory, { recursive: true, force: true })
|
||||
})
|
||||
|
||||
@@ -243,8 +243,7 @@ describe('mobile launch retry authority', () => {
|
||||
const first = await dispatcher.dispatch(request)
|
||||
expect(first.ok).toBe(true)
|
||||
store = await openTestAgentSessionRecordStore(directory)
|
||||
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: launch admission reads only deps.store from the installed host.
|
||||
setStructuredAgentSessionHost({ deps: { store } } as unknown as StructuredAgentSessionHost)
|
||||
setAgentLaunchRecordStore(store)
|
||||
await expect(
|
||||
dispatcher.dispatch({ ...request, method: 'agent.launchReplay' })
|
||||
).resolves.toEqual(first)
|
||||
@@ -293,8 +292,7 @@ describe('mobile launch retry authority', () => {
|
||||
}
|
||||
})
|
||||
store = await openTestAgentSessionRecordStore(directory)
|
||||
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: launch admission reads only deps.store from the installed host.
|
||||
setStructuredAgentSessionHost({ deps: { store } } as unknown as StructuredAgentSessionHost)
|
||||
setAgentLaunchRecordStore(store)
|
||||
await expect(dispatcher.dispatch(request)).resolves.toMatchObject({
|
||||
ok: false,
|
||||
error: { code: 'worktree_create_collision' }
|
||||
|
||||
Reference in New Issue
Block a user