Skip to content

Commit 88edcd1

Browse files
authored
fix(qa): mark partial suite artifacts as running (#125924)
* fix(qa): mark partial suite artifacts as running Isolated QA suite progress artifacts now identify themselves as running in JSON and Markdown, so completed-prefix results cannot be mistaken for terminal teardown. Final artifacts keep their existing completed shape, with process regression coverage for clean exit and closed Gateway listeners. * test(qa): decouple suite runtime from teardown deadline Allow the real QA scenario to finish under a contended extension shard while keeping the post-summary process exit requirement fixed at 45 seconds. * test(qa): keep lifecycle proof observable Emit a bounded progress heartbeat while the real QA child is still producing its terminal summary so the extension shard watchdog does not mistake a long, active process proof for a stalled Vitest run. * test(qa): isolate lifecycle process environment Run the real QA child outside Vitest and shared compile-cache markers, and fail fast with bounded process output when it exits before publishing a terminal summary. * test(qa): run lifecycle proof on repo gateway Build and launch the real repository Gateway when dist is absent, avoid package-candidate auth bootstrap, and keep the teardown regression bounded and observable in unbuilt extension-test jobs. * test(qa): terminate Windows lifecycle process trees * fix(qa): reject running confidence summaries
1 parent 80934e5 commit 88edcd1

11 files changed

Lines changed: 432 additions & 2 deletions

‎extensions/qa-lab/src/confidence-report.test.ts‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,43 @@ describe("qa confidence report", () => {
9393
expect(renderQaConfidenceMarkdownReport(report)).toContain("Global pass: no");
9494
});
9595

96+
it("uses suite lifecycle status before terminal outcome counts", async () => {
97+
const manifest: QaConfidenceManifest = {
98+
version: 1,
99+
profile: "codex-100",
100+
lanes: [
101+
{
102+
id: "suite",
103+
title: "Suite",
104+
kind: "qa-suite-summary",
105+
artifact: "suite/qa-suite-summary.json",
106+
required: true,
107+
},
108+
],
109+
};
110+
for (const [runStatus, expectedPass, expectedLaneStatus, expectedDetails] of [
111+
["running", false, "unknown", "still running"],
112+
["completed", true, "pass", "counts.failed=0"],
113+
["paused", false, "unknown", "unsupported run.status=paused"],
114+
] as const) {
115+
await writeJson("suite/qa-suite-summary.json", {
116+
run: { status: runStatus },
117+
counts: { total: 1, passed: 1, skipped: 0, failed: 0 },
118+
scenarios: [{ name: "completed prefix", status: "pass" }],
119+
});
120+
121+
const report = await buildQaConfidenceReport({
122+
manifest,
123+
artifactRoot: tempRoot,
124+
strictGlobalPass: true,
125+
});
126+
127+
expect(report.pass).toBe(expectedPass);
128+
expect(report.lanes[0]).toMatchObject({ status: expectedLaneStatus });
129+
expect(report.lanes[0]?.details).toContain(expectedDetails);
130+
}
131+
});
132+
96133
it("does not let optional lanes block strict gates", async () => {
97134
await writeJson("required/qa-suite-summary.json", {
98135
counts: { total: 1, passed: 1, skipped: 0, failed: 0 },

‎extensions/qa-lab/src/confidence-report.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,17 @@ function evaluateQaSuiteSummary(payload: unknown): QaConfidenceLaneEvaluation {
365365
details: "qa-suite-summary payload was not an object",
366366
};
367367
}
368+
const runStatus = isRecord(payload.run) ? payload.run.status : undefined;
369+
if (runStatus !== undefined && runStatus !== "completed") {
370+
return {
371+
passed: false,
372+
status: "unknown",
373+
details:
374+
runStatus === "running"
375+
? "qa-suite-summary is still running"
376+
: `qa-suite-summary has unsupported run.status=${readString(runStatus) ?? typeof runStatus}`,
377+
};
378+
}
368379
const accountingError = findQaSuiteSummaryAccountingError(payload);
369380
if (accountingError) {
370381
return {

‎extensions/qa-lab/src/report.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ function formatQaReportCheck(check: QaReportCheck, indent = "") {
2828

2929
export function renderQaMarkdownReport(params: {
3030
title: string;
31+
inProgress?: boolean;
3132
startedAt: Date;
3233
finishedAt: Date;
3334
checks?: QaReportCheck[];
@@ -48,10 +49,11 @@ export function renderQaMarkdownReport(params: {
4849
scenarios.filter((scenario) => scenario.status === "skip").length;
4950

5051
const lines = [
51-
`# ${params.title}`,
52+
`# ${params.title}${params.inProgress ? " (In Progress)" : ""}`,
5253
"",
54+
...(params.inProgress ? ["- Status: running"] : []),
5355
`- Started: ${params.startedAt.toISOString()}`,
54-
`- Finished: ${params.finishedAt.toISOString()}`,
56+
`- ${params.inProgress ? "Updated" : "Finished"}: ${params.finishedAt.toISOString()}`,
5557
`- Duration ms: ${params.finishedAt.getTime() - params.startedAt.getTime()}`,
5658
`- Passed: ${passCount}`,
5759
`- Failed: ${failCount}`,

‎extensions/qa-lab/src/suite-artifacts.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export async function publishQaSuiteArtifactFiles(params: {
4949
}
5050

5151
export type QaSuiteSummaryJsonParams = {
52+
status?: QaSuiteSummaryJson["run"]["status"];
5253
scenarios: QaSuiteScenarioResult[];
5354
startedAt: Date;
5455
finishedAt: Date;
@@ -108,6 +109,7 @@ export function buildQaSuiteSummaryJson(params: QaSuiteSummaryJsonParams): QaSui
108109
...(params.metrics ? { metrics: params.metrics } : {}),
109110
...(params.evidence ? { evidence: params.evidence } : {}),
110111
run: {
112+
status: params.status ?? "completed",
111113
startedAt: params.startedAt.toISOString(),
112114
finishedAt: params.finishedAt.toISOString(),
113115
providerMode: params.providerMode,
@@ -131,6 +133,7 @@ export function buildQaSuiteSummaryJson(params: QaSuiteSummaryJsonParams): QaSui
131133
}
132134

133135
export async function writeQaSuiteArtifacts(params: {
136+
status?: QaSuiteSummaryJson["run"]["status"];
134137
repoRoot?: string;
135138
outputDir: string;
136139
startedAt: Date;
@@ -195,6 +198,7 @@ export async function writeQaSuiteArtifacts(params: {
195198
: crablineChannelDriverSelection;
196199
const report = renderQaMarkdownReport({
197200
title: "OpenClaw QA Scenario Suite",
201+
inProgress: params.status === "running",
198202
startedAt: params.startedAt,
199203
finishedAt: params.finishedAt,
200204
checks: [],
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import path from "node:path";
2+
import { fileURLToPath } from "node:url";
3+
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
4+
import { resolveQaGatewayChildCommand } from "./gateway-child-command.js";
5+
import { runQaSuite } from "./suite-launch.runtime.js";
6+
7+
const repoRoot = fileURLToPath(new URL("../../../", import.meta.url));
8+
const outputDir = process.argv[2];
9+
const scenarioIds = process.argv.slice(3);
10+
11+
if (!outputDir || scenarioIds.length === 0) {
12+
throw new Error("suite process fixture requires an output directory and scenario ids");
13+
}
14+
15+
try {
16+
const sutOpenClawCommand = {
17+
...resolveQaGatewayChildCommand(repoRoot),
18+
usePackagedPlugins: false,
19+
};
20+
const result = await runQaSuite({
21+
repoRoot,
22+
outputDir: path.relative(repoRoot, outputDir),
23+
providerMode: "mock-openai",
24+
scenarioIds,
25+
concurrency: 4,
26+
sutOpenClawCommand,
27+
});
28+
const failed = result.result.scenarios.filter((scenario) => scenario.status !== "pass");
29+
if (failed.length > 0) {
30+
throw new Error(`suite process fixture failed ${failed.length} scenario(s)`);
31+
}
32+
} catch (error) {
33+
process.stderr.write(`${formatErrorMessage(error)}\n`);
34+
process.exitCode = 1;
35+
}

0 commit comments

Comments
 (0)