|
1 | 1 | // QA Lab suite selection keeps scenario requirements on their declared provider lane. |
2 | | -import { mkdtemp, rm } from "node:fs/promises"; |
| 2 | +import { mkdtemp, readFile, rm } from "node:fs/promises"; |
3 | 3 | import os from "node:os"; |
4 | 4 | import path from "node:path"; |
5 | 5 | import { describe, expect, it, vi } from "vitest"; |
6 | 6 | import { requireFlowScenario } from "./scenario-catalog.test-utils.js"; |
| 7 | +import { runQaSuite } from "./suite-launch.runtime.js"; |
7 | 8 | import { selectQaFlowSuiteScenarios } from "./suite-planning.js"; |
8 | 9 | import { runQaFlowSuiteFromRuntime } from "./suite-run.runtime.js"; |
9 | 10 | import { makeQaSuiteTestScenario } from "./suite-test-helpers.js"; |
@@ -100,6 +101,65 @@ describe("qa suite provider selection", () => { |
100 | 101 | } |
101 | 102 | }); |
102 | 103 |
|
| 104 | + it("adopts a single runtime-partitioned flow scenario's required provider", async () => { |
| 105 | + const repoRoot = await mkdtemp(path.join(os.tmpdir(), "qa-suite-unified-provider-")); |
| 106 | + const startLab = vi.fn(async () => { |
| 107 | + throw new Error("selected unified provider lane reached lab startup"); |
| 108 | + }); |
| 109 | + |
| 110 | + try { |
| 111 | + const result = await runQaSuite({ |
| 112 | + repoRoot, |
| 113 | + scenarioIds: ["long-context-progress-watchdog"], |
| 114 | + startLab, |
| 115 | + }); |
| 116 | + |
| 117 | + expect(result.executionKind).toBe("suite"); |
| 118 | + expect(startLab).toHaveBeenCalledOnce(); |
| 119 | + expect(result.result.scenarios).toEqual([ |
| 120 | + expect.objectContaining({ |
| 121 | + status: "fail", |
| 122 | + details: expect.stringContaining("selected unified provider lane reached lab startup"), |
| 123 | + }), |
| 124 | + ]); |
| 125 | + const summary = JSON.parse(await readFile(result.result.summaryPath, "utf8")) as { |
| 126 | + run: { providerMode: string; primaryModel: string; alternateModel: string }; |
| 127 | + }; |
| 128 | + expect(summary.run).toMatchObject({ |
| 129 | + providerMode: "live-frontier", |
| 130 | + primaryModel: expect.stringMatching(/^openai\//), |
| 131 | + alternateModel: expect.stringMatching(/^openai\//), |
| 132 | + }); |
| 133 | + } finally { |
| 134 | + await rm(repoRoot, { recursive: true, force: true }); |
| 135 | + } |
| 136 | + }); |
| 137 | + |
| 138 | + it("keeps an explicit unified provider override ahead of a scenario requirement", async () => { |
| 139 | + const repoRoot = await mkdtemp(path.join(os.tmpdir(), "qa-suite-unified-override-")); |
| 140 | + const startLab = vi.fn(); |
| 141 | + |
| 142 | + try { |
| 143 | + const result = await runQaSuite({ |
| 144 | + repoRoot, |
| 145 | + providerMode: "mock-openai", |
| 146 | + scenarioIds: ["long-context-progress-watchdog"], |
| 147 | + startLab, |
| 148 | + }); |
| 149 | + |
| 150 | + expect(result.executionKind).toBe("suite"); |
| 151 | + expect(startLab).not.toHaveBeenCalled(); |
| 152 | + expect(result.result.scenarios).toEqual([ |
| 153 | + expect.objectContaining({ |
| 154 | + status: "fail", |
| 155 | + details: expect.stringContaining("providerMode=live-frontier"), |
| 156 | + }), |
| 157 | + ]); |
| 158 | + } finally { |
| 159 | + await rm(repoRoot, { recursive: true, force: true }); |
| 160 | + } |
| 161 | + }); |
| 162 | + |
103 | 163 | it("rejects an explicit provider override that conflicts with a config-only scenario pin", async () => { |
104 | 164 | const repoRoot = await mkdtemp(path.join(os.tmpdir(), "qa-suite-explicit-provider-")); |
105 | 165 | const startLab = vi.fn(); |
|
0 commit comments