Repository navigation
test(automation-docs): assert the gate's remaining branches and clear its coverage-floor entry - #320
Conversation
… its coverage-floor entry automationDocProblems carried four ranges the suite never executed. Two are vacuity guards worth pinning: an empty workflow tree must be named as "none" rather than an empty list, and a doc set without README.md must still report every committed workflow as undocumented there. The other two could never run — onEntry's second capture group always participates, and the push-branches message is only reached once pushBranches is known to be a list — so they are removed rather than papered over with a test that cannot reach them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Checked both "unreachable" claims against the code rather than the description, since removing a fallback is the only behaviour-shaped part of this PR:
scripts/automation-docs.test.mjs:48-52—([\s\S]*?)is a non-optional group, so when the regex matches at all,m[2]is""at minimum, neverundefined. Dropping?? ""is safe.scripts/automation-docs.test.mjs:138-141— the enclosingifis!(t.push && (t.pushBranches === undefined || …includes("main"))); inside thet.push ? … : …true branch, the outer condition can only hold ifpushBranches === undefinedwas false, so.joinis on a defined array. Safe.
The new fixture test exercises the (have: none) and no-README.md paths with exact expected output. Ran node --test scripts/automation-docs.test.mjs scripts/coverage-floor.test.mjs on the PR head: 27 pass, so the coverage-floor entry deletion holds. Looks correct to me; no findings.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Why
scripts/coverage-floor.test.mjsstill carried"scripts/automation-docs.test.mjs": 4— four ranges insideautomationDocProblems/onEntrythat the suite never executed. Same ratchet step as #317, #318 and #319.Two of the four are the gate's own vacuity guards and are worth pinning:
(have: none)rather than(have: ), so a reader of the failure can tell "nothing committed" from "nothing parsed";README.mdstill reports every committed workflow as not introduced there — a runbook that documents everything must not satisfy the README requirement by accident.The other two were unreachable, so no test could lower them:
onEntry:m[2] ?? ""— the second capture group is([\s\S]*?), which always participates, som[2]is always a string;push.branches: [...]message:(t.pushBranches ?? [])— the enclosing condition is false whenevert.pushis set andpushBranchesis undefined (an unfiltered push does run onmain), so inside the messagepushBranchesis always a list. The existing "an unfiltered push trigger does run on main" assertion already covers that path.Those two fallbacks are removed with a one-line comment each, rather than leaving the ratchet entry at 2 forever.
Verification
node --test scripts/automation-docs.test.mjs→ 13 passnode --test scripts/coverage-floor.test.mjs→ 14 pass with the entry deleted (0 dead ranges in the file)— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88