Files
orca/config/scripts/node-server-packaged-chat-selection.test.mjs
T
Brennan Benson c9097ac991 test: run a structured chat against the packaged headless server (#26527)
* fix: preserve module URLs in the headless server bundle

* test: exercise structured chat on the packaged Node server

* test(orcad): run the packaged chat check from the desktop's server template

The chat check loaded the server bundle directly, so a desktop build missing its
server template still passed. Materialize the slot from the built template the way
the desktop does, and replace the fixed streaming pause with a test-owned
acknowledgement so the partial-reply assertion can't race.

* Connect the packaged chat test through a paired connection

Main now sends remote runtime requests over a paired connection rather than a
pairing offer, so the test converts the server's offer once when it is ready.
2026-10-11 17:46:15 -07:00

43 lines
2.0 KiB
JavaScript

import { readFileSync } from 'node:fs'
import { expect, it } from 'vitest'
import { parse } from 'yaml'
import { classifyNodeServerChanges } from './node-server-change-scope.mjs'
import { nodeServerTestPaths } from './node-server-test-paths.mjs'
it.each([
'src/main/orcad/orcad-packaged-structured-chat.integration.test.ts',
'src/main/runtime/new-launch-path.ts',
'src/main/claude/__fixtures__/claude-agent-sdk-scripted-cli.mjs',
'config/scripts/orcad-entry-build.mjs',
'config/scripts/future-orcad-package.mjs'
])('runs the packaged structured chat when its inputs change: %s', async (file) => {
expect((await classifyNodeServerChanges([file], async () => new Set())).shouldRun).toBe(true)
})
it('runs a real structured chat on Linux from the built desktop template', () => {
const workflow = parse(readFileSync('.github/workflows/node-server-tests.yml', 'utf8'))
const steps = workflow.jobs.persistence.steps
const chat = steps.find((step) =>
step.run?.includes('orcad-packaged-structured-chat.integration.test.ts')
)
expect(chat.if).toBe("runner.os == 'Linux'")
expect(chat.run).toBe(
'pnpm test:node-server --artifact src/main/orcad/orcad-packaged-structured-chat.integration.test.ts --maxWorkers=2'
)
const template = steps.find((step) => step.run?.includes('build-orcad-template.mjs --targets'))
expect(template.if).toBe("runner.os == 'Linux'")
expect(template.run).toBe(
"node config/scripts/build-orcad-template.mjs --targets linux-${{ runner.arch == 'ARM64' && 'arm64' || 'x64' }}-glibc"
)
expect(steps.indexOf(template)).toBeGreaterThan(
steps.findIndex((step) => step.run === 'pnpm build:orcad')
)
expect(steps.indexOf(chat)).toBeGreaterThan(steps.indexOf(template))
expect(template['continue-on-error']).toBeUndefined()
expect(chat['continue-on-error']).toBeUndefined()
// Default --artifact runs have no template, so a required-input failure would follow.
expect(nodeServerTestPaths({ artifact: true, crossRuntime: true })).not.toContain(
'src/main/orcad/orcad-packaged-structured-chat.integration.test.ts'
)
})