Skip to content

πŸ› fix(automerge): apply one hive-ownership rule across DCO split and squash-unsafe checks - #16706

Merged
hivecommons-hive[bot] merged 1 commit into
v5from
scanner/fix-16701
Nov 5, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
v5from
scanner/fix-16701

Conversation

@hivecommons-hive

Copy link
Copy Markdown
Contributor

#16698 made the DCO split identity-aware, but a few things lagged behind it. The split and the squash-unsafe count in the same loop used different ownership rules. Splits cached before the change still counted project.ai_author commits as "other". The code and docs also claimed that email-derived login linkage was stronger than it is.

Tests: a stats test for squash-unsafe counting with hive identities (nil predicate and self-squash unchanged); a stageDCO test showing a legacy cached split is read once and the refreshed cache is then served; and a store test checking that NoteDCO marks a legacy record even when its counts are unchanged.

Closes #16701
Closes #16702
Closes #16703

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

…uash-unsafe checks

Count project.ai_author-linked commits as the hive's in the squash-unsafe
check too (#16703), re-read DCO splits cached before hive identities
counted (#16701), and document the email-derived login-linkage trust
assumption for in-place re-signing (#16702).

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 5, 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 danathar 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 5, 2026
@github-actions

github-actions Bot commented Nov 5, 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.

No conflicting open PRs or same-file overlaps were found.

@hivecommons-hive

hivecommons-hive Bot commented Nov 5, 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

Hive filed review findings that do not block this PR as backlog items:

Cap: 10 backlog item(s) per PR per day.

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

Correctness review @ 45a8dc1 β€” no blocker. The squash-unsafe branch now uses dcoCommitOwnedByHive (automerge_stage_dco.go:87), the cache gate re-reads legacy records (:146), and NoteDCO marks the record even when counts are unchanged (store.go:2488-2493), which the three new tests cover. Consumers of DCOSquashUnsafeHive (nudge/adopt/types) read it as "hive commits a squash would misattribute", so the widened rule is consistent downstream.

One latent mismatch (low, non-blocking):

  • Store.NoteDCO sets DCOSplitHiveIdentity = true unconditionally (src/pkg/stagelabels/store.go:2493), but stageDCO passes policy.HiveAuthor straight through and dcoCommitOwnedByHive counts App-only when it is nil (automerge_stage_dco.go:124-126, :165). So a split computed with a nil predicate is marked "computed with hive identities", contrary to the field doc (store.go:162-164); if a hive later gained a HiveAuthor, those records would be served from cache rather than re-read. In production HiveAuthor is always wired (src/cmd/hive/merge_eligibility.go: HiveAuthor: hiveIdentity(cfg).Matches), so this is unreachable today; a cheap hardening is to pass hiveIdentity bool (= policy.HiveAuthor != nil) into NoteDCO, or soften the field comment.

Advisory: after rollout, every record in the store lacks the flag, so the first sweep issues one commits GET per cached PR (including u == 0 heads, which is needed for the #16703 recount). Expected, just a one-time burst.

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

docs-currency (read head 45a8dc1): the code change is consistent with #16701/#16702/#16703, but two pieces of operator-facing text lag the widened squash-unsafe rule.

  1. PR comment text still says "signed off as the hive App" β€” src/pkg/github/automerge/automerge_merge_commit.go:91 (MergeCommitComment: "%d of %d commits … are the hive's, signed off as the hive App"). After automerge_stage_dco.go:87 switched the squash-unsafe branch to dcoCommitOwnedByHive(rc, appLogin, isHive), stats.squashUnsafeHive also counts commits GitHub links to project.ai_author, whose only sign-off condition is !messageHasPRAuthorSignoff β€” i.e. not necessarily the App's trailer (your own test fixture at automerge_stage_labels_test.go:2447 uses Signed-off-by: Hive <hive@…>). The posted comment would then misdescribe the commits. Suggest: "signed off as the hive (the App or one of its agent identities)".

  2. stage-labels.md inconsistencies in/around the rewritten paragraph β€” src/docs/labels-and-control-signals/stage-labels.md:1167 still opens with "Hive-authored" is decided the same way as head attribution above, then lists project.ai_author as counting; but head attribution (:1002, "only when the commit's GitHub-linked author/committer is the App bot"; automerge_contributor_adopt.go:1818 β†’ commitByApp) stays App-only. The lead-in now contradicts the rule it introduces β€” drop or qualify it ("…decided like head attribution above, but also counting…"). Likewise the squash-unsafe passages still say "App-linked commits" / "App-signed fix" (:368, :463, :584, :865) although [reviewer] Review backlog (style): squashUnsafeHive still uses App-only ownership, inconsistent with the new unsigned split in the same loopΒ #16703 widened that count to hive identities.

Both are wording fixes; no code concern from this perspective.

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

Read the tree at 45a8dc1 (automerge_stage_dco.go, automerge_stage_labels.go, stagelabels/store.go) plus the three linked issues. The change does what #16701/#16702/#16703 ask, and I found nothing that should block it.

What I verified

One informational note (not a blocker)

NoteDCO sets DCOSplitHiveIdentity = true regardless of what project.ai_author was when the split was computed (store.go:2493), and in production policy.HiveAuthor is always a non-nil method value (merge_eligibility.go:133 β†’ hiveIdentity(cfg).Matches). So a head cached while ai_author was empty, on a hive that later sets it, will not be re-read; it keeps today's behaviour until a new head. That is the same gap #16701 describes, just narrowed to a config change mid-flight β€” fine to leave as is, worth knowing if someone hits it.

Evidence bundle `#1670645a8dc1` sha256:f1716e2411325b7c4aa0ff188e497c812bae9a1a39a6c15d5d175b04a1d4875e β€” download from the dashboard or `hivectl review evidence #16706`.

@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 5, 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.

Style review (head 45a8dc1) β€” one in-scope maintainability note; otherwise the three issues are addressed as described.

DCOSplitHiveIdentity is documented as "split computed with hive identities counted" but is set whenever NoteDCO runs, including when no identity was consulted β€” src/pkg/stagelabels/store.go:162-165 says the flag marks "a split computed with the hive's own identities (project.ai_author) counted", and stageDCO (src/pkg/github/automerge/automerge_stage_dco.go:146) reads it as exactly that. But NoteDCO (store.go:2493) sets r.DCOSplitHiveIdentity = true unconditionally, and the only production caller (automerge_stage_labels.go:1193) passes nothing about the policy, so a split produced with policy.HiveAuthor == nil (automerge_stage_dco.go:167) is persisted under the same flag. The field therefore actually means "written by a post-#16701 NoteDCO", not what its comment and name say; a hive that configures project.ai_author after records were written will never take the one-time re-read, which is the same shape of staleness #16701 fixed. Concrete fix, pick one: (a) thread policy.HiveAuthor != nil into NoteDCO as a hiveIdentity bool and set the field from it (then the stageDCO guard is correct as written), or (b) keep the code and reword the field comment (and the stage-labels.md sentence "a split cached before hive identities counted is read again once") to say the flag marks a record written since the hive-identity split existed, so the next reader does not rely on a guarantee the store does not give. (a) is the smaller surprise for a persisted field.

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

@github-actions

github-actions Bot commented Nov 5, 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 5, 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 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

0 participants