Repository navigation
π fix(stagelabels): bound retention of trust-promotion records in Prune - #15496
Conversation
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of No conflicting open PRs or same-file overlaps were found. |
|
hive/awaiting-ci: CI pending β sweep will merge when green. π Hive Agent: β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
There was a problem hiding this comment.
Read Prune, ClaimTrustPromotionAnnouncement and the contributor-lane caller at v5. Looks correct to me, and the retention claim in the body holds up.
- The thing this depends on β that
LastSeenis refreshed for an already-announced author β is true:src/pkg/stagelabels/store.go:1796setsr.LastSeen = nowon every claim, including the losing one, andannounceContributorAutoPromotion(src/pkg/github/automerge/automerge_contributor_lane.go:1046) always callsClaimTrustPromotionAnnouncementrather than checkingTrustPromotionAnnouncedfirst. So a record only ages out after 180 days with no auto-promotion evaluation for that author, which is the intended "unseen" semantics; an active author is never re-announced. max(maxAge, trustPromotionRetention)keeps the invariant that trust records never outlive ordinary records by less than before; withgo 1.26insrc/go.modthe builtin is fine.- Stored key/format unchanged; the extended test loads an existing file at
now + retention + 24hand asserts exactly one drop. Fragment present atchangelog.d/fixed-trust-promoted-prune.md.
No findings.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read against v5 at 87f900d, including the only production caller. Looks correct to me.
src/pkg/stagelabels/store.go:1807-1824:ClaimTrustPromotionAnnouncementsetsr.LastSeen = nowon every call, not just the winning claim (line 1820 is outside theif claimedblock). Andautomerge_contributor_lane.go:676β:1046calls it on every sweep that evaluates a clean-history PR by the author. So "unseen for 180 days" really means "no auto-promote-eligible PR by this author evaluated in 180 days", which is the right thing to bound on β an active contributor's record is refreshed indefinitely, and the body's claim that claims refreshLastSeenholds.store.go:1753:max(maxAge, trustPromotionRetention)βgo.modisgo 1.26.10, so the builtin is fine. The per-key cutoff selection keeps the stored format and keys unchanged, so legacy records load as-is.- Test:
veryLate = now + 180d + 24h, recordLastSeen = now,trustCutoff = veryLate - 180d = now + 24hβ dropped;n == 1holds since the store holds only the Norway-02 key at that point.
The one behaviour change worth stating plainly for the maintainer: an author whose last eligible PR was >180 days ago will get a second promotion announcement on their next one. That's the trade-off the PR body states and the changelog fragment names it, so no decision question from me.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
stage 060-reviewed β 050-review-pending: required-check-pending:Sign-off survives the squash |
There was a problem hiding this comment.
Looks correct to me. What I checked at head 2a2da10:
src/pkg/stagelabels/store.go:1807-1824βClaimTrustPromotionAnnouncementsetsLastSeen = nowon every call, including the losing ones, so an author who keeps getting auto-promoted PRs refreshes the record each sweep and is never re-announced within the 180-day window the newtrustCutoffuses (store.go:1776-1785).- The only production caller is
automerge_contributor_lane.go:1049viaannounceContributorAutoPromotion(:679). Once an author is admitted by registry tier (:666) that path is no longer reached, so their record goes stale and is pruned after 180 days β harmless, since that path never announces. - Test:
st3loads the file saved atnow(thest2claim at+30dwas never saved), soLastSeen = nowis beforeveryLate - 180dandn == 1is exactly the trust record. Themaxbuiltin is fine ongo 1.26.
Behaviour, keys and stored format are unchanged for records younger than 180 days, as the body says.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read against v5 including the caller: this looks correct to me.
src/pkg/stagelabels/store.go:1775-1787keeps the per-keyLastSeentest but swaps intrustCutoff = now - max(maxAge, trustPromotionRetention)fortrust-promoted:keys, so the 14-daystageStorePruneAge(automerge_stage_labels.go:212) can never shorten trust retention below 180 days. Stored format is unchanged, so existing records load as-is.LastSeenis refreshed on every claim (store.go:1820), andannounceContributorAutoPromotionis reached on each sweep for an author still promoted via merged-history (automerge_contributor_lane.go:677-679), so an active author's record stays alive. An author admitted to the registry returns earlier at:666and never reaches the announce path, so pruning their record cannot re-announce either.- The remaining behaviour change is the one the changelog names: an author with no swept PR for 180 days gets one fresh announcement on their next PR.
commentContributorAutoPromotionstill reads the PR's own comments first, so it cannot double-post on the same PR. - Test at
stagelabels_test.go:496-503covers the new drop with an injected clock past retention and fails on the pre-change code (the key was unconditionally kept).
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
stage 060-reviewed β 050-review-pending: required-check-pending:Sign-off survives the squash |
There was a problem hiding this comment.
Looks correct to me, and the obvious objection does not apply.
The question a bounded retention raises is whether an active promoted author gets re-announced every 180 days. They do not: the only production caller is announceContributorAutoPromotion (src/pkg/github/automerge/automerge_contributor_lane.go:1049), which calls ClaimTrustPromotionAnnouncement on every evaluation, and that method sets r.LastSeen = now and marks the store dirty even when the claim loses (src/pkg/stagelabels/store.go:1825-1834). So trustCutoff only reaches records of authors with no promotion-eligible PR in 180 days, and one re-announcement on their return is the trade #15463 asked for. max(maxAge, trustPromotionRetention) keeps the previous "never shorter than ordinary records" property; the new test asserts the drop at retention+1d against a 14d prune age.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read Prune, ClaimTrustPromotionAnnouncement and its only production caller. The body's premise holds: ClaimTrustPromotionAnnouncement sets r.LastSeen = now on every call, winning or losing (store.go:1820), and announceContributorAutoPromotion calls it for every promotion-eligible PR by the author (automerge_contributor_lane.go:679,1049), so the 180-day window runs from the author's last eligible PR rather than from the first announcement. Authors inactive for 180+ days get re-announced on return; that is the trade-off the body states and the changelog fragment documents, and it keeps the store bounded without touching the stored format. max(maxAge, retention) means a caller passing a longer prune age cannot be undercut. Test exercises a fresh store at retention + 24h and asserts both the drop count and the lost TrustPromotionAnnounced. Looks correct to me.
β hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
There was a problem hiding this comment.
Read the callers rather than just the diff; this looks correct to me.
The one question a 180-day retention raises is whether an active promoted author gets re-announced. They do not: ClaimTrustPromotionAnnouncement sets r.LastSeen = now on every call, claimed or not (src/pkg/stagelabels/store.go:1831), and the contributor lane calls it on every sweep for every PR by a promoted author (automerge_contributor_lane.go:679 β announceContributorAutoPromotion β :1049). So LastSeen tracks the author's last sweep with an open PR, and only an author idle for 180 days (or maxAge, if longer) is dropped and re-announced on return β which is what the changelog fragment says.
Prune test at stagelabels_test.go:496-503 exercises the drop past trustPromotionRetention and would fail against the old !strings.HasPrefix exemption. max(maxAge, trustPromotionRetention) uses the builtin; go 1.26 in src/go.mod is fine.
β hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
Closes #15463
Prune skipped every
trust-promoted:key, so per-author announcement records lived forever. They now use their own bounded retention (180 days unseen, or the prune age if longer) based on the existingLastSeen, which claims refresh. Stored format and keys are unchanged, so legacy records work as-is. Test extended with an injected clock.Decision taken by hive: 180-day retention keeps once-per-author semantics for the realistic window while bounding growth.
β hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88