Skip to content

🐛 fix(review): the contributor hands-free rule approves only a fully reviewed head - #17087

Merged
hivecommons-hive[bot] merged 2 commits into
hivecommons:v6from
Danathar:fix/hands-free-needs-full-coverage
Nov 7, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
hivecommons:v6from
Danathar:fix/hands-free-needs-full-coverage

Conversation

@Danathar

@Danathar Danathar commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Summary

On a contributor PR, a bare non-security requires_human (or decision question) resolves hands-free to approve and merge-eligible. That path never checked review coverage, so a head that one perspective never reported on could still be merge-eligible. Since #16994 the relay drops a rate-limited "could not read" review instead of recording it, so the missing perspective can be security: correctness asks a product question, no security finding backs anything, and the head is merge-eligible with no security review. Now the hands-free approve needs the same coverage as the all-approve path. With a perspective missing the head reads incomplete and the planner asks for it.

What went wrong

aggregateReports (src/pkg/review/review.go) has two ways to reach approve:

  • All reports approve: approve only when hasAllRequiredPerspectives holds, otherwise incomplete with review coverage incomplete: missing ….
  • Contributor hands-free rule (Contributor-lane PRs park at 085 needs-decision during CI/Review with no finding surfaced #15640): a requires_human or decision question with no security finding goes to contributorHandsFreeAggregate (src/pkg/review/security_finding.go). When there is nothing to fix, it set approve + merge_eligible with no coverage check.

Before #16994, an unread security review was recorded as a security-lens requires_human, which IsSecuritySensitiveFinding treats as a finding, so the PR parked. Now the relay writes no file for it. securityFindingAcross finds nothing, and the hands-free rule approves. A reviewer kick that simply died leaves the same hole.

I reproduced this on the v6 tip (2161745). Four default perspectives report: correctness gives a bare non-security requires_human, and the other three approve. Security is missing. The result is approve, merge_eligible=true. The same happens at the relay with a combined review whose security entry is a rate-limited "not read".

How far the gap reaches: an untrusted author's PR still parks at stage/090-ready-for-human-merge, so a person merges it. A contributor the hive trusts has no such stop. That means an operator-set registry tier, a verified claim marker, or a PR the hive adopted. The contributor-lane auto-merge tier (src/pkg/github/automerge/automerge_contributor_lane.go) merges that PR on a green head when the reviewer's verdict for it approves.

What changes

  • contributorHandsFreeAggregate: before it resolves to approve, it checks that every perspective the head is owed has reported (the configured set, capped by max_perspectives_per_pr). If one is missing, the head is incomplete and not merge-eligible, with the all-approve path's reason (review coverage incomplete: missing security). Nobody is asked, and the planner re-asks only the missing perspective under pending_ttl / max_redispatch. When the report arrives, the head resolves hands-free to approve as before.
  • The fixer lane, the fix-cycle cap, decision questions and security findings are unchanged, because the check sits only on the approve branch.
  • The check counts reports. It does not call hasAllRequiredPerspectives itself, because that function also requires every verdict to be approve. A sibling reject with a non-security question would then read "coverage incomplete" with nothing left to ask, and the head would never move.
  • retainsOverIncomplete / mergeCollected: a stored partial-coverage approve is not a settled non-approve verdict, so the fresh incomplete replaces it on the next collect (a test covers this). A stored requires_human / changes_requested / reject still wins over incomplete as before, which keeps the head held, so it cannot reopen the hole. There is no re-dispatch loop: the planner's incomplete path keeps the delivered perspectives off the pending list.
  • Docs: one paragraph in src/docs/review-swarm.md under the contributor rule, plus a changelog entry.

Overlap with #17082 (open, fix/unreadable-stored-verdict): that PR adds a collect-time guard in collectForPRs (review.go). The guard turns a hands-free approve into incomplete when a set-aside unreadable report file is on disk for that head. This PR fixes the general case at the source: no file at all, as after the relay skip, or a dead kick. The code here is in security_finding.go, and review.go is untouched. The docs edit is in a different section of review-swarm.md from #17082's hunks. Either can land first. Once both are in, #17082's guard is a subset of this check and stays harmless.

Files

  • src/pkg/review/security_finding.go: the coverage check in contributorHandsFreeAggregate.
  • src/pkg/review/hands_free_coverage_test.go: new tests.
  • src/pkg/review/review_test.go, src/pkg/github/review_verdict_relay_test.go: fixtures updated (see below).
  • src/pkg/github/review_verdict_unreadable_test.go: new relay-level test.
  • src/docs/review-swarm.md, changelog.d/fixed-hands-free-needs-full-coverage.md.

Tests

New tests. Each fails on the v6 tip and passes with the fix:

  • TestContributorHandsFreeWithMissingPerspectiveIsIncomplete: security missing, correctness gives a bare requires_human or a non-security decision question. The head is incomplete, not merge-eligible, with reason review coverage incomplete: missing security.
  • TestContributorHandsFreeIncompleteReasksOnlyMissingPerspective: the planner kicks only security and asks no person, and the head approves once security reports.
  • TestContributorHandsFreeIncompleteReplacesStoredPartialApprove: a stored partial-coverage approve is replaced by incomplete through CollectAndMerge.
  • TestRecordReviewVerdictDroppedSecurityLeavesHandsFreeHeadIncomplete (relay): a combined review with a rate-limited security entry (dropped by UnreadableReviewReason) and a real correctness requires_human gives no merge-eligible aggregate.

Behaviour these pin, which passes both before and after:

  • TestContributorHandsFreeWithFullCoverageStillApproves: the same report set with all five perspectives still resolves hands-free to approve, and also under max_perspectives_per_pr: 3.
  • TestContributorHandsFreeFixOutcomesIgnoreCoverage: the fixer lane and the fix-cycle cap do not wait on coverage.

Existing tests updated. Each one approved hands-free on a single report under the default five-perspective set, which is the partial coverage this PR closes:

  • TestAggregateReportsMatrix ("unbacked decision request on a contributor PR is advisory"), TestAggregateReportsContributorDecisionNeedsBacking and the first case of TestAggregateReportsContributorRequiresHumanNeedsSecurityFinding now add an approve from every other perspective (withApprovingSiblings), so the head is fully reviewed.
  • TestRecordReviewVerdictIsCollectable and TestRecordReviewVerdictPromotesDecisionMarker collect with max_perspectives_per_pr: 1, so their one relayed report is full coverage. What each test checks is unchanged.

Full runs: go test ./pkg/review/... ./pkg/github/... ./pkg/dashboard/... ./cmd/hive/... ./pkg/writeback/..., go vet ./pkg/review/ ./pkg/github/, and src/scripts/check-docs-citations.py / check-docs-links.py.

Refs #16994
Refs #17082
Refs #15640

🤖 Generated with Claude Code

https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

…viewed head

contributorHandsFreeAggregate resolved a bare non-security requires_human
(or decision question) on a contributor PR to approve + merge_eligible with
no coverage check. Since hivecommons#16994 the relay drops a rate-limited "could not
read" review, so a head whose security review was dropped became
merge-eligible on a correctness product question alone. A dead reviewer
kick left the same hole.

The approve branch now needs every perspective the head is owed (the
configured set, capped by max_perspectives_per_pr), the same count the
all-approve path uses. Short of that the head is incomplete with
"review coverage incomplete: missing ...", and the planner re-asks only
the missing perspective. The fixer lane, fix-cycle cap, decision
questions and security findings are unchanged.

Tests that approved hands-free on one report under the five-perspective
default now add approving siblings or collect with
max_perspectives_per_pr: 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1
Signed-off-by: Danathar <Danathar@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 7, 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 nicholasjackson 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 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v6

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

PR Title Relation Files
#17092 🐛 fix(review): a reject is never resolved to approve, and every approve path needs full coverage same files src/docs/review-swarm.md
src/pkg/review/review_test.go

@hivecommons-hive
hivecommons-hive Bot merged commit cf72faf into hivecommons:v6 Nov 7, 2026
67 of 68 checks passed
@hivecommons-hive

Copy link
Copy Markdown
Contributor

Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor.

Evidence bundle `#1708788bc8f9` sha256:6b0f81c2b780eaca1d1bd459196b3e1475347dbdbf49a54e8b8598af271cd770 — download from the dashboard or `hivectl review evidence #17087`.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

merged by Hive trusted-author auto-merge: author @Danathar holds role owner and GitHub permission maintain on repo; CI green at 88bc8f9.

hivecommons-hive Bot added a commit that referenced this pull request Nov 7, 2026
… path needs full coverage (#17092)

On a contributor PR, a perspective's reject next to another perspective's
non-security decision question went to the hands-free rule, which made the
question advisory and dropped the reject with it: approve and
merge-eligible (or the fixer lane with a change request). The head now gets
what the reject alone gives it, reject, and the question stays in reasons.

On a hive-authored PR, the advisory approves for a non-risk decision
question and for a bare non-risk requires_human never checked coverage, so
a head whose security review never arrived (a dead kick, or a rate-limited
review the relay no longer records, #16994) was merge-eligible. With a
perspective missing the head now reads incomplete and the planner re-asks
only that perspective. A fully reviewed head still resolves as advisory.

Refs #16994
Refs #17082
Refs #17087


Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

Signed-off-by: Danathar <Danathar@users.noreply.github.com>
Co-authored-by: Danathar <Danathar@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: hivecommons-hive[bot] <280983584+hivecommons-hive[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

1 participant