Skip to content

fix(scoring): unique_repos_contributed_to undercounts when mirror file-fetch is pending/fails for a MERGED PR #1616

Description

@jaytbarimbao-collab

score_pr() in gittensor/validator/oss_contributions/mirror/scoring.py only adds a MERGED PR's repo to eval_.unique_repos_contributed_to at the very end of the function (line 185), after three earlier return paths that fire whenever the mirror's file-diff data isn't available yet (scoring_data_stored=False, a MirrorRequestError, or an empty files result) — all explicitly normal transient states per the function's own comments.

Since a PR is already placed in eval_.merged_prs / counted toward total_merged_prs independent of file-fetch status, this creates an inconsistency: a merged PR counts toward eligibility but can silently fail to count toward unique_repos_contributed_to (persisted as unique_repos_count, surfaced via gitt miner score) purely due to mirror-fetch timing, not any property of the PR itself.

There's direct precedent for this exact bug class: #65/#71 fixed the same pattern in the pre-mirror scoring path, but it was reintroduced when scoring moved to the mirror-based flow and was never re-applied there.

Fix: move the unique_repos_contributed_to.add() call earlier in score_pr(), before the early-return branches, so repo attribution for a merged PR doesn't depend on this round's file-fetch outcome.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions