Skip to content

Commit 6521671

Browse files
committed
refactor(qa): make taxonomy coverage ids unique
1 parent 3372088 commit 6521671

382 files changed

Lines changed: 3761 additions & 2721 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎extensions/qa-lab/src/ci-smoke-plan.test.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ describe("createQaSmokeCiPart", () => {
5555
scenarioIds.map((scenarioId) => scenarioById.get(scenarioId)?.sourcePath),
5656
);
5757
const scorecardReport = readQaScorecardTaxonomyReport([...scenarioById.values()]);
58+
const smokeScenarioRefs = new Set(
59+
scorecardReport.categories
60+
.filter((category) => category.profiles.includes("smoke-ci"))
61+
.flatMap((category) => category.scenarioRefs),
62+
);
63+
expect(
64+
[...selectedScenarioPaths].every(
65+
(scenarioPath) => scenarioPath !== undefined && smokeScenarioRefs.has(scenarioPath),
66+
),
67+
).toBe(true);
5868
const uncoveredCategoryIds = scorecardReport.categories
5969
.filter((category) => category.profiles.includes("smoke-ci"))
6070
.filter((category) => !category.scenarioRefs.some((ref) => selectedScenarioPaths.has(ref)))

‎extensions/qa-lab/src/cli.runtime.test.ts‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -383,15 +383,15 @@ describe("qa cli runtime", () => {
383383
{
384384
test: {
385385
kind: "qa-scenario",
386-
id: "dm-chat-baseline",
387-
title: "DM baseline conversation",
386+
id: "channel-top-level-reply-shape",
387+
title: "Channel top-level reply shape",
388388
source: {
389-
path: "qa/scenarios/channels/dm-chat-baseline.yaml",
389+
path: "qa/scenarios/channels/channel-top-level-reply-shape.yaml",
390390
},
391391
},
392392
coverage: [
393393
{
394-
id: "channels.dm",
394+
id: "channel-framework.automatic-final-reply-delivery-group-visible-replies",
395395
role: "primary",
396396
},
397397
],
@@ -439,8 +439,8 @@ describe("qa cli runtime", () => {
439439
outputDir: ".artifacts/qa-e2e/smoke-ci",
440440
profile: "smoke-ci",
441441
surface: "channel-framework",
442-
category: "channel-framework.conversation-routing-and-delivery",
443-
scenarioIds: ["dm-chat-baseline"],
442+
category: "channel-framework.outbound-delivery-and-reply-pipeline",
443+
scenarioIds: ["channel-top-level-reply-shape"],
444444
transportId: "qa-channel",
445445
fastMode: true,
446446
concurrency: 2,
@@ -461,7 +461,7 @@ describe("qa cli runtime", () => {
461461
channel: "telegram",
462462
channelDriver: "crabline",
463463
});
464-
expect(suiteArgs.scenarioIds).toEqual(["dm-chat-baseline"]);
464+
expect(suiteArgs.scenarioIds).toEqual(["channel-top-level-reply-shape"]);
465465
expect(process.env.OPENCLAW_QA_PROFILE).toBe("release");
466466
const evidence = JSON.parse(await fs.readFile(suiteEvidencePath, "utf8")) as {
467467
evidenceMode?: unknown;
@@ -489,13 +489,13 @@ describe("qa cli runtime", () => {
489489
expect(evidence.scorecard).not.toHaveProperty("profile");
490490
expect(evidence.scorecard?.coverageIds?.fulfilled).toBe(1);
491491
expect(evidence.scorecard?.categoryReports?.[0]).toMatchObject({
492-
id: "channel-framework.conversation-routing-and-delivery",
492+
id: "channel-framework.outbound-delivery-and-reply-pipeline",
493493
coverageIds: {
494494
fulfilled: 1,
495495
},
496496
});
497497
expect(evidence.entries?.[0]).not.toHaveProperty("execution");
498-
expect(JSON.stringify(evidence.scorecard)).not.toContain("dm-chat-baseline");
498+
expect(JSON.stringify(evidence.scorecard)).not.toContain("channel-top-level-reply-shape");
499499
expectWriteContains(stdoutWrite, "QA run profile: smoke-ci; categories: 1; scenarios:");
500500
expectWriteContains(stdoutWrite, `QA profile scorecard: ${suiteEvidencePath}`);
501501
} finally {
@@ -568,12 +568,12 @@ describe("qa cli runtime", () => {
568568
await runQaProfileCommand({
569569
repoRoot: "/tmp/openclaw-repo",
570570
profile: "smoke-ci",
571-
scenarioIds: ["dm-chat-baseline", "instruction-followthrough-repo-contract"],
571+
scenarioIds: ["channel-top-level-reply-shape", "control-ui-qa-channel-image-roundtrip"],
572572
});
573573

574574
const suiteArgs = mockFirstObjectArg(runQaSuite);
575575
expect(suiteArgs.channelDriver).toBe("crabline");
576-
expect(suiteArgs.scenarioIds).toEqual(["dm-chat-baseline"]);
576+
expect(suiteArgs.scenarioIds).toEqual(["channel-top-level-reply-shape"]);
577577
expect(suiteArgs.scenarioIds).not.toEqual(
578578
expect.arrayContaining([
579579
"instruction-followthrough-repo-contract",
@@ -636,11 +636,11 @@ describe("qa cli runtime", () => {
636636
runQaProfileCommand({
637637
repoRoot: "/tmp/openclaw-repo",
638638
profile: "smoke-ci",
639-
category: "channel-framework.conversation-routing-and-delivery",
639+
category: "channel-framework.outbound-delivery-and-reply-pipeline",
640640
scenarioIds: ["not-a-real-scenario"],
641641
}),
642642
).rejects.toThrow(
643-
"qa run did not find taxonomy scenarios for --qa-profile smoke-ci --category channel-framework.conversation-routing-and-delivery --scenario not-a-real-scenario.",
643+
"qa run did not find taxonomy scenarios for --qa-profile smoke-ci --category channel-framework.outbound-delivery-and-reply-pipeline --scenario not-a-real-scenario.",
644644
);
645645
expect(runQaSuite).not.toHaveBeenCalled();
646646
});
@@ -2024,7 +2024,7 @@ describe("qa cli runtime", () => {
20242024
await runQaCoverageReportCommand({ repoRoot: process.cwd() });
20252025

20262026
expectWriteContains(stdoutWrite, "# QA Coverage Inventory");
2027-
expectWriteContains(stdoutWrite, "memory.recall");
2027+
expectWriteContains(stdoutWrite, "session-memory-and-context-engine.embedding-search-recall");
20282028
});
20292029
});
20302030

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { z } from "zod";
2+
3+
export const qaCoverageIdSchema = z
4+
.string()
5+
.trim()
6+
.regex(/^[a-z0-9][a-z0-9-]*\.[a-z0-9][a-z0-9-]*$/, {
7+
message: "coverage ids must use exactly <surface-id>.<feature-id>",
8+
});

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

Lines changed: 65 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import { readQaScenarioPack, type QaSeedScenarioWithSource } from "./scenario-ca
1212
import { readQaScorecardTaxonomyReport, type QaMaturityTaxonomy } from "./scorecard-taxonomy.js";
1313

1414
const TEST_EXECUTABLE_CATEGORY_ID = "agent-runtime-and-provider-execution.agent-turn-execution";
15-
const TEST_EXECUTABLE_COVERAGE_ID = "channels.dm";
15+
const TEST_EXECUTABLE_COVERAGE_ID = "agent-runtime-and-provider-execution.dm";
1616
const TEST_BROWSER_CATEGORY_ID = "browser-control-ui-and-webchat.browser-ui";
17-
const TEST_BROWSER_COVERAGE_ID = "ui.control";
18-
const TEST_WEBCHAT_COVERAGE_ID = "ui.webchat";
19-
const DOTTED_COVERAGE_ID_PATTERN = /^[a-z0-9][a-z0-9-]*(?:\.[a-z0-9][a-z0-9-]*)+$/;
17+
const TEST_BROWSER_COVERAGE_ID = "browser-control-ui-and-webchat.gateway-hosted-ui-control";
18+
const TEST_WEBCHAT_COVERAGE_ID = "agent-runtime-and-provider-execution.webchat";
19+
const TWO_PART_COVERAGE_ID_PATTERN = /^[a-z0-9][a-z0-9-]*\.[a-z0-9][a-z0-9-]*$/;
2020

2121
function buildQaScorecardTaxonomyReport(params: {
2222
taxonomy: QaMaturityTaxonomy;
@@ -35,7 +35,6 @@ function buildQaScorecardTaxonomyReport(params: {
3535
function testMaturityTaxonomy(params?: {
3636
categoryId?: string;
3737
coverageIds?: readonly string[];
38-
featureCoverageIds?: readonly (readonly string[])[];
3938
includeAllCategories?: boolean;
4039
includeArchivedSurface?: boolean;
4140
}): QaMaturityTaxonomy {
@@ -76,14 +75,9 @@ function testMaturityTaxonomy(params?: {
7675
category_note: "test-category.md",
7776
docs: [],
7877
search_anchors: [],
79-
features: (
80-
params?.featureCoverageIds ??
81-
(params?.coverageIds ?? [TEST_EXECUTABLE_COVERAGE_ID]).map((coverageId) => [
82-
coverageId,
83-
])
84-
).map((coverageIds) => ({
85-
name: coverageIds.join(" + "),
86-
coverageIds: [...coverageIds],
78+
features: (params?.coverageIds ?? [TEST_EXECUTABLE_COVERAGE_ID]).map((coverageId) => ({
79+
name: coverageId,
80+
coverageIds: [coverageId],
8781
})),
8882
},
8983
],
@@ -103,7 +97,12 @@ function testMaturityTaxonomy(params?: {
10397
category_note: "legacy-category.md",
10498
docs: [],
10599
search_anchors: [],
106-
features: [{ name: "legacy.feature", coverageIds: ["legacy.feature"] }],
100+
features: [
101+
{
102+
name: "Legacy feature",
103+
coverageIds: ["archived-surface.legacy-feature"],
104+
},
105+
],
107106
},
108107
],
109108
},
@@ -215,7 +214,7 @@ describe("qa coverage report", () => {
215214
expect(
216215
inventory.scorecardTaxonomy.categories
217216
.flatMap((category) => category.coverageIds)
218-
.every((coverageId) => DOTTED_COVERAGE_ID_PATTERN.test(coverageId)),
217+
.every((coverageId) => TWO_PART_COVERAGE_ID_PATTERN.test(coverageId)),
219218
).toBe(true);
220219
expect(inventory.scorecardTaxonomy.validationIssues.length).toBeGreaterThan(0);
221220
expect(
@@ -247,16 +246,20 @@ describe("qa coverage report", () => {
247246
const observabilityPack = inventory.scenarioPacks.find((pack) => pack.id === "observability");
248247
expect(personalPack?.missingScenarioIds).toStrictEqual([]);
249248
expect(personalPack?.scenarioIds).toContain("personal-share-safe-diagnostics-artifact");
250-
expect(personalPack?.coverageIds).toContain("personal.redaction");
249+
expect(personalPack?.coverageIds).toContain(
250+
"security-auth-pairing-and-secrets.redaction-personal-redaction",
251+
);
251252
expect(observabilityPack?.missingScenarioIds).toStrictEqual([]);
252253
expect(observabilityPack?.scenarioIds).toEqual(["otel-trace-smoke", "docker-prometheus-smoke"]);
253-
expect(observabilityPack?.coverageIds).toContain("telemetry.prometheus");
254+
expect(observabilityPack?.coverageIds).toContain(
255+
"telemetry-diagnostics-and-observability.prometheus-text-exposition",
256+
);
254257
expect(
255258
expectDefined(inventory.byTheme.memory, "memory QA theme").map((coverage) => coverage.id),
256-
).toContain("memory.recall");
259+
).toContain("session-memory-and-context-engine.memory-search-and-store-tools-recall");
257260
expect(
258261
expectDefined(inventory.bySurface.memory, "memory QA surface").map((coverage) => coverage.id),
259-
).toContain("memory.recall");
262+
).toContain("session-memory-and-context-engine.memory-search-and-store-tools-recall");
260263
});
261264

262265
it("rejects duplicate ownership across YAML and non-YAML catalogs", () => {
@@ -288,7 +291,7 @@ describe("qa coverage report", () => {
288291
expect(report).toContain("# QA Coverage Inventory");
289292
expect(report).toContain("- Missing coverage metadata: 0");
290293
expect(report).toContain("- Overlapping coverage IDs:");
291-
expect(report).toContain("memory.recall");
294+
expect(report).toContain("session-memory-and-context-engine.embedding-search-recall");
292295
expect(report).toContain("primary: memory-recall (qa/scenarios/memory/memory-recall.yaml)");
293296
expect(report).toContain("secondary: active-memory-preprompt-recall");
294297
expect(report).toContain("## Scenario Packs");
@@ -307,9 +310,11 @@ describe("qa coverage report", () => {
307310
expect(report).toContain("- Inventory refs:");
308311
expect(report).toContain("- Scenario coverage IDs:");
309312
expect(report).toContain(
310-
"- browser-automation-and-exec-sandbox-tools.tool-invocation-and-execution (browser-automation-and-exec-sandbox-tools / Tool Invocation and Execution; partial): profiles: all, release, smoke-ci; coverage IDs:",
313+
"- browser-automation-and-exec-sandbox-tools.tool-invocation-and-execution (browser-automation-and-exec-sandbox-tools / Tool Invocation and Execution; partial): profiles: all, release; coverage IDs:",
314+
);
315+
expect(report).toContain(
316+
"primary:playwright:ui/src/e2e/chat-flow.e2e.test.ts (browser-control-ui-and-webchat.gateway-hosted-ui-control)",
311317
);
312-
expect(report).toContain("primary:playwright:ui/src/e2e/chat-flow.e2e.test.ts (ui.control)");
313318
expect(report).not.toContain("### Unknown Scenario Coverage IDs");
314319
});
315320

@@ -497,7 +502,7 @@ describe("qa coverage report", () => {
497502
it("counts partial coverage IDs proportionately for taxonomy inventory", () => {
498503
const report = buildQaScorecardTaxonomyReport({
499504
taxonomy: testMaturityTaxonomy({
500-
featureCoverageIds: [[TEST_EXECUTABLE_COVERAGE_ID, TEST_WEBCHAT_COVERAGE_ID]],
505+
coverageIds: [TEST_EXECUTABLE_COVERAGE_ID, TEST_WEBCHAT_COVERAGE_ID],
501506
}),
502507
repoRoot: process.cwd(),
503508
scenarios: [
@@ -525,7 +530,7 @@ describe("qa coverage report", () => {
525530
);
526531
});
527532

528-
it("counts each required taxonomy coverage ID once across categories", () => {
533+
it("rejects one coverage ID assigned to different exact features", () => {
529534
const taxonomy: QaMaturityTaxonomy = {
530535
...testMaturityTaxonomy(),
531536
profiles: [
@@ -534,10 +539,7 @@ describe("qa coverage report", () => {
534539
description: "Test release profile.",
535540
includeAllCategories: false,
536541
channelDriver: "qa-channel",
537-
categoryIds: [
538-
"agent-runtime-and-provider-execution.agent-turn-execution",
539-
"agent-runtime-and-provider-execution.tool-execution-controls",
540-
],
542+
categoryIds: ["agent-runtime-and-provider-execution.agent-turn-execution"],
541543
},
542544
],
543545
surfaces: [
@@ -555,18 +557,9 @@ describe("qa coverage report", () => {
555557
search_anchors: [],
556558
features: [
557559
{
558-
name: "shared plus unique",
559-
coverageIds: [TEST_EXECUTABLE_COVERAGE_ID, TEST_WEBCHAT_COVERAGE_ID],
560+
name: "shared",
561+
coverageIds: [TEST_EXECUTABLE_COVERAGE_ID],
560562
},
561-
],
562-
},
563-
{
564-
id: "tool-execution-controls",
565-
name: "Tool Execution Controls",
566-
category_note: "tool-execution-controls.md",
567-
docs: [],
568-
search_anchors: [],
569-
features: [
570563
{
571564
name: "shared",
572565
coverageIds: [TEST_EXECUTABLE_COVERAGE_ID],
@@ -577,21 +570,40 @@ describe("qa coverage report", () => {
577570
},
578571
],
579572
};
580-
const report = buildQaScorecardTaxonomyReport({
581-
taxonomy,
582-
repoRoot: process.cwd(),
583-
scenarios: [
584-
scenarioWithCoverage({
585-
primary: [TEST_EXECUTABLE_COVERAGE_ID],
586-
secondary: [TEST_WEBCHAT_COVERAGE_ID],
587-
sourcePath: "qa/scenarios/channels/dm-chat-baseline.yaml",
588-
}),
589-
],
590-
});
573+
expect(() =>
574+
buildQaScorecardTaxonomyReport({
575+
taxonomy,
576+
repoRoot: process.cwd(),
577+
scenarios: [],
578+
}),
579+
).toThrow(
580+
`coverage ID ${TEST_EXECUTABLE_COVERAGE_ID} already belongs to agent-runtime-and-provider-execution.agent-turn-execution feature shared; coverage IDs must identify exactly one taxonomy feature`,
581+
);
582+
});
591583

592-
expect(report.requiredCoverageIdCount).toBe(2);
593-
expect(report.inventoriedCoverageIdCount).toBe(1);
594-
expect(report.coverageIdInventoryPercent).toBe(50);
584+
it("requires one two-part ID owned by each exact taxonomy feature", () => {
585+
const taxonomy = testMaturityTaxonomy();
586+
const feature = expectDefined(
587+
taxonomy.surfaces[0]?.categories[0]?.features[0],
588+
"test taxonomy feature",
589+
);
590+
feature.coverageIds = [TEST_EXECUTABLE_COVERAGE_ID, TEST_WEBCHAT_COVERAGE_ID];
591+
592+
expect(() =>
593+
buildQaScorecardTaxonomyReport({ taxonomy, repoRoot: process.cwd(), scenarios: [] }),
594+
).toThrow("taxonomy features must define exactly one coverage ID");
595+
596+
feature.coverageIds = ["agent-runtime-and-provider-execution.delivery.group"];
597+
expect(() =>
598+
buildQaScorecardTaxonomyReport({ taxonomy, repoRoot: process.cwd(), scenarios: [] }),
599+
).toThrow("coverage ids must use exactly <surface-id>.<feature-id>");
600+
601+
feature.coverageIds = [TEST_BROWSER_COVERAGE_ID];
602+
expect(() =>
603+
buildQaScorecardTaxonomyReport({ taxonomy, repoRoot: process.cwd(), scenarios: [] }),
604+
).toThrow(
605+
`coverage ID ${TEST_BROWSER_COVERAGE_ID} must belong to surface agent-runtime-and-provider-execution`,
606+
);
595607
});
596608

597609
it("inventories script producer declarations", () => {

‎extensions/qa-lab/src/evidence-summary.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Qa Lab plugin module implements QA evidence summary behavior.
22
import { z } from "zod";
3+
import { qaCoverageIdSchema } from "./coverage-id.js";
34
import { resolveQaEvidenceEnvironment } from "./evidence-environment.js";
45
import { splitQaModelRef } from "./model-selection.js";
56
import { getQaProvider, type QaProviderMode } from "./providers/index.js";
@@ -19,7 +20,6 @@ const qaEvidenceStatusSchema = z.enum(["pass", "fail", "blocked", "skipped"]);
1920
const nonEmptyStringSchema = z.string().trim().min(1);
2021
const nullableStringSchema = nonEmptyStringSchema.nullable();
2122
const qaEvidenceProfileIdSchema = nonEmptyStringSchema;
22-
const qaEvidenceIdSchema = z.strictObject({ id: nonEmptyStringSchema });
2323

2424
const qaEvidenceProviderSchema = z.strictObject({
2525
id: nonEmptyStringSchema,
@@ -82,7 +82,8 @@ const qaEvidenceRefSchema = z.strictObject({
8282
path: nonEmptyStringSchema,
8383
});
8484

85-
const qaEvidenceCoverageSchema = qaEvidenceIdSchema.extend({
85+
const qaEvidenceCoverageSchema = z.strictObject({
86+
id: qaCoverageIdSchema,
8687
role: nonEmptyStringSchema,
8788
});
8889

0 commit comments

Comments
 (0)