Repository navigation
π fix(scripts): action-pins gate fails silently on a tree with no pins; add self-test - #14730
Conversation
β¦s; add self-test check-action-pins.sh only ever ran against this repository's own, correct workflows, so none of its failure branches had executed anywhere. Writing a hermetic self-test for it (src/scripts/test-check-action-pins.sh, fake `gh`, synthetic workflow directories) exposed two defects: - a directory with no SHA-pinned `uses:` made grep exit 1, and pipefail fed that straight into `fail=1`: "action pin check FAILED" with no finding printed above it; - NOT-PINNED printed the line number where the file name belongs (`grep -rhn` drops the name), so the message never said which workflow. The resolver now collects pins first and iterates, reporting every missing SHA instead of stopping at the first; the shape check uses `grep -rHn` so the message names the file. The self-test covers NOT-PINNED (tag, branch, short and upper-case hex), MISSING-SHA, reusable-workflow owner/repo extraction, pin de-duplication, the offline (no gh) path, EMPTY-EXPRESSION, BRACKETED-EMAIL with the numeric-noreply exclusion, combined failures and the default directory. 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 |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of No conflicting open PRs or same-file overlaps were found. |
There was a problem hiding this comment.
Looks correct to me. Read the gate at dd59b59 and ran the self-test locally:
src/scripts/check-action-pins.shusesset -uo pipefail(no-e), so collecting pins intopins="$(grep β¦ | sort -u)"before the loop is safe when grep matches nothing; the empty case now hits[ -z "$ref" ] && continueand printsaction pin check OKinstead of a bare FAILED.grep -rHnEputs the file name back in front of${line%%:*}, soNOT-PINNEDnames the workflow.done <<<"$pins"keeps the loop in the current shell, sofail=1on MISSING-SHA reaches the final verdict and resolution continues past the first miss.bash src/scripts/test-check-action-pins.sh: all passed at head. I also confirmed the crux copy in crux#25 is identical after the header/path lines.
The only red check, govulncheck, is baseline: the job log reports GO-2026-6860 in golang.org/x/net@v0.61.0 (fixed in v0.62.0), which this PR does not touch and #14731 bumps. Nothing here needs to change for it.
Note for the maintainer: the test is not run by any workflow yet β Refs #14729 (needs-human: β¦) is the right form, since the go-security-analysis.yml step needs the workflows permission the hive does not hold.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
βΈοΈ CI is red on the base branch (govulncheck (known vulnerabilities)); holding until it recovers β this is not a failure in this PR, so no fix attempt is counted and no one needs to act here. |
|
Fixed by #25 (merged 2592e5439fd2). Closing. Reply /reopen if the problem persists. |
|
Reopened: the close-on-merge comment above cites π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
Aligns go.mod/go.sum with v5 so govulncheck passes on this branch. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Bring the gate fixes and hermetic self-test from hivecommons#14730 into this branch so the new workflow step can execute before that prerequisite merges. Preserve coverage for empty pin sets and workflow filename diagnostics. Co-authored-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
* π± chore(ci): run action-pins gate self-test Exercise the gate before resolving the repository's action pins. The self-test is provided by #14730. Hive-Run: #14729 Hive-Plan: action-pins-ci-self-test Hive-Spec: #14729#recommendation Signed-off-by: thatguywob <thatguywob@users.noreply.github.com> * π fix(ci): include the action-pins self-test prerequisite Bring the gate fixes and hermetic self-test from #14730 into this branch so the new workflow step can execute before that prerequisite merges. Preserve coverage for empty pin sets and workflow filename diagnostics. Co-authored-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: thatguywob <thatguywob@users.noreply.github.com> --------- Signed-off-by: thatguywob <thatguywob@users.noreply.github.com> Co-authored-by: thatguywob <thatguywob@users.noreply.github.com> Co-authored-by: quality <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Why
src/scripts/check-action-pins.shis the gate behind theaction pins resolvejob, and until now it had notest-*.shsibling: in CI it only ever sees this repository's own correct workflows, so none of its failure branches had executed anywhere. Writing a hermetic self-test for it found two that were wrong:ghpresent and a workflow directory holding no SHA-pinneduses:lines, grep's exit 1 underpipefailbecamefail=1βaction pin check FAILEDwith nothing above it;NOT-PINNEDprinted the line number instead of the file name (grep -rhndrops the name), so the message never said which workflow to fix.The resolver now collects pins first and iterates (reporting every missing SHA rather than stopping at the first), and the shape check uses
grep -rHn. The gate still passes against this repository's real workflows (action pin check OK, live SHAs resolved).src/scripts/test-check-action-pins.shdrives the gate with a fakeghthat records every API call and can be told which SHA to report missing; each case writes a synthetic workflow directory and asserts the exit status, the verdict and the API calls made. It covers NOT-PINNED (tag, branch, short and upper-case hex), MISSING-SHA (single and multiple), reusable-workflowowner/repoextraction, pin de-duplication, the offline (nogh) path, EMPTY-EXPRESSION, BRACKETED-EMAIL with the numeric-noreply exclusion, combined failures and the default directory argument. 70 assertions, no network, ~1s.Mutation-checked: the pre-fix script fails 10 assertions; dropping
-H, dropping theowner/repocut, dropping the numeric-noreply exclusion, or not settingfailon MISSING-SHA each turns the test red. Shellcheck clean. The same change is re-copied into hivecommons/crux (.github/scripts/, crux#25).Fixes #14729 (needs-human: the
go-security-analysis.ymlstep that runs this self-test needs theworkflowspermission; the exact two-line step is in the issue)Filed by quality agent (ACMM L4/L6 β full mode)
β hive: agent=quality backend=copilot model=claude-fable-5.1 copilot=1.0.88