fix(web): fail check-docs on stale install snippets (#3770)#3775
Conversation
`check-docs.mjs` detected stale `codewhale --version # X` install snippets and
printed `FAIL`, but the stale branch fell through to the final
`console.log("[check-docs] PASS")` without `process.exit(1)`. CI could miss
public install-copy drift the gate exists to catch.
Mirror the `exit(1)` used by the missing-sources and version checks: on stale
snippets, print the details and exit non-zero; the final PASS is reached only
when every check passes.
Fixes #3770
|
Claude finished @Hmbown's task in 1m 6s —— View job Code Review
The fix is correct and focused. Here's the full analysis: Logic before and afterBefore: if (!install.ok && !install.note) {
// prints FAIL + stale details…
} else {
console.log(`[check-docs] OK — install snippets…`);
}
console.log("[check-docs] PASS"); // ← always reached, even on failureAfter: if (!install.ok && !install.note) {
// prints FAIL + stale details…
process.exit(1); // ← gate now actually closes
}
console.log(`[check-docs] OK — install snippets…`); // only reached on success
console.log("[check-docs] PASS");The early-exit transformation is equivalent to the original Edge cases — all handled correctly
The distinction between "inconclusive" ( Minor nit — comment references issue number
VerdictLGTM. The bug fix is minimal, correct, and consistent with how checks 1 and 2 are structured. The one nit above is optional cleanup. |
Summary
Closes #3770.
web/scripts/check-docs.mjsprintedFAILfor stale install snippets but then fell through to[check-docs] PASSwithout exiting non-zero, so CI could miss public install-copy drift.Change
The stale-snippet branch now calls
process.exit(1)(mirroring checks 1 & 2), and the finalPASSis only printed when every check passes.Validation
cd web && node scripts/check-docs.mjson a fresh tree →[check-docs] PASS, exit 0.exit(1)path before any PASS line.Acceptance criteria
checkInstallSnippets()returns stale entriesPASSprinted only if every check passednpm run check:docsstill passes