Skip to content

🌱 chore(actions): surface status-card helper failures and add its regression test - #16451

Merged
hivecommons-hive[bot] merged 4 commits into
v5from
scanner/fix-16363
Nov 3, 2026
Merged

hivecommons-hive[bot] merged 4 commits into
v5from
scanner/fix-16363

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

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 failed gh api call or a non-JSON / wrongly shaped response made has exit 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 prints hive-status-card: error: … and exits 3. has still exits 0 when the section is present and 1 when it is absent. upsert exits 3 without POSTing or PATCHing. Exact section matching, Bot-only card trust and own-author-only upsert are unchanged, and both sub-commands keep their names and arguments.
  • .github/scripts/test-hive-status-card.sh (new): a regression test with a stubbed gh. 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 missing HIVE_COMMENTS_FILE, upsert editing its own marker comment found on a later page, upsert creating a comment when only a third party's comment carries the marker, and upsert making 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 with 2>/dev/null and 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.yml already surfaces a non-zero exit as a warning, so it needs no workflow edit. src/scripts/test-comment-merged-refs.sh gains the matching case: a malformed card payload causes no POST, an ::error:: line and a non-zero exit.
  • .github/scripts/integration-governance.cjs: re-pins TRUSTED_SCRIPTS_TREE to the new src/scripts tree, as required for any src/scripts edit.
  • 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 v5 with git 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/scripts from the trusted default-branch ref with persist-credentials: false and pinned actions/checkout. Permissions stay contents: read and issues: write. The workflow skips when the card carries issue-close, fails visibly when the helper exits 3, and otherwise upserts its own <!-- issue-closed-reopen-hint --> comment.
  • .github/workflows/v2-ci.yml contract-tests and the regenerated integration-candidate.yml / integration-technical-v2-ci.yml: run test-hive-status-card.sh and test-comment-merged-refs.sh in 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

…ression test

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 3, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign clubanderson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

Conflicts are checked with every PR merged onto the current tip of v5, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#16454 πŸ› Restore activity monitor layout and compact chevrons CONFLICT .github/scripts/integration-governance.cjs

@hivecommons-hive hivecommons-hive Bot added author/hive This repository's own hive (the App or one of its agent lanes) authored this PR dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 3, 2026
@hivecommons-hive

hivecommons-hive Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

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: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

β€” hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

Review findings from reviewer (folded here because this head already carries its hive review):

Read the helper, the sweep, the governance verifier and both test scripts at 53bc0cf against v5; ran both new test scripts locally (test-hive-status-card OK, test-comment-merged-refs OK). This looks correct to me.

What I verified

  • Exit-code contract is real, not just documented. comments() (.github/scripts/hive-status-card.sh:49-84) is the only reader; every failure path routes through read_error β†’ exit 3, and both has and upsert now capture it via list=$(comments …) under set -e (:90, :105), so a read failure can no longer fall through to the Python matcher's sys.exit(1) "absent" path. upsert reaches the GET-before-PATCH/POST only after that assignment, so it writes nothing on exit 3.
  • The caller distinguishes 1 from 3. src/scripts/comment-merged-refs.sh:190-202 treats rc 0 as "card has the section", rc 1 as "absent β†’ post", anything else as a read error β†’ ::error::, counted, and the sweep exits 1 at :321-324. The 2>/dev/null on the helper call is gone, so the hive-status-card: error: line reaches the job log.
  • HIVE_COMMENTS_FILE shape matches. The sweep hands a flattened list (comment-merged-refs.sh:166 via flatten_json_pages), and the helper validates it with flat=1; the gh api --slurp path validates a list of pages. Both paths covered by the tests.
  • TRUSTED_SCRIPTS_TREE re-pin is exact. git rev-parse v5:src/scripts = 9ba1ee4… (old literal); git rev-parse 53bc0cf:src/scripts = 25ff55e… (new literal at integration-governance.cjs:12). Only src/scripts is pinned (:98-103), so the .github/scripts edits need no re-pin.
  • No live caller breaks. No file under .github/workflows/ invokes hive-status-card.sh on v5 today; the only caller is the sweep, updated here.

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 v2-ci.yml wiring to the maintainer-pushed patch on #16363 (App token cannot touch workflows). Until that lands, these tests only run by hand. Refs #16363 (needs-human: …) is the right link semantics for that.

Review findings from reviewer-2 (folded here because this head already carries its hive review):

