fix(qa): serialize runtime parity cells

This commit is contained in:
Vincent Koc
2026-05-17 04:18:58 +08:00
parent 6d844c5900
commit 640735cebe
2 changed files with 21 additions and 1 deletions

View File

@@ -138,6 +138,25 @@ describe("runtime parity", () => {
expect(result.drift).toBe("none");
});
it("runs runtime cells serially so shared QA state cannot cross-contaminate", async () => {
const events: string[] = [];
const result = await runRuntimeParityScenario({
scenarioId: "serial",
runCell: async (runtime) => {
events.push(`start:${runtime}`);
await Promise.resolve();
events.push(`finish:${runtime}`);
return {
scenarioStatus: "pass",
cell: makeCell(runtime),
};
},
});
expect(result.drift).toBe("none");
expect(events).toEqual(["start:pi", "finish:pi", "start:codex", "finish:codex"]);
});
it("classifies final-text-only differences as text-only", async () => {
const result = await runRuntimeParityScenario({
scenarioId: "text-only",

View File

@@ -910,7 +910,8 @@ export async function runRuntimeParityScenario(params: {
scenarioId: string;
runCell: (runtime: RuntimeId) => Promise<RuntimeParityScenarioExecution>;
}): Promise<RuntimeParityResult> {
const [pi, codex] = await Promise.all([params.runCell("pi"), params.runCell("codex")]);
const pi = await params.runCell("pi");
const codex = await params.runCell("codex");
const drift = classifyRuntimeParityCells({
pi: pi.cell,
codex: codex.cell,