Repository navigation
✨ feat: record per-contributor abandoned PRs when the hive adopts them - #15802
Conversation
Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: clubanderson <407614+clubanderson@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 |
|
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 |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
There was a problem hiding this comment.
Read the new sink end to end against the adoption paths — this looks correct to me.
- Every real adoption is counted:
adoptContributorPRin-place (automerge_contributor_adopt.go:728) andsupersedeAdoptedPR(:982). The uninstrumentedMarkAdopted(key, head, 0, now)at:694is the "attempt recorded first" stamp, not an adoption — a head that then hits the terminal workflow-fence branch and goes to 085 correctly stays uncounted. The DCO re-home at:1365reachessupersedeAdoptedPR, whereapplyContributorAbandononly fills inadopted_into_pron an already-counted PR (contribute_abandoned.go:36-39) rather than counting twice. - Operator takeovers:
requested/forcedsetcanPushInPlace=false(:689), so they go through supersession withAdoptReasonOperator/AdoptReasonOperatorForced→operator_takeover, as the body says. - The conflict-retry loop in
recordContributorAbandonis sound:findContributorreloads from disk on each attempt (contribute_profiles.go:438), so a failed CAS does not leave a stale in-memory append that would make the retry think the record already exists. mergeContributorAbandonsruns inside thecur != nilbranch ofsaveContributorProfileTokenCAS(:369) andAbandonedis recomputed from the merged slice after it (:371), so a stale writer on another field cannot drop or miscount a record.
Nothing further 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.
Read the new sink, both emission points and the profile save path at 3a656f6. Looks correct to me.
What I verified:
- Wiring is complete on both construction paths:
cmd/hive/main.go:2070installslateContributorNudgeSink, which now forwardsAbandoned(contributor_nudge_sink.go:51-55, with the compile-time assertion), andmain_sweeps.go:833installs the hub directly, which implements it itself (contribute_abandoned.go:95-110). The type assertion atautomerge_contributor_abandon.go:55succeeds on both, so this does not repeat the earlierPresencewrapper gap. - Emission sits after the stage record is marked in both places (
automerge_contributor_adopt.go:728in-place,:982supersede), so a failed adoption comment or copy does not count as an abandonment. - Dedupe + append-only:
applyContributorAbandonkeys on lower-casedrepo#pr, andsaveContributorProfileTokenCAS(contribute_profiles.go:367-370) merges disk records into any writer's copy before bumpingVersion, so an unrelated stale saver cannot drop a record. The retry loop inrecordContributorAbandonreloads from disk viafindContributoreach attempt, so anerrProfileConflictretry sees the new version rather than spinning on the same stale copy. Refs-stylePart of #15782is appropriate here: the issue is a tracker with three named child issues still open.
No findings; advisory only.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Expose historical totals and lowercase per-login counts in contributorPool, render recent adoption details on contributor cards, and document counting semantics. Reuse the minimal profile schema from pending #15802; adoption recording remains owned by that PR. Hive-Run: #15795 Hive-Plan: contributor-abandoned-status Hive-Spec: #15795#acceptance Signed-off-by: mendezr <mendezr@users.noreply.github.com>
…s green) Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
|
hive/awaiting-ci: 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 |
There was a problem hiding this comment.
Read the diff at e8705b0 against the automerge adoption paths, the profile save path and the cmd/hive wiring. Looks correct to me, and the body's "only two call sites" claim holds up against the tree.
What I verified
- Every real adoption is reported. There are six
MarkAdopted*call sites insrc/pkg/github/automerge. The two instrumented ones are the only ones that complete an adoption: in-place atautomerge_contributor_adopt.go:727and supersession at:980. The other three in that file (:694,:1367,:2069) are the "record the attempt first" bookkeeping withsuperseding=0and each then flows intosupersedeAdoptedPR→:980.automerge_adoption_orphan.go:274restores a store record the hive lost for an adoption that already happened, so not reporting it there is right (and the sink would dedupe it anyway). - Dedupe is keyed correctly.
applyContributorAbandon(contribute_abandoned.go:31) keys on lowercasedrepo#pr; an in-place adoption later re-homed ontohive/adopt-<n>only fillsAdoptedIntoPR(:38-41) and never bumps the counter.Abandonedis always recomputed aslen(AbandonedPRs)at save (contribute_profiles.go:371), so the two fields cannot drift. - Stale writers cannot drop records.
saveContributorProfileTokenCASreloadscurfrom disk undercontributorSaveMu(contribute_profiles.go:344-347) and mergescur.AbandonedPRsinto the incoming copy at:369before the version bump — every other field on that path is already handled the same way (token fields, terminal tier), so this follows the file's pattern.recordContributorAbandonretries onerrProfileConflictwith a freshfindContributorload (contribute_abandoned.go:80-93). - Wiring.
main.go:2072installslateContributorNudgeSink{hub: func() *dashboard.ContributeWSHub {…}};hub()returns a concrete pointer, so theh != nilguard in the newAbandonedforwarder (contributor_nudge_sink.go:52) works, and the engine's type assertion atautomerge_contributor_abandon.go:55now succeeds on the wrapper — the same fix shapePresenceneeded. - Tests cover in-place (
offline), supersede, Adopt-now (operator_takeover), unknown author, stale-save survival, and the/api/contributorslist.
One info-level note (not a defect): abandonReason (automerge_contributor_abandon.go:42) maps every reason other than operator/offline — including AdoptReasonDCORehome from :1367 — to unresponsive. In practice the DCO re-home runs on a PR already adopted in place (the log at :1363 says "re-homing adopted PR"), so dedupe means the earlier record's reason stands and this mapping only matters for a PR adopted in place before this code deployed. Fine to leave; mentioning so the vocabulary is a conscious choice.
Sequencing for the maintainer: #15859 (dashboard columns) and #15894 (hub merge) both declare ContributorProfile.Abandoned / LeaderboardEntry.Abandoned with the identical struct line this PR adds, so they compose cleanly with this one in any order. #15859's body already asks that a single Abandoned field be retained on integration; that is what happens.
CI: overlayfs-exec-guard shows CANCELLED and build (linux/arm64) is still running at this head — looks like infrastructure rather than this diff (no file here touches build or exec paths).
— 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 |
Expose historical totals and lowercase per-login counts in contributorPool, render recent adoption details on contributor cards, and document counting semantics. Reuse the minimal profile schema from pending #15802; adoption recording remains owned by that PR. Hive-Run: #15795 Hive-Plan: contributor-abandoned-status Hive-Spec: #15795#acceptance Signed-off-by: mendezr <mendezr@users.noreply.github.com>
) * ✨ feature: show abandoned contributor PR counts Expose historical totals and lowercase per-login counts in contributorPool, render recent adoption details on contributor cards, and document counting semantics. Reuse the minimal profile schema from pending #15802; adoption recording remains owned by that PR. Hive-Run: #15795 Hive-Plan: contributor-abandoned-status Hive-Spec: #15795#acceptance Signed-off-by: mendezr <mendezr@users.noreply.github.com> * 📖 docs: refresh contributor API source citations Signed-off-by: mendezr <mendezr@users.noreply.github.com> * 🐛 fix: style abandoned badge via CSS class to keep style ratchet flat TestStyleRatchet counts style= attributes in static/index.html; the new contributor abandoned badge added one inline style. Move the colour to a .contrib-abandoned rule in static-src CSS and regenerate index.html. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> * test: assert abandoned badge CSS class instead of removed inline style Hive-Fix-Attempt: 2/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: architect <280983584+hivecommons-hive[bot]@users.noreply.github.com> * 📖 docs: refresh api-reference citations after rebase onto v5 Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --------- Signed-off-by: mendezr <mendezr@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Signed-off-by: architect <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: mendezr <mendezr@users.noreply.github.com> Co-authored-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
When a contributor's hive goes offline or stops answering the stage-072 nudge, the hive adopts its PR. That costs fixer capacity and merge-queue time, but nothing recorded it per contributor, so operators could not tell which clankers keep abandoning PRs.
This PR adds the core:
ContributorAbandonSink, alongsideContributorPresenceSource. The engine reports an adoption at both points where one happens: in-place (MarkAdoptedInPlace) and supersession ontohive/adopt-<n>. Supersession also covers Adopt now andadoption/supersede, reported with reasonoperator_takeover. Automatic adoptions are reported asofflineorunresponsive. The only change to the adoption code is a single call at each of these two points.automerge_sweep.gois not touched.abandonedandabandoned_prs({repo, pr, adopted_into_pr, reason, at}). Records are deduped per PR. If the same PR is adopted again, for example an in-place adoption that is later moved to a hive branch, it is not counted twice; the second adoption only fills in the missingadopted_into_pr. When a profile is saved, the stored records are merged with the incoming ones, so an older copy written back cannot drop a record. Authors with no profile on this hive are ignored.cmd/hivepasses the call through to the hub. Without that forwarding the engine's interface check fails, which is the same problem we had withPresence./api/contributorsprofile JSON.Tests cover the reason mapping, the supersession, in-place and Adopt-now paths, per-PR dedupe and filling in the copy number, ignoring unknown authors, records surviving a stale save, and
/api/contributorsexposure.Part of #15782 (children: #15795 Contributors tile +
/api/status.contributorPool+ operator docs, #15796 dashboard/landing leaderboard column, #15799 spoke heartbeat + hub merged leaderboard)— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 requested_by=@clubanderson