Looks correct to me. Read the helper and its only caller at 09997a3, not just the diff:

  • src/scripts/comment-merged-refs.sh:166 already flattens the --slurp pages before writing HIVE_COMMENTS_FILE, so the new flat="1" branch in comments() (.github/scripts/hive-status-card.sh:49-53) sees the shape it validates. The gh api path keeps flat="0" and unwraps pages itself.
  • read_error runs inside the $(comments …) substitution, but set -e on the assignment at hive-status-card.sh:84 / :105 propagates its exit 3 out of the script, so has really does exit 3 (not 1) on a read failure and upsert never reaches the PATCH/POST at :114-117.
  • TRUSTED_SCRIPTS_TREE (integration-governance.cjs:12) = 25ff55e8… matches git rev-parse 09997a3:src/scripts.
  • Code search shows no other caller of the helper, so there is no consumer that reads exit 3 differently from before.
  • refs-sweep.yml:72 already wraps the per-PR call in || echo "::warning…", so the new exit 1 at the end of the sweep surfaces as a warning in the scheduled run; the single-PR path at :58 will fail the job instead, which matches the stated intent.
  • Ran both test-hive-status-card.sh (17 ok) and test-comment-merged-refs.sh (OK, including the new fix: honor 'hold' label as only skip signalΒ #25 malformed-card case) locally against this head.

The body's claim that the new helper test is not yet wired into canonical CI is accurate β€” the contract-tests job here does not run it, so the green check does not cover it until the maintainer-side workflow patch on #16363 lands.

Evidence bundle `#164511b3131b` sha256:41700036e0cc42d18a41c5a481019613f84362ed41d3e9b2ecac4f0eb09e2ff2 β€” download from the dashboard or `hivectl review evidence #16451`.

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks correct to me (read at head cf90745).

  • Exit-code contract. comments() now validates shape in one place and read_error exits 3 (.github/scripts/hive-status-card.sh:40-45, :51-83); because has/upsert capture it via list=$(comments …) under set -euo pipefail (:86-87, :104-105), the 3 propagates unchanged instead of collapsing to 1. Exact-section matching and the own-author rule in upsert are untouched.
  • Callers. The only live consumer of has is src/scripts/comment-merged-refs.sh, which this PR updates to treat rc != 1 as a read failure, skip without posting, count it, and fail the sweep at the end (:188-203, :320-323). issue-closed-reopen-hint.yml on v5 does 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_TREE in .github/scripts/integration-governance.cjs:12 is checked against git rev-parse HEAD:src/scripts (:98, :101-104). I verified the new literal 25ff55e8… is the src/scripts tree at this head and the old 9ba1ee4c… is the tree on v5, so this is the mandatory re-pin for editing src/scripts, not a widening. It will need re-pinning again if another src/scripts change lands on v5 first.

β€” hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_error exits 3 inside the $(...) subshell and list=$(comments …) at :84/:106 propagates that status under set -e, so has can no longer turn a parse failure into exit 1 ("absent"). has keeps 0/1; upsert returns before any PATCH/POST.
  • src/scripts/comment-merged-refs.sh:191-203 β€” card_rc capture is set -e-safe; 0 β†’ skip, 1 β†’ post, anything else β†’ ::error:: + counted, and :321-324 makes the sweep exit 1 after the parent auto-close pass. refs-sweep.yml:72 already 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_TREE 25ff55e8… equals git rev-parse HEAD:src/scripts at this head (base v5 is 9ba1ee4c…), so the re-pin is correct.
  • Ran bash .github/scripts/test-hive-status-card.sh and bash src/scripts/test-comment-merged-refs.sh at this head: both OK. The new cases exercise exactly the paths changed (API failure, non-JSON, non-list, malformed comment, missing/bad HIVE_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

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_error exits 3 inside the $(comments …) substitution; because has/upsert bind it with list=$(comments …) under set -euo pipefail (:86, :105), the assignment's non-zero status propagates and the script exits 3 before any matcher or gh api -X runs. has still exits 1 from the matcher's sys.exit(1) when the section is absent.
  • .github/scripts/hive-status-card.sh:56-57 β€” HIVE_COMMENTS_FILE is validated as a flat list (flat="1"), which matches what the sweep writes: src/scripts/comment-merged-refs.sh:166 already flattens pages via flatten_json_pages before handing the file over.
  • src/scripts/comment-merged-refs.sh:190-203 β€” the old 2>/dev/null … if collapsed every non-zero exit into "post". Now only 0 skips and only 1 posts; any other code counts a card_error, ::error::s and continues. The temp file is removed on every path. :321-324 exits 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 :58 has no ||, so under Actions' bash -e a 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_TREE 25ff55e8… equals git rev-parse 09997a3:src/scripts; v5's pin 9ba1ee4c… equals v5:src/scripts. The re-pin is exactly what :103 demands for a src/scripts edit; no permission or trust-list change.
  • Tests: test-hive-status-card.sh β†’ OK and test-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.md and src/docs/notifications.md:690-697 describe 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

@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 3, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:166 already flattens the paginated pages before handing them to the helper, so the new flat="1" branch in comments() (.github/scripts/hive-status-card.sh:49-57) parses the right shape. The caller now branches on 0 / 1 / other (comment-merged-refs.sh:190-203) and the ::error:: path falls through to exit 1 after 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_error runs inside the $(comments …) substitution, so list=$(…) 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.sh and src/scripts/test-comment-merged-refs.sh locally β€” both OK. Swapped in the pre-PR helper from v5 and the new suite reports 9 failures, so the error cases genuinely fail without this change.
  • TRUSTED_SCRIPTS_TREE (integration-governance.cjs:12) equals git rev-parse pr16451:src/scripts = 25ff55e8….
  • refs-sweep.yml:72 already 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

@hivecommons-hive
hivecommons-hive Bot merged commit 55318dc into v5 Nov 3, 2026
80 of 81 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the scanner/fix-16363 branch November 3, 2026 18:14
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

@hivecommons-hive hivecommons-hive Bot removed role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/hive This repository's own hive (the App or one of its agent lanes) authored this PR conflicts-with-open-pr Open PR has a merge conflict with another open PR copilot dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants