Skip to content

🌱 automerge: upsert signoff-attribution and unauthorized comments instead of reposting per head - #17071

Merged
clubanderson merged 2 commits into
v5from
spam-signoff-upsert
Nov 7, 2026
Merged

clubanderson merged 2 commits into
v5from
spam-signoff-upsert

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #17066

Spam reducer #3b. On #16524 the hive left 8 Γ— hive:signoff-attribution + 5 Γ— hive:unauthorized comments in one day β€” one per push, each the same ask to the same person. Both markers were keyed on the head SHA. This PR gives them the shape #16434 gave the claim ledger / needs-decision / sentinel: one comment per PR carrying a stable marker, found and edited in place (an edit notifies nobody).

Changes

  • hive:signoff-attribution β†’ one comment per PR (<!-- hive:signoff-attribution -->). A new head rewrites it, names the current head, and appends updated <date>: head …, N commits signed off as the hive App; history capped at 5 lines. Same head / same asks β†’ no write. The emitter moved from automerge_contributor_nudge.go into its own automerge_signoff_attribution.go (pure block move out of the nudge file, nothing else in it touched).
  • hive:unauthorized β†’ one comment per PR per blocked step (<!-- hive:unauthorized step=… -->). A new head hitting the same block edits the existing note: Attempt N: the same block hit heads … plus a hidden <!-- hive:unauthorized-attempts n=N heads=… --> record (heads capped at 5, count unbounded). The "actor" that varies here is the blocked step β€” the App is always the one refused β€” so the per-actor key is the step. workflowFenceReleased now reads head coverage from that record instead of a per-head marker.
  • Both emitters adopt a legacy per-head comment when one exists (latest own comment under the old marker) and rewrite it under the stable marker rather than adding one more.
  • Shared helper automerge_marker_upsert.go: findOwnMarkerComment (own App login only; stranger's marker is never edited), editMarkerComment, capped history render/parse.
  • Docs: stage-labels.md, labels-and-control-signals/reference.md.

Emitter audit (item 3)

Per-head marker emitters in pkg/github/automerge and what was done:

marker verdict
hive:signoff-attribution converted (per PR, edited)
hive:unauthorized converted (per PR + step, attempt count)
hive:merge-commit left β€” once per head, but the merge-commit label is then "the note" so later heads skip; effectively one-shot
hive:merge-forward-conflict left β€” per head for a human author whose branch still conflicts after a push; modest repeat risk, candidate for a follow-up upsert
hive:contributor-held-runs-approved, hive:workflow-approval left β€” audit records of an action the hive took on that head; one per head is the point
hive:adopted, hive:carried-fence, hive:trust-promoted left β€” one-shot per adoption / login
hive:contributor-nudge, hive:human-071-note not touched β€” sibling-owned file (automerge_contributor_nudge.go); 071-note already folds into hive:status since #15876

Tests

Table-driven, no time.Sleep:

  • TestSignoffAttributionRewrite β€” same head no-op, new head appends one line, legacy adoption, cap at 5, idempotent second pass.
  • TestApplyStageLabelsSignoffAttributionUpsertsAcrossHeads β€” the 🌱 chore: v5 β†’ v6 top-up (2026-11-03)Β #16524 shape through ApplyStageLabels: 4 heads β†’ 1 post + 3 edits, repeat sweep writes nothing.
  • TestParseUnauthorizedAttempts, TestUnauthorizedAttemptsNextCapsHeads, TestCommentUnauthorizedUpsertsPerStep β€” same head once, 3 heads β†’ 1 post + 2 edits, legacy adoption, stranger's marker not edited, different step gets its own note.
  • TestMarkerHistoryRoundTrip.
  • Existing unauthorized / signoff tests updated for the new marker shape; the contributor-lane fixture learnt PATCH /issues/comments/{id}.

Verification on #16524 is by these tests only β€” no live comments were edited or deleted.

…tead of reposting per head

hive:signoff-attribution becomes one comment per PR under a stable marker,
rewritten in place on a new head with an 'updated …' history capped at five
lines. hive:unauthorized becomes one comment per PR and blocked step; a new
head hitting the same block edits it with an attempt count and the heads it
covers. Legacy per-head comments are adopted and upgraded in place.
workflowFenceReleased reads head coverage from the upserted note.

Fixes #17066

Signed-off-by: Andrew Anderson <andy@clubanderson.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 kellyaa 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/XL Denotes a PR that changes 500-999 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: 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
#17073 🌱 contributor-nudge once per PR+reason; fold origin notes into status; marker ratchet same files src/docs/labels-and-control-signals/stage-labels.md
src/pkg/github/automerge/automerge_contributor_nudge.go
src/pkg/github/automerge/automerge_stage_labels.go

@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • test (rest 1/4)

Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path.

…line line to the signoff file

The sign-off attribution CreateComment moved files unchanged (2β†’1 in the
nudge file, 1 in automerge_signoff_attribution.go); the test heads used
%040d, whose 12-char short SHA was identical for every head.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@clubanderson
clubanderson merged commit d6c63af into v5 Nov 7, 2026
78 of 79 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the spam-signoff-upsert branch November 7, 2026 19:20
@github-actions

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

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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🌱 upsert signoff-attribution and unauthorized comments instead of reposting

1 participant