@virtocommerce/test-automation-framework 0.1.0-alpha.1 → 0.2.0-alpha.20261127111327
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/vc-qa-automation-expert.md +122 -0
- package/.claude/agents/{qa-coverage.md → vc-qa-coverage.md} +10 -7
- package/.claude/agents/{qa-explorer.md → vc-qa-explorer.md} +20 -15
- package/.claude/agents/{qa-healer.md → vc-qa-healer.md} +15 -13
- package/.claude/agents/{qa-judge.md → vc-qa-judge.md} +35 -35
- package/.claude/agents/{qa-planner.md → vc-qa-planner.md} +29 -16
- package/.claude/agents/{qa-reviewer.md → vc-qa-reviewer.md} +18 -11
- package/.claude/checks/browser-secrets.mts +45 -2
- package/.claude/checks/contract.mts +258 -33
- package/.claude/checks/facts-consistency.mts +335 -0
- package/.claude/checks/introspect.mts +157 -0
- package/.claude/checks/judge-verdict.mts +44 -3
- package/.claude/checks/probe.mts +91 -0
- package/.claude/checks/project-facts.mts +85 -6
- package/.claude/checks/prove-fails.mts +254 -59
- package/.claude/checks/prune.mts +584 -0
- package/.claude/checks/rank-gaps.mts +24 -5
- package/.claude/checks/readonly-shell.mts +137 -58
- package/.claude/checks/reconcile-run.mts +64 -7
- package/.claude/checks/run-record.mts +338 -0
- package/.claude/checks/stand-request.mts +76 -0
- package/.claude/checks/test-shape.mts +78 -14
- package/.claude/commands/vc-qa-coverage.md +20 -0
- package/.claude/commands/{qa-explore.md → vc-qa-explore.md} +4 -4
- package/.claude/commands/{qa-heal.md → vc-qa-heal.md} +6 -6
- package/.claude/commands/{qa-implement.md → vc-qa-implement.md} +7 -7
- package/.claude/commands/vc-qa-plan.md +64 -0
- package/.claude/commands/{qa-review.md → vc-qa-review.md} +12 -12
- package/.claude/commands/{qa.md → vc-qa.md} +31 -22
- package/.claude/hooks/readonly-shell.mts +1 -1
- package/.claude/skills/{coverage-analysis → vc-coverage-analysis}/SKILL.md +24 -15
- package/.claude/skills/{create-graphql-layer → vc-create-graphql-layer}/SKILL.md +5 -3
- package/.claude/skills/{create-ui-layer → vc-create-ui-layer}/SKILL.md +5 -3
- package/.claude/skills/vc-explore-api/SKILL.md +93 -0
- package/.claude/skills/{explore-frontend → vc-explore-frontend}/SKILL.md +15 -9
- package/.claude/skills/{framework-rules → vc-framework-rules}/SKILL.md +34 -11
- package/.claude/skills/{heal-tests → vc-heal-tests}/SKILL.md +21 -21
- package/.claude/skills/{heal-tests → vc-heal-tests}/guard-recipe.md +3 -3
- package/.claude/skills/{judge-criteria → vc-judge-criteria}/SKILL.md +5 -3
- package/.claude/skills/{judge-criteria → vc-judge-criteria}/expert.md +10 -5
- package/.claude/skills/{plan-implementation → vc-plan-implementation}/SKILL.md +23 -11
- package/.claude/skills/vc-plan-implementation/contract-template.md +86 -0
- package/.claude/skills/{plan-test-strategy → vc-plan-test-strategy}/SKILL.md +24 -14
- package/.claude/skills/{project-facts → vc-project-facts}/SKILL.md +58 -23
- package/.claude/skills/{read-change → vc-read-change}/SKILL.md +4 -4
- package/.claude/skills/{read-ticket → vc-read-ticket}/SKILL.md +3 -3
- package/.claude/skills/{review-pr → vc-review-pr}/SKILL.md +4 -4
- package/.claude/skills/{review-test-code → vc-review-test-code}/SKILL.md +29 -15
- package/.claude/skills/{write-e2e-test → vc-write-e2e-test}/SKILL.md +11 -7
- package/.claude/skills/{write-graphql-test → vc-write-graphql-test}/SKILL.md +11 -7
- package/.claude/skills/{write-rest-api-test → vc-write-rest-api-test}/SKILL.md +16 -11
- package/.claude/skills/{write-security-test → vc-write-security-test}/SKILL.md +15 -11
- package/CHANGELOG.md +121 -0
- package/README.md +17 -0
- package/bin/vc-qa-agents.mjs +595 -0
- package/dist/auth/browser-sessions.d.ts +88 -0
- package/dist/auth/browser-sessions.js +126 -0
- package/dist/auth/browser-sessions.js.map +1 -0
- package/dist/auth/index.d.ts +5 -5
- package/dist/auth/index.js +2 -2
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/sign-in-strategies.d.ts +67 -0
- package/dist/auth/sign-in-strategies.js +121 -0
- package/dist/auth/sign-in-strategies.js.map +1 -0
- package/dist/auth/token-client.d.ts +9 -1
- package/dist/auth/token-client.js +9 -4
- package/dist/auth/token-client.js.map +1 -1
- package/dist/core/default-reporters.d.ts +9 -6
- package/dist/core/default-reporters.js +16 -16
- package/dist/core/default-reporters.js.map +1 -1
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/secret-masking-reporter.d.ts +48 -0
- package/dist/core/secret-masking-reporter.js +78 -0
- package/dist/core/secret-masking-reporter.js.map +1 -0
- package/dist/fixtures/default-fixtures.d.ts +12 -9
- package/dist/fixtures/default-fixtures.js +12 -8
- package/dist/fixtures/default-fixtures.js.map +1 -1
- package/docs/README.md +3 -3
- package/docs/concepts/auth.md +68 -16
- package/docs/concepts/config.md +14 -6
- package/docs/concepts/dataset.md +5 -4
- package/docs/concepts/environment.md +17 -12
- package/docs/concepts/fixtures.md +23 -16
- package/docs/concepts/modules.md +2 -1
- package/docs/contributing/architecture.md +22 -15
- package/docs/contributing/documentation.md +10 -21
- package/docs/contributing/releasing.md +35 -21
- package/docs/examples/sign-in-strategies.ts +22 -0
- package/docs/getting-started.md +62 -1
- package/docs/guides/generating-types.md +5 -4
- package/docs/guides/qa-agents.md +193 -35
- package/package.json +4 -4
- package/templates/suite/.mcp.json +16 -0
- package/templates/suite/.qa/project.json +70 -0
- package/templates/suite/CLAUDE.template.md +62 -0
- package/templates/suite/allurerc.mjs +13 -0
- package/templates/suite/arrange/context.ts +15 -0
- package/templates/suite/arrange/index.ts +69 -0
- package/templates/suite/arrange/security.ts +78 -0
- package/templates/suite/biome.template.json +12 -0
- package/templates/suite/builders/security.ts +46 -0
- package/templates/suite/codegen.ts +27 -0
- package/templates/suite/env.example +10 -0
- package/templates/suite/env.ts +25 -0
- package/templates/suite/fixtures/index.ts +96 -0
- package/templates/suite/gitignore +13 -0
- package/templates/suite/pages/README.md +10 -0
- package/templates/suite/playwright.config.ts +48 -0
- package/templates/suite/scripts/generate-rest-types.ts +16 -0
- package/templates/suite/support/require-fields.ts +53 -0
- package/templates/suite/support/shopper.ts +51 -0
- package/templates/suite/support/store.ts +33 -0
- package/templates/suite/support/unique-id.ts +11 -0
- package/templates/suite/support/users.ts +6 -0
- package/templates/suite/tests/restapi/security/sign-in.spec.ts +23 -0
- package/templates/suite/tsconfig.json +33 -0
- package/.claude/agents/qa-automation-expert.md +0 -119
- package/.claude/commands/qa-coverage.md +0 -13
- package/.claude/commands/qa-plan.md +0 -55
- package/.claude/skills/explore-api/SKILL.md +0 -74
- package/.claude/skills/plan-implementation/contract-template.md +0 -72
- package/bin/install-qa-agents.mjs +0 -94
- package/dist/auth/frontend-browser-sessions.d.ts +0 -71
- package/dist/auth/frontend-browser-sessions.js +0 -130
- package/dist/auth/frontend-browser-sessions.js.map +0 -1
- package/dist/auth/platform-browser-sessions.d.ts +0 -47
- package/dist/auth/platform-browser-sessions.js +0 -92
- package/dist/auth/platform-browser-sessions.js.map +0 -1
- /package/.claude/skills/{judge-criteria → vc-judge-criteria}/coverage.md +0 -0
- /package/.claude/skills/{judge-criteria → vc-judge-criteria}/explorer.md +0 -0
- /package/.claude/skills/{judge-criteria → vc-judge-criteria}/healer.md +0 -0
- /package/.claude/skills/{judge-criteria → vc-judge-criteria}/planner.md +0 -0
- /package/.claude/skills/{read-ticket → vc-read-ticket}/providers.md +0 -0
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
2
|
+
import { dirname, join, resolve } from "node:path";
|
|
3
|
+
|
|
4
|
+
/** What `reconcile-run` reads from the disk to decide whether a report is stale; replaceable for a test. */
|
|
5
|
+
export type SourceIo = {
|
|
6
|
+
read: (path: string) => string | undefined;
|
|
7
|
+
modified: (path: string) => number | undefined;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
type Series = { projects: string[]; flags: Map<string, string>; specs: string[] };
|
|
11
|
+
|
|
12
|
+
const SERIES_FLAGS = ["workers", "repeat-each", "retries", "grep"] as const;
|
|
13
|
+
const SPEC_TOKEN = /\.(?:spec|test)\.[cm]?[jt]sx?(?::\d+)?$/;
|
|
14
|
+
const COMMENT = /<!--[\s\S]*?-->/g;
|
|
15
|
+
const EXTENSIONS = ["", ".ts", ".mts", ".tsx", ".js", ".mjs", "/index.ts", "/index.js"];
|
|
16
|
+
const IMPORT = /(?:\bfrom\s*|\bimport\s*\(?\s*)["']([^"']+)["']/g;
|
|
17
|
+
const MAX_FILES = 2000;
|
|
18
|
+
const MAX_SHOWN = 8;
|
|
19
|
+
const DEVIATION = /^\s*deviation:\s*(\S.*)$/i;
|
|
20
|
+
const PROJECT_FLAG = "project";
|
|
21
|
+
const VALUE_FLAGS = [PROJECT_FLAG, ...SERIES_FLAGS] as const;
|
|
22
|
+
const SHORT_FLAGS: Readonly<Record<string, string>> = { g: "grep", j: "workers" };
|
|
23
|
+
const SHELL_WORD = /(?:[^\s"']+|"[^"]*"|'[^']*')+/g;
|
|
24
|
+
const QUOTED = /"([^"]*)"|'([^']*)'/g;
|
|
25
|
+
|
|
26
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
27
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function normalizedSpec(token: string): string {
|
|
31
|
+
return token
|
|
32
|
+
.replaceAll("\\", "/")
|
|
33
|
+
.replace(/:\d+$/, "")
|
|
34
|
+
.replace(/^\.\//, "")
|
|
35
|
+
.replace(/^["']|["']$/g, "");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** True when two spec paths name the same file: equal, or one ends with the other after a `/`. */
|
|
39
|
+
export function sameSpec(left: string, right: string): boolean {
|
|
40
|
+
const [a, b] = [normalizedSpec(left), normalizedSpec(right)];
|
|
41
|
+
return a === b || a.endsWith(`/${b}`) || b.endsWith(`/${a}`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** A flag of the Playwright CLI that takes a value: its long name and the value when it is in the same token. */
|
|
45
|
+
function valueFlagOf(token: string): { name: string; value: string | undefined } | undefined {
|
|
46
|
+
const long = /^--([a-z-]+)(?:=([\s\S]*))?$/.exec(token);
|
|
47
|
+
const short = /^-([a-z])([\s\S]*)$/.exec(token);
|
|
48
|
+
const name = long?.[1] ?? SHORT_FLAGS[short?.[1] ?? ""];
|
|
49
|
+
if (name === undefined || !VALUE_FLAGS.some((flag) => flag === name)) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
const attached = long === null ? short?.[2] : long[2];
|
|
53
|
+
return { name, value: attached === "" ? undefined : attached };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The project, series flags and spec files of one test command, as the Playwright CLI reads them: `--name=value`,
|
|
58
|
+
* `--name value`, and the short `-g`, `-j` with the value attached or as the next word.
|
|
59
|
+
*/
|
|
60
|
+
function parseSeries(tokens: readonly string[]): Series {
|
|
61
|
+
const series: Series = { projects: [], flags: new Map(), specs: [] };
|
|
62
|
+
for (let index = 0; index < tokens.length; index += 1) {
|
|
63
|
+
const token = tokens[index] ?? "";
|
|
64
|
+
const flag = valueFlagOf(token);
|
|
65
|
+
if (flag !== undefined) {
|
|
66
|
+
const value = flag.value ?? tokens[index + 1];
|
|
67
|
+
index += flag.value === undefined ? 1 : 0;
|
|
68
|
+
if (value === undefined) {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (flag.name === PROJECT_FLAG) {
|
|
72
|
+
series.projects.push(value);
|
|
73
|
+
} else {
|
|
74
|
+
series.flags.set(flag.name, value);
|
|
75
|
+
}
|
|
76
|
+
} else if (SPEC_TOKEN.test(token)) {
|
|
77
|
+
series.specs.push(normalizedSpec(token));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return series;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** The words of a command written in the contract, as a shell splits them: quotes group words and are removed. */
|
|
84
|
+
function shellWords(text: string): string[] {
|
|
85
|
+
return (text.match(SHELL_WORD) ?? []).map((word) =>
|
|
86
|
+
word.replace(QUOTED, (_: string, double: string | undefined, single: string | undefined) => double ?? single ?? ""),
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** The text of `## Verification` of a contract, without comments. */
|
|
91
|
+
function verificationOf(markdown: string): string[] {
|
|
92
|
+
const lines = markdown.replace(COMMENT, "").split(/\r?\n/);
|
|
93
|
+
const start = lines.findIndex((line) => /^## Verification\s*$/.test(line));
|
|
94
|
+
if (start < 0) {
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
97
|
+
const rest = lines.slice(start + 1);
|
|
98
|
+
const end = rest.findIndex((line) => /^## \S/.test(line));
|
|
99
|
+
return end < 0 ? rest : rest.slice(0, end);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** The test commands the contract's Verification writes: a command with a series flag, a project or a spec file. */
|
|
103
|
+
export function contractSeries(markdown: string): Series[] {
|
|
104
|
+
const series: Series[] = [];
|
|
105
|
+
for (const line of verificationOf(markdown)) {
|
|
106
|
+
const text = line.replace(/^\s*(?:[-*]|\d+\.)\s+/, "");
|
|
107
|
+
const segments = text.includes("`") ? text.split("`").filter((_, index) => index % 2 === 1) : [text];
|
|
108
|
+
for (const segment of segments) {
|
|
109
|
+
const parsed = parseSeries(shellWords(segment));
|
|
110
|
+
if (parsed.projects.length > 0 || parsed.flags.size > 0 || parsed.specs.length > 0) {
|
|
111
|
+
series.push(parsed);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return series;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function reportProjects(report: unknown, argvProjects: readonly string[]): string[] {
|
|
119
|
+
if (argvProjects.length > 0) {
|
|
120
|
+
return [...argvProjects];
|
|
121
|
+
}
|
|
122
|
+
const names = new Set<string>();
|
|
123
|
+
const walk = (suite: unknown): void => {
|
|
124
|
+
if (!isRecord(suite)) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
for (const spec of Array.isArray(suite["specs"]) ? suite["specs"] : []) {
|
|
128
|
+
for (const entry of isRecord(spec) && Array.isArray(spec["tests"]) ? spec["tests"] : []) {
|
|
129
|
+
if (isRecord(entry) && typeof entry["projectName"] === "string") {
|
|
130
|
+
names.add(entry["projectName"]);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
for (const child of Array.isArray(suite["suites"]) ? suite["suites"] : []) {
|
|
135
|
+
walk(child);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
for (const suite of isRecord(report) && Array.isArray(report["suites"]) ? report["suites"] : []) {
|
|
139
|
+
walk(suite);
|
|
140
|
+
}
|
|
141
|
+
return [...names];
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function flagDifferences(contract: readonly Series[], actual: Series): string[] {
|
|
145
|
+
const found: string[] = [];
|
|
146
|
+
for (const flag of SERIES_FLAGS) {
|
|
147
|
+
const wanted = [...new Set(contract.flatMap((series) => series.flags.get(flag) ?? []))];
|
|
148
|
+
const real = actual.flags.get(flag);
|
|
149
|
+
if (wanted.length > 0 && (real === undefined || !wanted.includes(real))) {
|
|
150
|
+
found.push(
|
|
151
|
+
`--${flag}=${wanted.join(" or ")} in the contract's Verification, ${real === undefined ? "not given" : `--${flag}=${real}`} in the series`,
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return found;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function listDifferences(
|
|
159
|
+
what: string,
|
|
160
|
+
wanted: readonly string[],
|
|
161
|
+
real: readonly string[],
|
|
162
|
+
same: (a: string, b: string) => boolean,
|
|
163
|
+
): string[] {
|
|
164
|
+
if (wanted.length === 0) {
|
|
165
|
+
return [];
|
|
166
|
+
}
|
|
167
|
+
return [
|
|
168
|
+
...wanted
|
|
169
|
+
.filter((item) => !real.some((other) => same(item, other)))
|
|
170
|
+
.map((item) => `${what} ${item} is named in the contract's Verification, not in the series`),
|
|
171
|
+
...real
|
|
172
|
+
.filter((item) => !wanted.some((other) => same(item, other)))
|
|
173
|
+
.map((item) => `${what} ${item} ran in the series, the contract's Verification does not name it`),
|
|
174
|
+
];
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Every difference between the series the report records (`config.argv`, the command Playwright was started with)
|
|
179
|
+
* and the test commands the contract's `## Verification` writes: a flag among `--workers`, `--repeat-each`,
|
|
180
|
+
* `--retries` and `--grep` that the contract gives and the series did not, a project or spec file on one side only.
|
|
181
|
+
* Only commands that name a project the series ran (or none) are compared, and only what the contract states.
|
|
182
|
+
*
|
|
183
|
+
* @returns one line per difference; a report with no `config.argv` is itself one line, because nothing can be compared.
|
|
184
|
+
*/
|
|
185
|
+
export function argvDifferences(report: unknown, contractMarkdown: string): string[] {
|
|
186
|
+
const config = isRecord(report) ? report["config"] : undefined;
|
|
187
|
+
const argv = isRecord(config) && Array.isArray(config["argv"]) ? config["argv"].map(String) : undefined;
|
|
188
|
+
if (argv === undefined) {
|
|
189
|
+
return ["the report holds no config.argv, so the series' real command cannot be compared with the contract"];
|
|
190
|
+
}
|
|
191
|
+
const actual = parseSeries(argv.slice(argv.indexOf("test") + 1));
|
|
192
|
+
const ran = reportProjects(report, actual.projects);
|
|
193
|
+
const contract = contractSeries(contractMarkdown).filter(
|
|
194
|
+
(series) => series.projects.length === 0 || series.projects.some((project) => ran.includes(project)),
|
|
195
|
+
);
|
|
196
|
+
if (contract.length === 0) {
|
|
197
|
+
return [];
|
|
198
|
+
}
|
|
199
|
+
return [
|
|
200
|
+
...flagDifferences(contract, actual),
|
|
201
|
+
...listDifferences(
|
|
202
|
+
"project",
|
|
203
|
+
[...new Set(contract.flatMap((series) => series.projects))],
|
|
204
|
+
actual.projects,
|
|
205
|
+
(left, right) => left === right,
|
|
206
|
+
),
|
|
207
|
+
...listDifferences("spec", [...new Set(contract.flatMap((series) => series.specs))], actual.specs, sameSpec),
|
|
208
|
+
];
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/** The `deviation: <reason>` lines of the run record's deviation file: why the series differed from the contract. */
|
|
212
|
+
export function deviationLines(text: string | undefined): string[] {
|
|
213
|
+
return (text ?? "").split(/\r?\n/).flatMap((line) => DEVIATION.exec(line)?.[1]?.trim() ?? []);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** The JSON text without line and block comments (a tsconfig.json has them), keeping strings as they are. */
|
|
217
|
+
function stripJsonComments(text: string): string {
|
|
218
|
+
return text.replace(
|
|
219
|
+
/("(?:[^"\\]|\\.)*")|\/\/[^\n]*|\/\*[\s\S]*?\*\//g,
|
|
220
|
+
(_, string: string | undefined) => string ?? "",
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function aliasesOf(rootDir: string, io: SourceIo): { prefix: string; target: string }[] {
|
|
225
|
+
const text = io.read(join(rootDir, "tsconfig.json"));
|
|
226
|
+
if (text === undefined) {
|
|
227
|
+
return [];
|
|
228
|
+
}
|
|
229
|
+
try {
|
|
230
|
+
const options: unknown = (JSON.parse(stripJsonComments(text)) as Record<string, unknown>)["compilerOptions"];
|
|
231
|
+
const paths = isRecord(options) && isRecord(options["paths"]) ? options["paths"] : {};
|
|
232
|
+
const base =
|
|
233
|
+
isRecord(options) && typeof options["baseUrl"] === "string" ? join(rootDir, options["baseUrl"]) : rootDir;
|
|
234
|
+
return Object.entries(paths).flatMap(([pattern, targets]) => {
|
|
235
|
+
const target = Array.isArray(targets) ? targets[0] : undefined;
|
|
236
|
+
return typeof target === "string"
|
|
237
|
+
? [{ prefix: pattern.replace(/\*$/, ""), target: join(base, target.replace(/\*$/, "")) }]
|
|
238
|
+
: [];
|
|
239
|
+
});
|
|
240
|
+
} catch {
|
|
241
|
+
return [];
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function resolveImport(
|
|
246
|
+
from: string,
|
|
247
|
+
specifier: string,
|
|
248
|
+
aliases: readonly { prefix: string; target: string }[],
|
|
249
|
+
io: SourceIo,
|
|
250
|
+
): string | undefined {
|
|
251
|
+
let base: string | undefined;
|
|
252
|
+
if (specifier.startsWith(".")) {
|
|
253
|
+
base = resolve(dirname(from), specifier);
|
|
254
|
+
} else {
|
|
255
|
+
const alias = aliases.find(
|
|
256
|
+
({ prefix }) => specifier === prefix || (prefix.endsWith("/") && specifier.startsWith(prefix)),
|
|
257
|
+
);
|
|
258
|
+
base = alias === undefined ? undefined : alias.target + specifier.slice(alias.prefix.length);
|
|
259
|
+
}
|
|
260
|
+
return base === undefined
|
|
261
|
+
? undefined
|
|
262
|
+
: EXTENSIONS.map((extension) => `${base}${extension}`).find(
|
|
263
|
+
(path) => io.modified(path) !== undefined && io.read(path) !== undefined,
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* The files a report covers: its spec files (`suites[].file`, relative to `config.rootDir`) and the files they import,
|
|
269
|
+
* relative or through the `paths` of the suite's `tsconfig.json`, followed to any depth. Packages are not followed.
|
|
270
|
+
*/
|
|
271
|
+
export function coveredFiles(report: unknown, io: SourceIo): string[] {
|
|
272
|
+
const config = isRecord(report) ? report["config"] : undefined;
|
|
273
|
+
const rootDir = isRecord(config) && typeof config["rootDir"] === "string" ? config["rootDir"] : undefined;
|
|
274
|
+
if (rootDir === undefined) {
|
|
275
|
+
return [];
|
|
276
|
+
}
|
|
277
|
+
const aliases = aliasesOf(rootDir, io);
|
|
278
|
+
const queue = (isRecord(report) && Array.isArray(report["suites"]) ? report["suites"] : []).flatMap((suite) =>
|
|
279
|
+
isRecord(suite) && typeof suite["file"] === "string" ? [resolve(rootDir, suite["file"])] : [],
|
|
280
|
+
);
|
|
281
|
+
const seen = new Set<string>();
|
|
282
|
+
while (queue.length > 0 && seen.size < MAX_FILES) {
|
|
283
|
+
const file = queue.shift() ?? "";
|
|
284
|
+
if (seen.has(file)) {
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
seen.add(file);
|
|
288
|
+
for (const match of (io.read(file) ?? "").matchAll(IMPORT)) {
|
|
289
|
+
const found = resolveImport(file, match[1] ?? "", aliases, io);
|
|
290
|
+
if (found !== undefined && !seen.has(found)) {
|
|
291
|
+
queue.push(found);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return [...seen];
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* The covered files edited after the run started (`stats.startTime`): the report describes code that has since
|
|
300
|
+
* changed, so it proves nothing about the code now.
|
|
301
|
+
*
|
|
302
|
+
* @returns up to eight lines, one per file, and a count line for the rest; empty when the report is current or has no
|
|
303
|
+
* start time.
|
|
304
|
+
*/
|
|
305
|
+
export function staleSources(report: unknown, io: SourceIo): string[] {
|
|
306
|
+
const stats = isRecord(report) ? report["stats"] : undefined;
|
|
307
|
+
const started =
|
|
308
|
+
isRecord(stats) && typeof stats["startTime"] === "string" ? Date.parse(stats["startTime"]) : Number.NaN;
|
|
309
|
+
if (Number.isNaN(started)) {
|
|
310
|
+
return [];
|
|
311
|
+
}
|
|
312
|
+
const config = isRecord(report) ? report["config"] : undefined;
|
|
313
|
+
const root = isRecord(config) && typeof config["rootDir"] === "string" ? config["rootDir"] : "";
|
|
314
|
+
const newer = coveredFiles(report, io).filter((file) => (io.modified(file) ?? 0) > started);
|
|
315
|
+
const names = newer.map((file) => file.replaceAll("\\", "/").replace(`${root.replaceAll("\\", "/")}/`, ""));
|
|
316
|
+
const lines = names.slice(0, MAX_SHOWN).map((name) => `${name} was edited after the run started`);
|
|
317
|
+
return names.length > MAX_SHOWN
|
|
318
|
+
? [...lines, `and ${names.length - MAX_SHOWN} more files were edited after the run started`]
|
|
319
|
+
: lines;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/** The real filesystem for {@link staleSources}. */
|
|
323
|
+
export const DISK: SourceIo = {
|
|
324
|
+
read(path) {
|
|
325
|
+
try {
|
|
326
|
+
return existsSync(path) && statSync(path).isFile() ? readFileSync(path, "utf8") : undefined;
|
|
327
|
+
} catch {
|
|
328
|
+
return undefined;
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
modified(path) {
|
|
332
|
+
try {
|
|
333
|
+
return statSync(path).isFile() ? statSync(path).mtimeMs : undefined;
|
|
334
|
+
} catch {
|
|
335
|
+
return undefined;
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { request as httpRequest } from "node:http";
|
|
2
|
+
import { request as httpsRequest } from "node:https";
|
|
3
|
+
|
|
4
|
+
export type StandAnswer = { status: number; text: string };
|
|
5
|
+
|
|
6
|
+
type Vars = Readonly<Record<string, string | undefined>>;
|
|
7
|
+
|
|
8
|
+
const TIMEOUT_MS = 30_000;
|
|
9
|
+
const MAX_BYTES = 64 * 1024 * 1024;
|
|
10
|
+
|
|
11
|
+
/** Whether the run's variables leave the TLS certificate check on: everything but `VERIFY_SSL=false`, as the suite reads it. */
|
|
12
|
+
export function verifiesSsl(vars: Vars): boolean {
|
|
13
|
+
return vars["VERIFY_SSL"] !== "false";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Sends one anonymous request to the stand's backend and returns its status and body. It sends no credential, cookie
|
|
18
|
+
* or authorization header, reads no password and follows no redirect, so it reaches only what an anonymous visitor can.
|
|
19
|
+
* `path` must start with one `/`, so the request cannot leave `origin`.
|
|
20
|
+
*
|
|
21
|
+
* @param origin the origin of the backend (`standOrigins`).
|
|
22
|
+
* @param path the path and query, such as `/graphql`.
|
|
23
|
+
* @param options the method, the JSON body of a POST and whether to verify the TLS certificate.
|
|
24
|
+
* @throws Error when the path is not a path on the origin, the request fails or times out, or the answer is too large.
|
|
25
|
+
*/
|
|
26
|
+
export function anonymousRequest(
|
|
27
|
+
origin: string,
|
|
28
|
+
path: string,
|
|
29
|
+
options: { method: "GET" | "POST"; body?: string; verifySsl: boolean },
|
|
30
|
+
): Promise<StandAnswer> {
|
|
31
|
+
if (!path.startsWith("/") || path.startsWith("//")) {
|
|
32
|
+
throw new Error("stand request: the path must start with one /");
|
|
33
|
+
}
|
|
34
|
+
const url = new URL(path, origin);
|
|
35
|
+
if (url.origin !== origin) {
|
|
36
|
+
throw new Error("stand request: the path leaves the stand's backend");
|
|
37
|
+
}
|
|
38
|
+
const send = url.protocol === "https:" ? httpsRequest : httpRequest;
|
|
39
|
+
const body = options.body === undefined ? undefined : Buffer.from(options.body, "utf8");
|
|
40
|
+
return new Promise((done, fail) => {
|
|
41
|
+
const call = send(
|
|
42
|
+
url,
|
|
43
|
+
{
|
|
44
|
+
method: options.method,
|
|
45
|
+
timeout: TIMEOUT_MS,
|
|
46
|
+
rejectUnauthorized: options.verifySsl,
|
|
47
|
+
headers: {
|
|
48
|
+
accept: "application/json",
|
|
49
|
+
...(body === undefined ? {} : { "content-type": "application/json", "content-length": body.length }),
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
(answer) => {
|
|
53
|
+
const chunks: Buffer[] = [];
|
|
54
|
+
let size = 0;
|
|
55
|
+
answer.on("data", (chunk: Buffer) => {
|
|
56
|
+
size += chunk.length;
|
|
57
|
+
if (size > MAX_BYTES) {
|
|
58
|
+
call.destroy(new Error("the answer is larger than 64 MB"));
|
|
59
|
+
} else {
|
|
60
|
+
chunks.push(chunk);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
answer.on("end", () => {
|
|
64
|
+
done({ status: answer.statusCode ?? 0, text: Buffer.concat(chunks).toString("utf8") });
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
);
|
|
68
|
+
call.on("timeout", () => {
|
|
69
|
+
call.destroy(new Error("no answer within 30 seconds"));
|
|
70
|
+
});
|
|
71
|
+
call.on("error", (error) => {
|
|
72
|
+
fail(new Error(`stand request: ${error.message}`));
|
|
73
|
+
});
|
|
74
|
+
call.end(body);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
@@ -3,9 +3,7 @@ import type { ProjectFacts } from "./project-facts.mts";
|
|
|
3
3
|
import { readFileSync } from "node:fs";
|
|
4
4
|
import { basename } from "node:path";
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import { readProjectFacts } from "./project-facts.mts";
|
|
6
|
+
import { importSuiteDependency, readProjectFacts } from "./project-facts.mts";
|
|
9
7
|
|
|
10
8
|
export type QualityFinding = { test: string; finding: string };
|
|
11
9
|
|
|
@@ -13,7 +11,12 @@ type Limits = ProjectFacts["quality"];
|
|
|
13
11
|
|
|
14
12
|
type AstNode = Record<string, unknown> & { type: string; start: number; end: number };
|
|
15
13
|
|
|
16
|
-
type Shape = { steps: number; expects: number; conditionals: number; nesting: number };
|
|
14
|
+
type Shape = { steps: number; expects: number; conditionals: number; nesting: number; helpers: string[] };
|
|
15
|
+
|
|
16
|
+
/** A function of the spec: its body, and the block or program it is declared in, where its name can be called. */
|
|
17
|
+
type Helper = { body: AstNode; scope: AstNode };
|
|
18
|
+
|
|
19
|
+
type Helpers = ReadonlyMap<string, readonly Helper[]>;
|
|
17
20
|
|
|
18
21
|
const CLI_FILE_NAME = "test-shape.mts";
|
|
19
22
|
const TEST_NAME = "test";
|
|
@@ -32,10 +35,13 @@ const CONDITIONALS = [
|
|
|
32
35
|
"DoWhileStatement",
|
|
33
36
|
"ForStatement",
|
|
34
37
|
];
|
|
38
|
+
const SCOPES = ["Program", "BlockStatement"];
|
|
35
39
|
const MIN_TEST_ARGUMENTS = 2;
|
|
36
40
|
const MAX_TITLE = 80;
|
|
37
41
|
const SKIPPED_KEYS = new Set(["loc", "extra", "leadingComments", "trailingComments", "innerComments", "comments"]);
|
|
38
42
|
|
|
43
|
+
const { parse } = await importSuiteDependency<typeof import("@babel/parser")>("@babel/parser");
|
|
44
|
+
|
|
39
45
|
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
40
46
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
41
47
|
}
|
|
@@ -111,19 +117,73 @@ function isExpectCall(node: AstNode): boolean {
|
|
|
111
117
|
return isCall(node) && (nameOf(callee) === EXPECT_NAME || isMemberOf(callee, EXPECT_NAME, EXPECT_VARIANTS));
|
|
112
118
|
}
|
|
113
119
|
|
|
114
|
-
function
|
|
115
|
-
const
|
|
116
|
-
const
|
|
117
|
-
|
|
120
|
+
function collectHelpers(node: AstNode, scope: AstNode, helpers: Map<string, Helper[]>): void {
|
|
121
|
+
const init = node["init"];
|
|
122
|
+
const name =
|
|
123
|
+
node.type === "FunctionDeclaration"
|
|
124
|
+
? nameOf(node["id"])
|
|
125
|
+
: node.type === "VariableDeclarator" && isNode(init) && TEST_FUNCTIONS.includes(init.type)
|
|
126
|
+
? nameOf(node["id"])
|
|
127
|
+
: undefined;
|
|
128
|
+
const fn = node.type === "FunctionDeclaration" ? node : init;
|
|
129
|
+
if (name !== undefined && isNode(fn) && isNode(fn["body"])) {
|
|
130
|
+
helpers.set(name, [...(helpers.get(name) ?? []), { body: fn["body"], scope }]);
|
|
131
|
+
}
|
|
132
|
+
const inner = SCOPES.includes(node.type) ? node : scope;
|
|
133
|
+
for (const child of childrenOf(node)) {
|
|
134
|
+
collectHelpers(child, inner, helpers);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* The functions of a spec a test can call by name, every declaration of each name with the block it is declared in:
|
|
140
|
+
* `function` declarations and `const` arrows or function expressions.
|
|
141
|
+
*/
|
|
142
|
+
function helpersOf(program: AstNode): Helpers {
|
|
143
|
+
const helpers = new Map<string, Helper[]>();
|
|
144
|
+
collectHelpers(program, program, helpers);
|
|
145
|
+
return helpers;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** The declaration a call at `position` reaches: of those whose block holds the call, the innermost. */
|
|
149
|
+
function helperAt(helpers: Helpers, name: string, position: number): Helper | undefined {
|
|
150
|
+
return (helpers.get(name) ?? [])
|
|
151
|
+
.filter(({ scope }) => scope.start <= position && position < scope.end)
|
|
152
|
+
.sort((left, right) => left.scope.end - left.scope.start - (right.scope.end - right.scope.start))[0];
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Counts what a test contains, and what the helper functions of the same spec that it calls contain at each call: the
|
|
157
|
+
* body of a helper counts as if written where the call is, its own braces not as a level. A helper declared inside the
|
|
158
|
+
* test is already in the test's body and is not counted twice; a helper that calls itself, directly or through others,
|
|
159
|
+
* counts once per chain.
|
|
160
|
+
*/
|
|
161
|
+
function measure(body: AstNode, helpers: Helpers): Shape {
|
|
162
|
+
const shape: Shape = { steps: 0, expects: 0, conditionals: 0, nesting: 0, helpers: [] };
|
|
163
|
+
const roots = new Set<AstNode>([body]);
|
|
164
|
+
const visit = (node: AstNode, depth: number, chain: readonly string[]): void => {
|
|
165
|
+
const here = node.type === "BlockStatement" && !roots.has(node) ? depth + 1 : depth;
|
|
118
166
|
shape.nesting = Math.max(shape.nesting, here);
|
|
119
167
|
shape.steps += isStepCall(node) ? 1 : 0;
|
|
120
168
|
shape.expects += isExpectCall(node) ? 1 : 0;
|
|
121
169
|
shape.conditionals += CONDITIONALS.includes(node.type) ? 1 : 0;
|
|
170
|
+
const called = isCall(node) ? nameOf(node["callee"]) : undefined;
|
|
171
|
+
const helper = called === undefined ? undefined : helperAt(helpers, called, node.start)?.body;
|
|
172
|
+
if (
|
|
173
|
+
called !== undefined &&
|
|
174
|
+
helper !== undefined &&
|
|
175
|
+
!chain.includes(called) &&
|
|
176
|
+
!(helper.start >= body.start && helper.end <= body.end)
|
|
177
|
+
) {
|
|
178
|
+
shape.helpers = [...new Set([...shape.helpers, called])];
|
|
179
|
+
roots.add(helper);
|
|
180
|
+
visit(helper, here, [...chain, called]);
|
|
181
|
+
}
|
|
122
182
|
for (const child of childrenOf(node)) {
|
|
123
|
-
visit(child, here);
|
|
183
|
+
visit(child, here, chain);
|
|
124
184
|
}
|
|
125
185
|
};
|
|
126
|
-
visit(body, 0);
|
|
186
|
+
visit(body, 0, []);
|
|
127
187
|
return shape;
|
|
128
188
|
}
|
|
129
189
|
|
|
@@ -169,19 +229,22 @@ function overLimit(count: number, limit: number, what: string, setting: string):
|
|
|
169
229
|
* test counts once however often a table-driven loop runs it, and a `for ... of` or `for ... in` loop is not a
|
|
170
230
|
* conditional. Steps are `test.step` calls, expects are `expect`, `expect.soft` and `expect.poll` calls, nesting is
|
|
171
231
|
* the depth of blocks inside the test function (its own body not counted), conditionals are `if`, `?:`, `switch`,
|
|
172
|
-
* `while`, `do ... while` and `for (;;)`.
|
|
232
|
+
* `while`, `do ... while` and `for (;;)`. A function of the same spec that a test calls by name counts at each call
|
|
233
|
+
* as if its body stood there (steps, expects, conditionals and nesting alike), and the finding names such helpers.
|
|
173
234
|
*
|
|
174
235
|
* @throws Error when the source cannot be parsed.
|
|
175
236
|
*/
|
|
176
237
|
export function checkTestShape(source: string, file: string, limits: Limits): QualityFinding[] {
|
|
177
238
|
const findings: QualityFinding[] = [];
|
|
178
|
-
|
|
239
|
+
const program = parseSource(source, file);
|
|
240
|
+
const helpers = helpersOf(program);
|
|
241
|
+
for (const call of collectTests(program)) {
|
|
179
242
|
const fn = argumentsOf(call).at(-1);
|
|
180
243
|
if (!isNode(fn) || !isNode(fn["body"])) {
|
|
181
244
|
continue;
|
|
182
245
|
}
|
|
183
246
|
const test = `${file}:${lineOf(call, "start")} ${titleOf(call, source)}`;
|
|
184
|
-
const shape = measure(fn["body"]);
|
|
247
|
+
const shape = measure(fn["body"], helpers);
|
|
185
248
|
const lines = lineOf(call, "end") - lineOf(call, "start") + 1;
|
|
186
249
|
const reasons = [
|
|
187
250
|
...overLimit(shape.steps, limits.maxSteps, "test.step calls", "quality.maxSteps"),
|
|
@@ -190,7 +253,8 @@ export function checkTestShape(source: string, file: string, limits: Limits): Qu
|
|
|
190
253
|
...overLimit(shape.nesting, limits.maxNesting, "levels of nesting", "quality.maxNesting"),
|
|
191
254
|
...overLimit(shape.conditionals, limits.maxConditionals, "conditionals", "quality.maxConditionals"),
|
|
192
255
|
];
|
|
193
|
-
|
|
256
|
+
const via = shape.helpers.length === 0 ? "" : ` (counting the helpers it calls: ${shape.helpers.join(", ")})`;
|
|
257
|
+
findings.push(...reasons.map((finding) => ({ test, finding: `${finding}${via}` })));
|
|
194
258
|
}
|
|
195
259
|
return findings;
|
|
196
260
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# QA Coverage
|
|
2
|
+
|
|
3
|
+
Spawn the `vc-qa-coverage` agent once to list what the stand offers, what the tests cover, and rank the gaps. It is
|
|
4
|
+
read-only and writes only a local report under `.qa/reports/`.
|
|
5
|
+
|
|
6
|
+
`$ARGUMENTS` optionally limits the scope to a module, a page or an API area. No arguments: the whole stand.
|
|
7
|
+
|
|
8
|
+
First run `node .claude/checks/prune.mts --fetch --yes`, which removes only finished work under `.qa/` (a contract
|
|
9
|
+
whose cases are all in test titles on the default branch, with its run record, verdict and observed report), and keep
|
|
10
|
+
its last line (`prune: …`). Show its `ask` lines to the person as one list; only on their yes run
|
|
11
|
+
`node .claude/checks/prune.mts --yes --include-stale`. The coverage run does not wait for that answer, and a
|
|
12
|
+
`not reached` line or a failed check never stops it.
|
|
13
|
+
|
|
14
|
+
Dispatch the agent fresh with the scope and nothing else. Show the report path, the ranked gaps with their ids, and
|
|
15
|
+
the metrics. Do not plan anything; end with:
|
|
16
|
+
```
|
|
17
|
+
<the prune: line>
|
|
18
|
+
Report: .qa/reports/<file>
|
|
19
|
+
Next: /vc-qa-plan <gap id> to plan tests for a gap.
|
|
20
|
+
```
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# QA Explore
|
|
2
2
|
|
|
3
|
-
Spawn the `qa-explorer` agent once to map an area of the frontend or the API on the stand and write a report. It
|
|
3
|
+
Spawn the `vc-qa-explorer` agent once to map an area of the frontend or the API on the stand and write a report. It
|
|
4
4
|
writes no test code.
|
|
5
5
|
|
|
6
6
|
`$ARGUMENTS` is the area: a page, a module or an API area ("the cart page", "the orders API"). No arguments: ask
|
|
7
7
|
for one.
|
|
8
8
|
|
|
9
|
-
Dispatch the agent fresh with the area in the person's own words and nothing else. It reads `framework-rules` and
|
|
10
|
-
`project-facts`, explores read-only, and writes its report under `.qa/reports/`.
|
|
9
|
+
Dispatch the agent fresh with the area in the person's own words and nothing else. It reads `vc-framework-rules` and
|
|
10
|
+
`vc-project-facts`, explores read-only, and writes its report under `.qa/reports/`.
|
|
11
11
|
|
|
12
12
|
Show the report path and its findings: pages and selectors, missing test ids, operations, page-object proposals.
|
|
13
13
|
Do not start planning; end with:
|
|
14
14
|
```
|
|
15
15
|
Report: .qa/reports/<file>
|
|
16
|
-
Next: /qa-plan "<area>" to plan tests for it, or /qa-coverage to see what is already tested.
|
|
16
|
+
Next: /vc-qa-plan "<area>" to plan tests for it, or /vc-qa-coverage to see what is already tested.
|
|
17
17
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# QA Heal
|
|
2
2
|
|
|
3
|
-
Spawn the `qa-healer` agent once to run failing or flaky specs, classify each failure, and fix the test-side
|
|
3
|
+
Spawn the `vc-qa-healer` agent once to run failing or flaky specs, classify each failure, and fix the test-side
|
|
4
4
|
defects in the healer paths of the project facts (page objects and data, never a spec). It never changes an expected
|
|
5
5
|
value or an assertion to match the build.
|
|
6
6
|
|
|
@@ -14,12 +14,12 @@ one.
|
|
|
14
14
|
exits non-zero or prints anything but 64 lowercase hexadecimal characters (a configuration file under a healer
|
|
15
15
|
path, for one), show the person "fingerprint could not be computed:" followed by its stderr line, and do not
|
|
16
16
|
dispatch the healer. Then store the guard recipe as the baseline holds it:
|
|
17
|
-
`GIT_NO_LAZY_FETCH=1 git --no-replace-objects -c core.fsmonitor=false cat-file blob <baseline tree id>:.claude/skills/heal-tests/guard-recipe.md`
|
|
17
|
+
`GIT_NO_LAZY_FETCH=1 git --no-replace-objects -c core.fsmonitor=false cat-file blob <baseline tree id>:.claude/skills/vc-heal-tests/guard-recipe.md`
|
|
18
18
|
prints it; keep that text, and when it prints nothing, do not dispatch the healer. Dispatch the agent fresh with
|
|
19
19
|
the target and that baseline id, nothing else. It re-runs, classifies (test defect, product defect, stand data,
|
|
20
20
|
flaky), fixes page objects, data and waits, and stops after three rounds.
|
|
21
21
|
2. Run the recipe you stored in step 1 word for word: its shell block with the baseline id and the fingerprint of
|
|
22
|
-
step 1, and what each outcome means. Never read `.claude/skills/heal-tests/guard-recipe.md` from the working tree
|
|
22
|
+
step 1, and what each outcome means. Never read `.claude/skills/vc-heal-tests/guard-recipe.md` from the working tree
|
|
23
23
|
after the heal: the healer runs test code, which can rewrite any file, the recipe included. A guard that is not
|
|
24
24
|
clean ends here: show it to the person and offer no review.
|
|
25
25
|
3. Present what it fixed, what it classified as a product defect (the test stays failing; a person files the
|
|
@@ -32,13 +32,13 @@ whose `list.<project>.json` names the spec (or, for a title, a spec that holds i
|
|
|
32
32
|
`.qa/contracts/<contract-name>.md` exists: the heal belongs to it. Otherwise (zero, several, or no contract file): say
|
|
33
33
|
so; the review runs without a contract.
|
|
34
34
|
|
|
35
|
-
When the heal belongs to a run record, do what `/qa` does after a heal: the recipe's "After a Clean Guard", word for
|
|
35
|
+
When the heal belongs to a run record, do what `/vc-qa` does after a heal: the recipe's "After a Clean Guard", word for
|
|
36
36
|
word, with that record and contract.
|
|
37
37
|
|
|
38
38
|
When code changed and the guard is clean, end with the review command, its `healer:` line filled in from the guard
|
|
39
39
|
recipe (the baseline id, then the `healed tree`). Put the contract path first only when that re-run reconciled with
|
|
40
|
-
exit 0 on every project; otherwise leave it out, since `/qa-review` would reconcile a record that is not the healed one:
|
|
40
|
+
exit 0 on every project; otherwise leave it out, since `/vc-qa-review` would reconcile a record that is not the healed one:
|
|
41
41
|
```
|
|
42
|
-
Heal complete. Run /qa-review <contract path or nothing> healer: <baseline tree id> <new tree id> to review the changes.
|
|
42
|
+
Heal complete. Run /vc-qa-review <contract path or nothing> healer: <baseline tree id> <new tree id> to review the changes.
|
|
43
43
|
```
|
|
44
44
|
Without a clean guard, name no `healer:` line and offer no review.
|