test(qa): enforce live voice model

This commit is contained in:
Vincent Koc
2026-08-02 19:54:38 +08:00
parent f5712a930b
commit 54cb02151f
3 changed files with 27 additions and 4 deletions
@@ -66,6 +66,7 @@ describe("qa scenario catalog", () => {
| {
requiredProviderMode?: string;
requiredProvider?: string;
requiredModel?: string;
expectedMarker?: string;
}
| undefined;
@@ -90,6 +91,7 @@ describe("qa scenario catalog", () => {
});
expect(config?.requiredProviderMode).toBe("live-frontier");
expect(config?.requiredProvider).toBe("openai");
expect(config?.requiredModel).toBe("gpt-5.4");
expect(config?.expectedMarker).toBe("MATRIX QA VOICE PREFLIGHT OK");
expect(JSON.stringify(scenario.execution.flow)).toContain("./voice-preflight.fixture.js");
expect(JSON.stringify(scenario.execution.flow)).not.toContain("./live-transports/matrix/");
@@ -3,7 +3,26 @@ import { describe, expect, it } from "vitest";
import { createQaBusState } from "./bus-state.js";
import { runLoadedScenarioFlow } from "./scenario-flow-runner.test-support.js";
function splitModelRef(ref: string) {
const slash = ref.indexOf("/");
return slash > 0 ? { provider: ref.slice(0, slash), model: ref.slice(slash + 1) } : null;
}
describe("live inbound voice talkback scenario", () => {
it("rejects a live OpenAI model outside the scenario contract", async () => {
await expect(
runLoadedScenarioFlow("inbound-voice-talkback-live", {
api: {
env: {
providerMode: "live-frontier",
primaryModel: "openai/gpt-5.4-mini",
},
splitModelRef,
},
}),
).rejects.toThrow("expected live primary model gpt-5.4, got openai/gpt-5.4-mini");
});
it("reuses the spoken WAV fixture and ignores a deleted streaming preview", async () => {
const state = createQaBusState();
const expectedReply = "Matrix QA voice pre-flight OK.";
@@ -20,10 +39,7 @@ describe("live inbound voice talkback scenario", () => {
},
},
},
splitModelRef: (ref: string) => {
const slash = ref.indexOf("/");
return slash > 0 ? { provider: ref.slice(0, slash), model: ref.slice(slash + 1) } : null;
},
splitModelRef,
markGatewayLogCursor: () => 0,
readGatewayLogs: () => "",
resolveQaLiveTurnTimeoutMs: (_env: unknown, timeoutMs: number) => timeoutMs,
@@ -41,6 +41,7 @@ scenario:
config:
requiredProviderMode: live-frontier
requiredProvider: openai
requiredModel: gpt-5.4
conversationId: qa-live-voice-talkback
expectedMarker: MATRIX QA VOICE PREFLIGHT OK
expectedMarkerNormalized: MATRIXQAVOICEPREFLIGHTOK
@@ -59,6 +60,10 @@ flow:
expr: "selected?.provider === config.requiredProvider"
message:
expr: "`expected live primary provider ${config.requiredProvider}, got ${env.primaryModel}`"
- assert:
expr: "selected?.model === config.requiredModel"
message:
expr: "`expected live primary model ${config.requiredModel}, got ${env.primaryModel}`"
- assert:
expr: "Boolean(env.gateway.runtimeEnv.OPENAI_API_KEY?.trim() || env.gateway.runtimeEnv.OPENCLAW_LIVE_OPENAI_KEY?.trim())"
message: live OpenAI API key did not reach the Gateway child