Repository navigation
test(hardening gate): assert the action-shape rule and parser stops; clear its coverage-floor entry - #312
Conversation
…ear its coverage-floor entry The action-shape rule (owner/repo[/path]@sha), the workflowJobs break at the next top-level key and the jobSteps break at the next job-level key were executed by no fixture, so TEST_HELPER_BASELINE carried three dead ranges for this gate. Each new test fails when its branch is removed. 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.
Read the parser and rule code the three fixtures target, ran the suite at 7f78196, and mutation-checked both breaks. This looks correct to me.
What I verified
scripts/workflow-hardening.test.mjs:75(workflowJobstop-level stop) — removing thebreakfails only the new "stops at the next top-level key" test:phantom:is then parsed as a job withruns-onand notimeout-minutes.scripts/workflow-hardening.test.mjs:96(jobStepsjob-level stop) — removing thebreakfails only the new "stops at the next job-level key" test, via the "nothing under env: belongs to a step" assertion.scripts/workflow-hardening.test.mjs:148(action-shape rule) —scorecard-action@<sha>andossf/scorecard-action:v2@<sha>both fail^[\w.-]+\/[\w.-]+(\/[^@\s]+)?$and nothing else, so the single-problemdeepEqualat line 297 is exact; thebothcase reports shape then SHA in the push order at lines 148–149.node --test scripts/*.test.mjs: 816 pass with theTEST_HELPER_BASELINEentry removed, consistent with the floor's "delete it at zero" rule (scripts/coverage-floor.test.mjs:31).
One info-level note (not a defect): the comment at workflow-hardening.test.mjs:273-274 says the break is what keeps the stray persist-credentials from rescuing an unhardened checkout. In this fixture, without the break the stray line would be appended to the last step (- run: echo ok), not the checkout at line 14, so the p.length === 1 assertion passes either way; the pinning assertion is the one on line 271. Harmless, but the comment slightly overstates what lines 275–278 prove.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. Review findings from Read the parser under test, not just the diff: One note on a comment, not the test (info): the trailing comment in the |
Test Improvement
scripts/coverage-floor.test.mjscarried"scripts/workflow-hardening.test.mjs": 3inTEST_HELPER_BASELINE: three branches of the supply-chain hardening gate that no fixture ever executed. One of them is the gate's own action-shape rule — auses:such asscorecard-action@<sha>(no owner) orowner/repo:tag@<sha>was never shown to produceexpected owner/repo[/path]@sha, so that rule could regress to never firing and the suite would stay green. The other two are the parser stops:workflowJobsbreaking at the next top-level key (a trailingenv:block whose two-space children look exactly like job names) andjobStepsbreaking at the next job-level key (apersist-credentials: falseunder a job'senv:must not be credited to an unhardenedactions/checkoutstep earlier in the job).This adds three fixture tests pinning those decisions and deletes the baseline entry, the same way #292, #294, #300 and #304 cleared theirs. Each test fails when its branch is removed (verified by deleting the
break/pushin turn); the fullnode --test scripts/*.test.mjsincluding the floor gate passes with the entry gone.Only
scripts/*.test.mjschanges — no page, helper or CI definition is touched.Filed by quality agent (ACMM L4/L6 — full mode)
— hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88