test(orchestration): pin the run receipt internal-column strip

exposeRun had zero coverage: emptying INTERNAL_RUN_COLUMNS left every
suite green. Adds a unit pin on the column set plus an RPC-level pin
through orchestration.runCreate.
This commit is contained in:
Jinwoo-H
2026-09-04 15:19:47 -04:00
parent 9806af4258
commit 453f093467
2 changed files with 77 additions and 0 deletions
@@ -0,0 +1,61 @@
import { describe, expect, it } from 'vitest'
import { exposeRun } from './run-receipt'
import type { RunRow } from '../../../../orchestration/types'
// Why: typecheck cannot see the strip because the RPC return types are loose.
const RUN_ROW: RunRow = {
id: 'run_1',
objective: 'Coordinate reviews',
home_database: '/tmp/orca/orchestration.db',
coordinator_handle: 'term_coord',
coordinator_pane_key: 'tab_coord:11111111-1111-4111-8111-111111111111',
consumer_generation: 3,
legacy: 0,
created_at: '2026-09-04T18:53:07Z',
updated_at: '2026-09-04T18:53:09Z'
}
describe('exposeRun', () => {
it('drops exactly the internal routing columns', () => {
const exposed = exposeRun(RUN_ROW)
expect(Object.keys(exposed).sort()).toEqual([
'consumer_generation',
'coordinator_handle',
'created_at',
'id',
'legacy',
'objective',
'updated_at'
])
expect(exposed).not.toHaveProperty('home_database')
expect(exposed).not.toHaveProperty('coordinator_pane_key')
})
it('preserves every published column by value', () => {
const exposed = exposeRun(RUN_ROW)
expect(exposed).toEqual({
id: 'run_1',
objective: 'Coordinate reviews',
coordinator_handle: 'term_coord',
consumer_generation: 3,
legacy: 0,
created_at: '2026-09-04T18:53:07Z',
updated_at: '2026-09-04T18:53:09Z'
})
})
it('does not mutate the source row', () => {
const row = { ...RUN_ROW }
exposeRun(row)
expect(row).toEqual(RUN_ROW)
})
it('strips the columns even when they are null', () => {
const exposed = exposeRun({ ...RUN_ROW, coordinator_pane_key: null })
expect(exposed).not.toHaveProperty('coordinator_pane_key')
})
})
@@ -90,6 +90,22 @@ describe('orchestration RPC methods', () => {
expect(current.run?.id).toBe(created.run.id)
})
it('publishes a run receipt without internal routing columns', async () => {
setup(false)
vi.spyOn(runtime, 'getTerminalPaneKey').mockReturnValue(
'tab_coord:11111111-1111-4111-8111-111111111111'
)
const created = (await call('orchestration.runCreate', {
objective: 'Coordinate reviews',
from: 'term_coord'
})) as { run: Record<string, unknown> }
expect(created.run).not.toHaveProperty('coordinator_pane_key')
expect(created.run).not.toHaveProperty('home_database')
expect(created.run.consumer_generation).toBe(1)
})
it('requires runtime-observed stable pane identity for binding', async () => {
setup(false)
vi.spyOn(runtime, 'getTerminalPaneKey').mockReturnValue(null)