fix(signals): dedupe overlapping label sources in contributor dominantLabels#418
Open
galuis116 wants to merge 1 commit into
Open
fix(signals): dedupe overlapping label sources in contributor dominantLabels#418galuis116 wants to merge 1 commit into
galuis116 wants to merge 1 commit into
Conversation
|
Important Gittensory found maintainer review notesScoped related-work signals were found for this PR. They are advisory unless the gate reports a blocker.
Review context
Maintainer notes
Contributor next steps
Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers. Learn more about Gittensor contribution workflows. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Both contributor-profile builders computed
registeredRepoActivity.dominantLabelsby concatenating labels from two overlapping views of the same activity and frequency-ranking the combined list withtopItems(..., 8):repoStats.dominantLabels(built during backfill) for the same repos.So for any repo the contributor has both cached records and a stat row in — the normal case — that repo's labels were counted twice. Every other field in the same function already reconciles these two sources as overlapping:
reposTouchedusesnew Set([...])(dedupe),unlinkedOpenPullRequestsusesMath.max(...),statPullRequests/statMergedPullRequestsuse the stats only.dominantLabelswas the lone outlier that summed them. Closes #417.This is scoring, not just display:
dominantLabelsbecomeslabelHistory(decision-pack.ts,buildContributorOpportunities) and driveslabelFit(+5per matching label in opportunity scores and repo-decision reasoning). BecauselabelHistoryis the top-8 set, double-counting shifts which labels survive the cutoff — a low-frequency repo-dominant label can displace a higher-effort single-source label, perturbing the rankings surfaced to miners.Scope
src/signals/engine.ts:buildContributorProfile— only foldrepoStats.dominantLabelsfor repos that have no cached authored records (cachedLabelReposguard).buildGittensorContributorProfile— only foldrepoStats.dominantLabelsfor repos not present insnapshot.repositories.test/unit/signals-coverage.test.ts— fail-on-revert: astat-only-labelfor a repo that already has cached records must not appear indominantLabels(old code included it), while anuncached-labelfor a repo with no cached records still contributes.Validation
npx tsc --noEmit— clean.npx vitest run(full suite) — 1132 passed, 1 skipped; no other assertions affected.Safety
repoStatscover disjoint repos (the common-repo overlap is exactly what was being double-counted). No public schema/API surface change;dominantLabelskeeps its type andtopItems(..., 8)shape.Notes
The fix mirrors the existing
reposTouched(dedupe) /unlinkedOpenPullRequests(max) treatment of the same two sources, so the whole function now reconciles cached records andrepoStatsconsistently.