Repository navigation
π± chore(actions): surface status-card helper failures and add its regression test - #16451
Conversation
β¦ression test Signed-off-by: scanner <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
|
|
Hive status β updated in place; edits do not notify. Full history is in the Activity Monitor. hive/awaiting-ci: CI pending β sweep will merge when green. π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 Review findings from Read the helper, the sweep, the governance verifier and both test scripts at 53bc0cf against What I verified
Noted, not a finding: the two new test scripts are not run by any workflow on this branch β the body says so explicitly and defers the Review findings from Looks correct to me. Read the helper and its only caller at
The body's claim that the new helper test is not yet wired into canonical CI is accurate β the |
There was a problem hiding this comment.
Looks correct to me (read at head cf90745).
- Exit-code contract.
comments()now validates shape in one place andread_errorexits 3 (.github/scripts/hive-status-card.sh:40-45,:51-83); becausehas/upsertcapture it vialist=$(comments β¦)underset -euo pipefail(:86-87,:104-105), the 3 propagates unchanged instead of collapsing to 1. Exact-section matching and the own-author rule inupsertare untouched. - Callers. The only live consumer of
hasissrc/scripts/comment-merged-refs.sh, which this PR updates to treatrc != 1as a read failure, skip without posting, count it, and fail the sweep at the end (:188-203,:320-323).issue-closed-reopen-hint.ymlonv5does not call the helper yet, so nothing is left reading 3 as absence; the workflow wiring is correctly left to a maintainer (Refs #16363 (needs-human: β¦)). - Trust pin.
TRUSTED_SCRIPTS_TREEin.github/scripts/integration-governance.cjs:12is checked againstgit rev-parse HEAD:src/scripts(:98,:101-104). I verified the new literal25ff55e8β¦is thesrc/scriptstree at this head and the old9ba1ee4cβ¦is the tree onv5, so this is the mandatory re-pin for editingsrc/scripts, not a widening. It will need re-pinning again if anothersrc/scriptschange lands onv5first.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read the helper, the sweep, and the single caller at head 53bc0cf. The change does what it says and I found no defects.
Verified
.github/scripts/hive-status-card.sh:52-77βcomments()now validates the payload before any matcher sees it;read_errorexits 3 inside the$(...)subshell andlist=$(comments β¦)at :84/:106 propagates that status underset -e, sohascan no longer turn a parse failure into exit 1 ("absent").haskeeps 0/1;upsertreturns before any PATCH/POST.src/scripts/comment-merged-refs.sh:191-203βcard_rccapture isset -e-safe; 0 β skip, 1 β post, anything else β::error::+ counted, and:321-324makes the sweep exit 1 after the parent auto-close pass.refs-sweep.yml:72already wraps the loop call with|| ::warning::, so the multi-PR path degrades to a warning as the body says. The single-PR path (refs-sweep.yml:58) has no such wrapper and will fail the step instead β that is the "fail visibly" outcome, just a stricter one; noting it only so nobody is surprised.integration-governance.cjs:12βTRUSTED_SCRIPTS_TREE25ff55e8β¦equalsgit rev-parse HEAD:src/scriptsat this head (basev5is9ba1ee4cβ¦), so the re-pin is correct.- Ran
bash .github/scripts/test-hive-status-card.shandbash src/scripts/test-comment-merged-refs.shat this head: bothOK. The new cases exercise exactly the paths changed (API failure, non-JSON, non-list, malformed comment, missing/badHIVE_COMMENTS_FILE, no-write on read failure).
One thing for the maintainer, not a code defect
The body says #16363 "should stay open until [the workflow] patch lands", but #16363 is already closed. After this merges, the only record of the still-pending issue-closed-reopen-hint.yml / v2-ci.yml contract-tests wiring is a patch attached to a closed issue and the Pending row in src/docs/notifications.md. Worth either reopening #16363 or filing a fresh tracker when a maintainer applies that patch; otherwise the new test files exist but canonical CI never runs them.
Looks correct to me.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read the helper, the sweep, the governance pin and the single workflow caller at head 09997a3; ran both test scripts. The change does what it says and I found no defects. Looks correct to me.
Verified
.github/scripts/hive-status-card.sh:42-45, 51-83βread_errorexits 3 inside the$(comments β¦)substitution; becausehas/upsertbind it withlist=$(comments β¦)underset -euo pipefail(:86,:105), the assignment's non-zero status propagates and the script exits 3 before any matcher orgh api -Xruns.hasstill exits 1 from the matcher'ssys.exit(1)when the section is absent..github/scripts/hive-status-card.sh:56-57βHIVE_COMMENTS_FILEis validated as a flat list (flat="1"), which matches what the sweep writes:src/scripts/comment-merged-refs.sh:166already flattens pages viaflatten_json_pagesbefore handing the file over.src/scripts/comment-merged-refs.sh:190-203β the old2>/dev/null β¦ ifcollapsed every non-zero exit into "post". Now only0skips and only1posts; any other code counts acard_error,::error::s andcontinues. The temp file is removed on every path.:321-324exits 1 after the parent auto-close pass, so that pass still runs..github/workflows/refs-sweep.yml:72β the scheduled loop already does|| echo "::warning::β¦", so the new non-zero exit surfaces without a workflow edit, as the body says. (Info only: the manual single-PR dispatch at:58has no||, so under Actions'bash -ea card read failure fails that step outright β visible rather than silent, which seems right for a hand-triggered run.).github/scripts/integration-governance.cjs:12βTRUSTED_SCRIPTS_TREE25ff55e8β¦equalsgit rev-parse 09997a3:src/scripts; v5's pin9ba1ee4cβ¦equalsv5:src/scripts. The re-pin is exactly what:103demands for asrc/scriptsedit; no permission or trust-list change.- Tests:
test-hive-status-card.shβ OK andtest-comment-merged-refs.shβ OK at this head. Swapping in the v5 helper makes 9 of the new assertions fail (the exit-3 cases and the error-line check), so the test does fail without the fix. changelog.d/fixed-16363-status-card-errors.mdandsrc/docs/notifications.md:690-697describe the same exit contract the code implements; the Issue Closed Hint row correctly stays Pending since the workflow half is still a maintainer-applied patch on #16363.
No findings to raise. Part of #16363 (needs-human: β¦) is the right link semantics here β the workflow files cannot be pushed by the App token, and the body says so on the same line.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Looks correct to me. What I verified against the tree at 1b3131b (merge-base edcb058), not just the diff:
- Exit-code contract holds for the only caller.
src/scripts/comment-merged-refs.sh:166already flattens the paginated pages before handing them to the helper, so the newflat="1"branch incomments()(.github/scripts/hive-status-card.sh:49-57) parses the right shape. The caller now branches on0/1/ other (comment-merged-refs.sh:190-203) and the::error::path falls through toexit 1after the parent auto-close pass (:321-324), so a card read failure no longer silently becomes "absent β POST". - Error propagation under
set -euo pipefail:read_errorruns inside the$(comments β¦)substitution, solist=$(β¦)fails with status 3 and the script exits 3 before any matcher or PATCH/POST runs β matches the header comment at:10-18. - Tests: ran
.github/scripts/test-hive-status-card.shandsrc/scripts/test-comment-merged-refs.shlocally β bothOK. Swapped in the pre-PR helper fromv5and the new suite reports 9 failures, so the error cases genuinely fail without this change. TRUSTED_SCRIPTS_TREE(integration-governance.cjs:12) equalsgit rev-parse pr16451:src/scripts=25ff55e8β¦.refs-sweep.yml:72already wraps each sweep in|| echo "::warning::β¦", so the new non-zero exit surfaces without a workflow edit, as the body says.
One thing for whoever applies the follow-up workflow patch on #16363: until contract-tests runs the two scripts, the "pin this behaviour" sentence in src/docs/notifications.md is true only locally. The PR body is upfront about that, so not a blocker here.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Finishes the pushable part of #16363 under the owner's decision: "surface actual API/parse failures rather than silently calling them absence", "preserve exact section matching, ordinary behavior when the card is absent", and "wire the helper/refs-sweep regressions into canonical CI".
Part of #16363 (needs-human: the .github/workflows/issue-closed-reopen-hint.yml edit must be pushed by a maintainer with their own credentials; refreshed patch is on the issue)
Changes and why
.github/scripts/hive-status-card.sh: before this, a failedgh apicall or a non-JSON / wrongly shaped response madehasexit 1, which callers read as "no card". A workflow would then post the duplicate the helper exists to prevent. The helper now checks the comment list first. On a read or parse failure it printshive-status-card: error: β¦and exits 3.hasstill exits 0 when the section is present and 1 when it is absent.upsertexits 3 without POSTing or PATCHing. Exact section matching, Bot-only card trust and own-author-onlyupsertare unchanged, and both sub-commands keep their names and arguments..github/scripts/test-hive-status-card.sh(new): a regression test with a stubbedgh. It covers exact matching (issue-closeβissue-closed,issue-partial:163βissue-partial:1638), the explicit:prefix, no card leading to exit 1 with no stderr, a human quoting the markers, an API failure, a non-JSON response, a non-list response, a malformed comment, a bad or missingHIVE_COMMENTS_FILE,upsertediting its own marker comment found on a later page,upsertcreating a comment when only a third party's comment carries the marker, andupsertmaking no write on read failure. The error cases fail against the previous helper.src/scripts/comment-merged-refs.sh: the refs sweep called the helper with2>/dev/nulland treated any non-zero exit as absence. It now skips only on 0 and posts only on 1. Any other exit skips that issue with an::error::annotation and makes the sweep exit non-zero at the end, after the parent auto-close pass.refs-sweep.ymlalready surfaces a non-zero exit as a warning, so it needs no workflow edit.src/scripts/test-comment-merged-refs.shgains the matching case: a malformed card payload causes no POST, an::error::line and a non-zero exit..github/scripts/integration-governance.cjs: re-pinsTRUSTED_SCRIPTS_TREEto the newsrc/scriptstree, as required for anysrc/scriptsedit.src/docs/notifications.md: adds one paragraph to the Actions-dedup section describing the failure behaviour. The Issue Closed Hint row stays Pending. Nothing here claims the workflow change has shipped.changelog.d/fixed-16363-status-card-errors.md: the fragment for the user-visible refs sweep change.What remains for a maintainer (cannot be pushed by the App token)
The refreshed patch on #16363 applies cleanly to
v5withgit apply --check. Apply it after this PR merges, because it calls the new test file. It touches:.github/workflows/issue-closed-reopen-hint.yml: checks out.github/scriptsfrom the trusted default-branch ref withpersist-credentials: falseand pinnedactions/checkout. Permissions staycontents: readandissues: write. The workflow skips when the card carriesissue-close, fails visibly when the helper exits 3, and otherwiseupserts its own<!-- issue-closed-reopen-hint -->comment..github/workflows/v2-ci.ymlcontract-testsand the regeneratedintegration-candidate.yml/integration-technical-v2-ci.yml: runtest-hive-status-card.shandtest-comment-merged-refs.shin canonical CI. That job is defined only in workflow files, so the wiring cannot be pushed from here.The issue should stay open until that patch lands and is verified. The acceptance boxes are deliberately left unticked.
β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88