chore: address Copilot review round 10
The CI half of the wiring vouch matched the workflow's raw text, so a YAML comment, a step `name:`, or an unused anchor mentioning `npm run verify:skills:cli` satisfied it — including this guard's own docblock wording. Deleting the real step would then have left `verify:skills` green, which is the vacuous-guard failure the vouch exists to prevent. It now reads the workflow's executable regions via `extractExecutableRegions`, the same helper the #2146 workflow gate is built on, and matches only a `run:`. Covered by three should-not-count cases (comment, step name, workflow input) plus a multi-line `run:` that must count; verified by mutation — restoring the substring check fails them. Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
parent
17068fc89e
commit
23c59d7a17
1 changed files with 45 additions and 4 deletions
|
|
@ -236,12 +236,15 @@ test("checkWiring catches the authoritative validator dropped from CI", () => {
|
|||
WIRED_SCRIPTS,
|
||||
"jobs:\n build:\n steps:\n - run: npm run validate\n",
|
||||
).join(),
|
||||
/workflows\/main\.yml` no longer runs/,
|
||||
/has no step that runs/,
|
||||
);
|
||||
});
|
||||
|
||||
test("checkWiring reports every broken link at once", () => {
|
||||
assert.equal(checkWiring({ validate: "", "local:gate": "" }, "").length, 3);
|
||||
assert.equal(
|
||||
checkWiring({ validate: "", "local:gate": "" }, "jobs: {}\n").length,
|
||||
3,
|
||||
);
|
||||
});
|
||||
|
||||
test("the repository as it stands is wired", () => {
|
||||
|
|
@ -259,3 +262,27 @@ test("the repository as it stands is wired", () => {
|
|||
);
|
||||
assert.deepEqual(checkWiring(scripts, workflow), []);
|
||||
});
|
||||
|
||||
test("checkWiring is not satisfied by a mention outside an executable step", () => {
|
||||
// A raw substring match would pass on any of these while CI ran nothing —
|
||||
// including on a step whose NAME describes the check it no longer performs,
|
||||
// which is exactly how a wiring guard goes quietly vacuous.
|
||||
const mentions = [
|
||||
"# npm run verify:skills:cli\njobs:\n build:\n steps:\n - run: npm run validate\n",
|
||||
"jobs:\n build:\n steps:\n - name: npm run verify:skills:cli\n run: npm run validate\n",
|
||||
"on:\n workflow_dispatch:\n inputs:\n cmd:\n default: npm run verify:skills:cli\njobs:\n build:\n steps:\n - run: npm run validate\n",
|
||||
];
|
||||
for (const workflow of mentions) {
|
||||
assert.match(
|
||||
checkWiring(WIRED_SCRIPTS, workflow).join(),
|
||||
/has no step that runs/,
|
||||
`should not count: ${workflow.split("\n")[0]}`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test("checkWiring accepts the command inside a multi-line run step", () => {
|
||||
const workflow =
|
||||
"jobs:\n build:\n steps:\n - run: |\n npm run validate\n npm run verify:skills:cli\n";
|
||||
assert.deepEqual(checkWiring(WIRED_SCRIPTS, workflow), []);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue