Skip to content

Commit b21749b

Browse files
committed
fix(qa): honor explicit scenario lanes in unified runtime suites
1 parent cd82c72 commit b21749b

2 files changed

Lines changed: 78 additions & 5 deletions

File tree

‎extensions/qa-lab/src/suite-launch.runtime.ts‎

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ import {
2424
readQaBootstrapScenarioCatalog,
2525
type QaSeedScenarioWithSource,
2626
} from "./scenario-catalog.js";
27-
import { resolveQaScenarioLaneChannel, resolveQaScenarioLaneChannels } from "./scenario-lane.js";
27+
import {
28+
resolveQaScenarioLaneChannel,
29+
resolveQaScenarioLaneChannels,
30+
resolveQaScenarioRequiredProviderMode,
31+
} from "./scenario-lane.js";
2832
import {
2933
mapQaSuiteWithConcurrency,
3034
normalizeQaSuiteConcurrency,
@@ -675,6 +679,18 @@ async function runUnifiedQaSuite(params: {
675679
const startedAt = new Date();
676680
const repoRoot = path.resolve(params.runParams?.repoRoot ?? process.cwd());
677681
const outputDir = await resolveQaSuiteOutputDir(repoRoot, params.runParams?.outputDir);
682+
// Only an explicitly selected single flow may replace the unified suite's mock default.
683+
const [selectedScenario] = params.plan.scenarios;
684+
const selectedProviderMode =
685+
params.runParams?.providerMode === undefined &&
686+
params.runParams?.scenarioIds?.length === 1 &&
687+
params.plan.scenarios.length === 1 &&
688+
selectedScenario?.execution.kind === "flow"
689+
? resolveQaScenarioRequiredProviderMode(selectedScenario)
690+
: undefined;
691+
const providerMode = normalizeQaProviderMode(
692+
params.runParams?.providerMode ?? selectedProviderMode ?? DEFAULT_QA_PROVIDER_MODE,
693+
);
678694
const progress = params.runParams?.lab
679695
? createQaSuiteProgressController({
680696
lab: params.runParams.lab,
@@ -683,9 +699,6 @@ async function runUnifiedQaSuite(params: {
683699
})
684700
: undefined;
685701
progress?.start();
686-
const providerMode = normalizeQaProviderMode(
687-
params.runParams?.providerMode ?? DEFAULT_QA_PROVIDER_MODE,
688-
);
689702
const primaryModel =
690703
params.runParams?.primaryModel?.trim() || defaultQaModelForMode(providerMode);
691704
const alternateModel =

‎extensions/qa-lab/src/suite-provider-selection.test.ts‎

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
// 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";
33
import os from "node:os";
44
import path from "node:path";
55
import { describe, expect, it, vi } from "vitest";
66
import { requireFlowScenario } from "./scenario-catalog.test-utils.js";
7+
import { runQaSuite } from "./suite-launch.runtime.js";
78
import { selectQaFlowSuiteScenarios } from "./suite-planning.js";
89
import { runQaFlowSuiteFromRuntime } from "./suite-run.runtime.js";
910
import { makeQaSuiteTestScenario } from "./suite-test-helpers.js";
@@ -100,6 +101,65 @@ describe("qa suite provider selection", () => {
100101
}
101102
});
102103

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+
103163
it("rejects an explicit provider override that conflicts with a config-only scenario pin", async () => {
104164
const repoRoot = await mkdtemp(path.join(os.tmpdir(), "qa-suite-explicit-provider-"));
105165
const startLab = vi.fn();

0 commit comments

Comments
 (0)