fix(scoring): count merged PR repo attribution before mirror file-fetch#1617
Open
jaytbarimbao-collab wants to merge 1 commit into
Conversation
score_pr() only added a MERGED PR's repo to eval_.unique_repos_contributed_to at the end of the function, after three early-return paths that fire whenever the mirror's file-diff data isn't available yet (pending backfill, a transient MirrorRequestError, or an empty files result) — all explicitly normal transient states per the function's own comments. Since a PR is already counted toward eligibility/total_merged_prs independent of file-fetch status, this let unique_repos_contributed_to (persisted as unique_repos_count, surfaced via `gitt miner score`) silently undercount based on mirror-fetch timing rather than any property of the PR. Move the MERGED repo-attribution above the early-return branches so it no longer depends on this round's file-fetch outcome. Same bug class previously fixed in the pre-mirror scoring path (entrius#65/entrius#71), reintroduced when scoring moved to the mirror-based flow. Closes entrius#1616
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
score_pr()only added a MERGED PR's repo toeval_.unique_repos_contributed_toat the very end of the function, after three early-return paths that fire whenever the mirror's file-diff data isn't available yet (scoring_data_stored=False, a transientMirrorRequestError, or an emptyfilesresult) — all explicitly normal transient states per the function's own comments.Since a PR is already counted toward eligibility/
total_merged_prsindependent of file-fetch status, this letunique_repos_contributed_to(persisted asunique_repos_count, surfaced viagitt miner score) silently undercount based on mirror-fetch timing rather than any property of the PR itself.Fix
Moved the
if pr.state == 'MERGED': eval_.unique_repos_contributed_to.add(...)block earlier inscore_pr(), before the early-return branches, so repo attribution no longer depends on this round's file-fetch outcome.Same bug class was previously fixed in the pre-mirror scoring path (#65 / #71), but was reintroduced when scoring moved to the mirror-based flow and was never re-applied there.
Testing
Added
TestUniqueReposContributedTocovering all three early-return paths plus a negative control (CLOSED PR never counted):test_counts_when_scoring_data_not_storedtest_counts_when_mirror_fetch_failstest_counts_when_no_files_returnedtest_not_counted_for_closed_prValidation commands run
Closes #1616