mirror of
https://github.com/stablyai/orca.git
synced 2026-11-04 19:17:28 +00:00
* Measure remaining CI import, diagnostic and checkout savings * Qualify remaining CI candidates on hosted runners * Qualify independent mobile typecheck overlap on Actions * Keep explicit RPC test registries from loading unused methods * Qualify complete RPC registry cohort and mobile cancellation * Promote measured CI setup and typecheck savings * Recognize the shared RPC test guard in lint policy * Align the mobile barrier contract with independent typechecks
62 lines
2.2 KiB
TypeScript
62 lines
2.2 KiB
TypeScript
import './rpc/unused-default-rpc-methods.test-fixture'
|
|
import { describe, expect, it, vi } from 'vitest'
|
|
import type { GitAdmissionEvent } from '../../shared/git-admission-state'
|
|
import { GitAdmissionScheduler } from '../git/command-runner/git-subprocess-admission'
|
|
import type * as GitStatusModule from '../git/status'
|
|
import type { OrcaRuntimeService } from './orca-runtime'
|
|
import { RpcDispatcher } from './rpc/dispatcher'
|
|
import { GIT_METHODS } from './rpc/methods/git'
|
|
import { RuntimeGitStatusCommands } from './runtime-git-status-commands'
|
|
|
|
const getStatusMock = vi.hoisted(() => vi.fn())
|
|
|
|
vi.mock('../git/status', async () => ({
|
|
...(await vi.importActual<typeof GitStatusModule>('../git/status')),
|
|
getStatus: getStatusMock
|
|
}))
|
|
|
|
describe('runtime git status admission', () => {
|
|
it('admits RPC reads at the caller tier and defaults future tiers to status', async () => {
|
|
const events: GitAdmissionEvent[] = []
|
|
const scheduler = new GitAdmissionScheduler({
|
|
onAdmissionEvent: (event) => events.push(event)
|
|
})
|
|
getStatusMock.mockImplementation(async (worktreePath, options) => {
|
|
const grant = await scheduler.acquire({
|
|
args: ['status'],
|
|
cwd: worktreePath,
|
|
tier: options.admissionTier
|
|
})
|
|
grant.release()
|
|
return { entries: [], conflictOperation: 'none' }
|
|
})
|
|
const commands = new RuntimeGitStatusCommands({
|
|
resolveRuntimeGitTarget: async () => ({
|
|
worktree: { path: '/workspace/feature' },
|
|
executionHostId: 'local'
|
|
})
|
|
} as never)
|
|
const runtime = {
|
|
getRuntimeId: () => 'test-runtime',
|
|
getRuntimeGitStatus: commands.getRuntimeGitStatus.bind(commands)
|
|
} as unknown as OrcaRuntimeService
|
|
const dispatcher = new RpcDispatcher({ runtime, methods: GIT_METHODS })
|
|
|
|
for (const admissionTier of ['background', 'interactive', 'future-tier']) {
|
|
const response = await dispatcher.dispatch({
|
|
id: `request-${admissionTier}`,
|
|
authToken: 'token',
|
|
method: 'git.status',
|
|
params: { worktree: 'id:wt-1', admissionTier }
|
|
})
|
|
expect(response.ok).toBe(true)
|
|
}
|
|
|
|
expect(events.filter((event) => event.phase === 'grant').map((event) => event.tier)).toEqual([
|
|
'background',
|
|
'interactive',
|
|
'status'
|
|
])
|
|
})
|
|
})
|