fix(signals): derive cache-only contributor outcome totals consistently#381
Open
philluiz2323 wants to merge 1 commit into
Open
fix(signals): derive cache-only contributor outcome totals consistently#381philluiz2323 wants to merge 1 commit into
philluiz2323 wants to merge 1 commit into
Conversation
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.
Closes #380.
Summary
In
buildContributorOutcomeHistory, the per-reporepoOutcomesare internally consistent (each repo keepspullRequests >= merged + open + closedandissues = openIssues + closedIssues), and the totals already sumrepoOutcomesforclosedPullRequests/openIssues/closedIssues/solvedIssues. But the cache fallbacks forpullRequests/mergedPullRequestsusedregisteredRepoActivity(a separateMath.maxaggregate),openPullRequestsused an unfilteredrepoStatssum, andissuesusedregisteredRepoActivity.issueswith no official fallback. So for a cache-only contributor (no official Gittensor snapshot) the totals were internally inconsistent:pullRequests != merged + open + closed,closedPullRequestRate = rate(closed, pullRequests)could exceed 1, andopenPullRequestswas the onlyrepoStatsaccess not scoped to the subject login.Scope
src/signals/engine.ts— when official totals are absent, derive every PR/issue total by summing the same login-scoped, internally-consistentrepoOutcomes(via asumOutcomeshelper), and computeissuesasopenIssues + closedIssues. Fixes the invariant, the out-of-range rate, and the login-scoping ofopenPullRequestsin one consolidation.test/unit/signals-v2.test.ts— cache-only totals consistency + login-scoping test.No schema, API, or public-surface changes.
Validation
Branch coverage stays >= 97%. CI
validateis green.Safety
issuesis nowopenIssues + closedIssues(consistent with the per-repo definition) instead of a separateregisteredRepoActivityvalue. No new external calls, tokens, or data surface.repoOutcomes, so they cannot include another contributor's rows, andclosedPullRequestRateis now bounded by a denominator consistent with its numerator.Notes
closedPullRequestRategates the >= 0.35 high-closure-risk / avoid-repo strategy thresholds, so the inconsistent rate could mis-classify a contributor.