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:
cliffhall 2026-08-29 03:17:37 -04:00
commit 23c59d7a17

View file

@ -32,6 +32,7 @@ import path from "node:path";
import { fileURLToPath } from "node:url";
import { claudeSpawnArgs, probeClaudeVersion } from "./lib/claude-cli.mjs";
import { reachableScripts, rootReachesScript } from "./lib/npm-scripts.mjs";
import { extractExecutableRegions } from "./lib/workflow-gate.mjs";
import {
compareVersions,
parseClaudeVersion,
@ -73,6 +74,14 @@ export function skillDirs(
* the step that actually runs the authoritative validator, and it is
* reachable from neither `validate` nor any test, so nothing else would
* notice it going missing.
*
* The workflow half reads the **executable** regions rather than the file's
* text. A raw substring match is satisfied by a comment, a step `name:`, or an
* unused anchor that merely mentions the command — so deleting the real step
* while leaving this very docblock's wording nearby would keep the guard green
* (Copilot). `extractExecutableRegions` already descends only the schema paths
* Actions actually runs, with aliases resolved, and it is the same helper the
* #2146 workflow gate is built on.
*/
export function checkWiring(rootScripts, workflowText) {
const problems = [];
@ -86,9 +95,14 @@ export function checkWiring(rootScripts, workflowText) {
"`npm run local:gate` no longer runs `verify:skills:cli`, so the authoritative validator never runs locally. Restore it.",
);
}
if (!/npm run verify:skills:cli/.test(workflowText)) {
const runsInCi = extractExecutableRegions(workflowText, "main.yml").some(
(region) =>
region.kind === "run" &&
/\bnpm run verify:skills:cli\b/.test(region.text),
);
if (!runsInCi) {
problems.push(
"`.github/workflows/main.yml` no longer runs `npm run verify:skills:cli`, so the authoritative validator never runs in CI. Restore it.",
"`.github/workflows/main.yml` has no step that runs `npm run verify:skills:cli`, so the authoritative validator never runs in CI. Restore it.",
);
}
return problems;