Skip to content

✨ feat(github): enforce pin-only exception in merge-request relay - #16456

Closed
hivecommons-hive[bot] wants to merge 6 commits into
v5from
hive/adopt-16398
Closed

hivecommons-hive[bot] wants to merge 6 commits into
v5from
hive/adopt-16398

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Supersedes #16398 (adopted after CI went red and the contributor was unavailable; original commits by @thatguywob preserved).

Fixes #16265

This branch is #16398's head aadac19fdca4 as pushed by @thatguywob (fork thatguywob/hive), unchanged. Last lane reason on the original: conflicting.

Hive fix agent: rebase this branch on v5, fix the failing checks / review asks, and push to THIS branch. Keep the original author's commits and their Signed-off-by; add your own sign-off on your commits. Do not open another PR.

Conflicts with v5: the contributor head could not be replayed onto the base, so this copy opened as it is and the hive's fixer is resolving the conflicts on this branch (rebase-resolve episode, two attempts). If both fail the PR parks for a person: adopt the commits into a fresh branch, or close it as superseded.

@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 hanthor 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 needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 3, 2026
@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 stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) labels Nov 3, 2026
thatguywob and others added 2 commits November 3, 2026 12:48
Apply the configured trusted-author pin policy only with a complete changed-file list and an exact requested head, rechecking the head after reading patches. Preserve the existing hold behavior on rejection and all later merge gates.

Hive-Run: #16265
Hive-Plan: merge-request-relay
Hive-Spec: #16265#Changes
Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>
…rge-request relay

The relay's pin-only exception was written against the sweep as it stood
before #16399 added verified-commit provenance and upstream action-pin
anchoring, so after rebasing onto v5 the relay would have been the one App
merge path that admitted a pin-only diff on the PR author login alone. Lift
the sweep's provenance helpers into pkg/github and have both the sweep and
the relay call them, so the three merge paths cannot disagree.

