feat(services): miner-vs-human cohort split in the maintainer recap digest - #4625
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4625 +/- ##
==========================================
+ Coverage 94.09% 94.11% +0.02%
==========================================
Files 430 432 +2
Lines 38222 38370 +148
Branches 13931 13989 +58
==========================================
+ Hits 35965 36113 +148
Misses 1600 1600
Partials 657 657
🚀 New features to boost your workflow:
|
|
Caution 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 🛑 Gittensory review result - fixes requiredReview updated: 2026-07-10 08:16:48 UTC
🛑 Suggested Action - Manual Review
Review summary Nits — 7 non-blocking
CI checks failing
Linked issue satisfactionPartially addressed Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
…igest (#4521) Extends MaintainerRecapRepoInput/RecapReport with an additive, opt-in miner-vs-human split, sourced entirely from the upstream GatePrecisionReport cohorts field (#4520) -- no independent identity read, no new privacy surface. A repo's recap entry gets a `cohorts` field whenever its injected GatePrecisionReport carried one; the aggregate totals.cohorts sums only across repos that did, so a window mixing cohort-aware and legacy call sites still degrades gracefully instead of half-reporting zeros. runMaintainerRecapJob now opts loadGatePrecisionReport into includeCohorts by default -- a periodic digest is exactly the "occasional aggregate view" that option was designed for, unlike a hot webhook path. formatMaintainerRecap gains an additive "## Cohorts" section, rendered only when totals.cohorts is present, sitting between Totals and Per-repo. Stacks on #4520 (branch feat/gate-precision-cohort-split-4520, PR #4623) -- GatePrecisionReport.cohorts doesn't exist without it. Do not merge before #4623. Fixes #4521
f0ac077 to
8bfd562
Compare
This branch is built on top of
feat/gate-precision-cohort-split-4520(PR #4623), becauseGatePrecisionReport.cohorts— the upstream field this entire PR consumes — doesn't exist without it. Thediff below will look larger than it is until #4623 merges and this rebases cleanly onto
main; at that pointthe diff will shrink to just the 6 files this PR actually owns.
Summary
Issue #4521 explicitly asks for this once the upstream gate-eval split lands — it did, in #4520/#4623.
MaintainerRecapRepo(per-repo) andRecapReport.totals(aggregate) both gain an optionalcohortsfield— additive, present only when the underlying
GatePrecisionReportcarried one.buildMaintainerRecapsums the cohort split only across repos that actually had one — a window mixingcohort-aware and legacy call sites degrades gracefully (partial adoption never half-reports zeros for the
repos that didn't opt in).
runMaintainerRecapJobnow passesincludeCohorts: truetoloadGatePrecisionReportunconditionally — aperiodic (default weekly) digest is exactly the "occasional aggregate view, one extra API call is fine"
case
includeCohortswas designed for, unlike a hot webhook path.formatMaintainerRecapgains an additive## Cohortssection (between Totals and Per-repo), rendered onlywhen
totals.cohortsis present — e.g.Miner-originated: 1/3 gate false positives (33%).Scope note, matching #4520's own:
OutcomeCalibration(thecalibrationhalf ofMaintainerRecapRepoInput)does not have its own cohort split yet, so
reviewed/merged/closed/reversalsstay blended-only. Onlythe gate-precision half of the recap gains the split, since that's the half with the upstream field.
Fixes #4521
Test plan
test/unit/maintainer-recap.test.ts: 4 new cases — cohorts absent (byte-identical), per-repo splitattached verbatim + aggregated into totals, summing correctly across multiple cohort-aware repos
(including a real "n/a" zero-blocked cohort), and graceful degradation when only SOME repos in the
window carried a split
test/unit/maintainer-recap-format.test.ts: 2 new cases — the## Cohortssection is absent bydefault and correctly rendered (with placement between Totals/Per-repo) when present
test/unit/maintainer-recap-wire.test.ts: 1 new end-to-end case seeding a real gate-blocked PRwith a confirmed-miner author and a second with a human author, proving the split reaches the finished
report AND the formatted digest through the actual production wiring (
runMaintainerRecapJob) — notjust that the plumbing doesn't crash. All 25 pre-existing tests in this file still pass unchanged
(they now implicitly exercise
includeCohorts: truetoo, since it's unconditional, but degrade to azeroed
cohortsobject since none of them seed a gate block)npx tsc --noEmitcleanmaintainer-recap*test files