Refs #16265, #16399

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Rebased hive/adopt-16398 onto v5 (conflicts were prose in hive-merge.md, operator-reference/README.md and the PinOnlyException doc comment, resolved to keep the #16399 wording and state the relay now applies it).

The rebase also exposed a semantic gap: the relay's exception predates #16399, so it would have admitted a pin-only diff on the PR author login alone while the sweep and /approve additionally require verified trusted-author commits and upstream-anchored action pins. Follow-up commit lifts those helpers into pkg/github (PinOnlyCommitsTrusted, PinOnlyActionPinsUpstream) and has both the sweep and the relay call them; relay tests cover the new refusals and pass cases.

hive/awaiting-ci: CI pending — sweep will merge when green.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: 3a7f39e58

— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88

@kubestellar-prow kubestellar-prow Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 3, 2026
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it labels 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.

docs-currency (reviewed current head 3a7f39e; the dispatched head aadac19 has been superseded on this branch)

The doc updates in src/docs/hive-merge.md and src/docs/operator-reference/README.md match what mergeRequestHumanMergePathRefusal / pinOnlyProvenance now do (src/pkg/github/human_merge_paths.go:269-316). Two operator-facing statements were missed:

  1. changelog.d/added-pin-only-human-merge-sweep.md:1 (unreleased, same release notes as the new fragment) still ends with "and the hive-merge relay does not apply the exception yet (#16265)". Rendered together with changelog.d/added-pin-only-human-merge-relay.md:1, the release notes contradict themselves. Drop that trailing clause (or reword to "the relay enforcement landed separately").
  2. src/docs/hive-merge.md:261 — "relay admission (#16265), and sweep admission (#16266, landed) are separate changes" marks only the sweep as landed; with this PR the relay is too. Mark it (#16265, landed) or drop the per-item markers.

Nit, no action required: src/docs/operator-reference/README.md:257 describes the conditions as "The sweep does not place a … hold"; the same sentence now applies to the GitHub relay as well.

— hive: agent=adjudicator-3 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@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
#16598 ✨ Auto-decide reviewer scope questions on hive-authored green PRs same files src/pkg/config/config.go
#16600 ✨ Activity Monitor chevrons: active-with-text / icon-only spec, ring glyph, workflow-approval stall caption same files src/pkg/github/client.go
#16514 ✨ feat(dashboard): replace Matrix presentation with Code activity same files src/docs/operator-reference/README.md
src/pkg/config/config.go

golangci-lint (unused) flagged the Engine-level wrapper; the relay and
sweep call hgithub.PinOnlyTrustedCommitter directly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive hivecommons-hive Bot added stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels 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.

Correctness re-review at 3a7f39e5 (delta vs aadac19f is almost entirely the v5 rebase; the PR's own diff is 12 files).

New in the delta — blocks CI:

  • src/pkg/github/automerge/automerge_human_paths.go:139 — pinOnlyTrustedCommitter is now a one-line wrapper around hgithub.PinOnlyTrustedCommitter, but its only caller (the old in-package pinOnlyCommitsTrusted body) was deleted when the logic moved to src/pkg/github/pin_only_provenance.go:66. golangci-lint on this head fails with func pinOnlyTrustedCommitter is unused (unused) (run 41688343489). Fix: delete the wrapper (and its mention in the comment at lines 123–126); pinOnlyTrustedLogin is still used at line 102 and can stay.

Previous findings at this head:

  • [correctness] relay trusted-author match without TrimSpace — fixed: human_merge_paths.go:270 now calls PinOnlyTrustedLogin, which trims both sides (pin_only_provenance.go:30-41), so relay and sweep share one matcher.
  • [docs-currency] changelog.d/added-pin-only-human-merge-sweep.md:1 still says the relay "does not apply the exception yet" — still present (not re-filed here).
  • [docs-currency] src/docs/hive-merge.md:261 rollout paragraph still marks only sweep admission as landed — still present (not re-filed here).

Relay logic itself checks out: requested-head binding before (human_merge_paths.go:273) and after the file listing (:313-316), exact changed-file count (:275), full-diff classification, shared commit provenance and upstream anchoring, all fail-closed; TestMergeRequestPinOnlyException covers each refusal branch and the test (rest *) shards pass on this head.

— hive: agent=ci-maintainer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it 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.

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

Style review at head 3a7f39e (the PR moved past aadac19 after the fixer's rebase; the shared-helper commit is what I read).

Dead wrapper left behind by the helper extraction — src/pkg/github/automerge/automerge_human_paths.go:139 still defines pinOnlyTrustedCommitter(policy, login), but its only former caller was the in-package pinOnlyCommitsTrusted, which now delegates wholesale to hgithub.PinOnlyCommitsTrusted (automerge_human_paths.go:131). Nothing in the file (only pinOnlyTrustedLogin is still called, at line 102) or in automerge_human_paths_test.go references it. unused is an enabled ratchet linter (src/.golangci.yml:49), so this should fail lint. Fix: delete the wrapper and drop its name from the delegation comment at lines 123–124.

Otherwise the extraction into src/pkg/github/pin_only_provenance.go is a faithful move (same bodies, exported names, one REST-caller constant) and the relay gate in human_merge_paths.go:269-286 matches the shape #16265 asked for.

Reviewed by reviewer — no findings.

Reviewer notes

Read the relay gate, the sweep's exemption and the moved helpers at d3c0824; this looks correct to me and matches what #16265 specifies.

What I verified

  • src/pkg/github/pin_only_provenance.go is a byte-for-byte move of the sweep's pinOnlyActionPinsUpstream / pinOnlyCommitsTrusted / trusted-login helpers out of pkg/github/automerge/automerge_human_paths.go; the sweep now delegates (automerge_human_paths.go:124-137), so both merge paths share one provenance policy as [sec-check] human_merge_pin_only waives the human-merge-path hold on PR author login alone — head commits and action SHA upstream reachability are never verified #16399 asked.
  • Relay gating in human_merge_paths.go:269-284 runs the same sequence as humanMergePinOnlyExempt (automerge_human_paths.go:98-121): trusted author → exact req.ExpectSHA (fails closed when empty) → GitHub's changed_files count equals the listed files → ClassifyPinOnlyActions → verified trusted-author commits → upstream-anchored action pins. It then re-fetches the PR (human_merge_paths.go:312-315) and refuses if the head moved during file paging — stricter than the sweep, as the doc now says.
  • Classifier inputs are equivalent: config.PinOnlyException.Spec() (automerge_pin_only.go:49) applies no defaults, so passing raw Paths/Kinds through github.PinOnlySpec cannot diverge from the sweep.
  • Config wiring in notifywire.go:38-44 goes through HumanMergePinOnlyFor, which already returns false for disabled/invalid/case-ambiguous entries, and SetHumanMergePinOnly blanks duplicate normalized keys — ambiguous config fails closed at both layers.
  • The exception only lifts the human-merge-path refusal; TestMergeRequestPinOnlyStillRequiresGreenCI covers that the other relay gates still run. Docs and both changelog fragments are updated consistently.

No findings. One note for the operator: this is a relaxation of a merge gate, but it is dormant until a repo has an enabled auto_merge.human_merge_pin_only entry, so nothing changes on reload for repos without one.

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

Code looks correct to me; routing only because it changes App merge policy.

What I verified in the tree at 9cc50a3:

  • src/pkg/github/human_merge_paths.go:269-286 — the exception runs only after matches is non-empty, and every pre-check fails closed: untrusted author, req.ExpectSHA == "" or head mismatch, pr.ChangedFiles == nil or count ≠ len(files). The default path falls through to HoldForHumanMergePaths + HumanMergePathReason unchanged, so repos without an enabled entry behave exactly as before.
  • human_merge_paths.go:295-313 (pinOnlyProvenance) applies the same three checks as the sweep's humanMergePinOnlyExempt (automerge/automerge_human_paths.go:93-121): intent.ClassifyPinOnlyActions over the full file list, PinOnlyCommitsTrusted, PinOnlyActionPinsUpstream. Those are now one implementation in pin_only_provenance.go, and the sweep's methods are thin delegates (automerge_human_paths.go:126-136), so the two paths cannot drift. The extra re-Get after paging files (:306-310) is stricter than the sweep, not looser.
  • merge_request_watcher.go:178 — the non-GitHub forge branch still denies outright; no exception there, per [scanner] human-merge pin-only exception: enforce in merge-request relay #16265.
  • cmd/hive/notifywire.go:38-44 — wiring goes through cfg.AutoMerge.HumanMergePinOnlyFor, which already rejects disabled/invalid/ambiguous-case entries (config/automerge_pin_only.go:75-94); SetHumanMergePinOnly additionally zeroes duplicate normalized keys (human_merge_paths.go:214-231). Reload-safe via mergePolicyMu.
  • Tests: TestMergeRequestPinOnlyException covers trusted pass, disabled, untrusted, empty trust list, mixed diff, extra unguarded file, outside paths, missing patch, missing count, incomplete list, wrong head, head moved during fetch; TestMergeRequestPinOnlyRequiresExpectedHead covers empty ExpectSHA; TestMergeRequestPinOnlyStillRequiresGreenCI shows other gates are untouched. That is the matrix [scanner] human-merge pin-only exception: enforce in merge-request relay #16265 asked for.

Body vs diff: the body is the adoption boilerplate for #16398 (closed, same head lineage); the diff matches the issue spec. The two refactor commits (3a7f39e, 358e5c0) go slightly beyond the issue by moving the sweep's provenance helpers into pkg/github, but that is what makes the relay and sweep share one policy rather than two copies — I'd keep it.

Open question for the approver only (not a defect): #16265 was scanner-filed under epic #16242. Enabling the relay exception means a PR by a trusted_authors login whose diff is pure pin replacements with verified commits and upstream-anchored SHAs is merged by the App without a person, via both the sweep and hive-merge. The sweep half already landed in #16266; this makes the relay consistent. If that is the intended end state, this is ready.

@hivecommons-hive hivecommons-hive Bot removed the stage/050-review-pending Review swarm requested; awaiting a verdict for the current head label Nov 3, 2026
@hivecommons-hive hivecommons-hive Bot added stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue labels Nov 4, 2026
clubanderson added a commit that referenced this pull request Nov 4, 2026
…s pending, not amber (#16545)

* 🐛 Activity Monitor: never more than two lit chevrons; unreported CI is pending, not amber

Rows lit three chevrons (PR in progress + "CI 7/11 · test not reported" +
a decided review), and a row waiting on its contributor lit CI although
nothing was running — checks not reported are simply not scheduled.

- stageTrackerTrackRunning: a CI / Review track is amber only on motion
  evidence on the current head (check-run in_progress/queued, reviewer
  running/queued, or the backend active flag); never while the row waits
  on a person (071/072 waiting_owner, hold, needs-human).
- Words without motion (missing/unknown/skipped, swarm requested, re-review
  pending) wear the new .pending class: current-phase text, muted field.
- Both tracks running: the stage chevron is settled-current (bright words,
  no amber, no pulse) and its tooltip says it waits on CI and review.
- Tests: every rows fixture asserts count(lit) <= 2 (prelude wrapper);
  cases for #16509 (one lit), #16268 waiting_owner (exactly one lit) and
  three-qualify (tracks win); node shapes in the remediation chevron test;
  existing expectations moved from active to pending where nothing runs.

Fixes #16540

Signed-off-by: Andrew Anderson <andy@clubanderson.com>

* 🐛 Tracks are filled only while running; queued swarm counts 0/N

- CSS: .done / .failing / .pending / .decided on a CI or Review track are
  words in their colour (green pass, red finding, muted pending) on the
  muted field — only a running track (.active) is filled. A PR-in-progress
  row with changes requested shows exactly one filled chevron.
- Go: stageTrackerCountPerspectives zeroes perspectives_done when the swarm
  is unassigned (requested / queued), so "Review 5/5 · swarm requested"
  cannot occur; total falls back to the configured set.
- Tests: Go count case (#16539 shape), rows fixture (#16456 row → 1 lit),
  node shapes + CSS pins; lift the new helpers in the human-attention test
  (runtime-tests failure on this PR).

Refs #16540

Signed-off-by: Andrew Anderson <andy@clubanderson.com>

---------

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@hivecommons-hive hivecommons-hive Bot added stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it and removed stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it stage/085-needs-decision A human decision is owed: sentinel alert, hold/needs-decision label, human-only rule or parked issue labels Nov 4, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

@clubanderson asked the hive to re-author this pull request as a hive PR: its head cannot merge as-is (commits without a Signed-off-by), so the hive re-homes the commits on a hive-owned, signed-off branch and opens a superseding PR; this one is closed when that merges. The author's commits are preserved and attributed.

Fixer exhausted on this head; hive re-authoring from current v5.

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Not superseding: this PR is the hive's own (hivecommons-hive[bot]), so there is no contributor branch to re-home into a fresh hive PR. The adoption/supersede request is cleared; push a fix to this branch or close it and open a new PR.

@hivecommons-hive

Copy link
Copy Markdown
Contributor Author

Re-authoring: the hive's fixer gave up on this PR after 6 attempts on d3c0824304d4. Closing it as superseded; the hive opens a fresh PR for #16265 from the current v5 on its next cycle. Nothing from this branch is merged.

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 copilot dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. hive/superseded Closed by Hive: a different merged PR already landed this change role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. stage/070-fixing Hive-authored PR: CI red, changes requested or needs rebase; a hive agent is fixing it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[scanner] human-merge pin-only exception: enforce in merge-request relay

1 participant