fix: sync pr_state for stale-closed mirror PRs excluded from scoring - #1032
Closed
Dexterity104 wants to merge 1 commit into
Closed
fix: sync pr_state for stale-closed mirror PRs excluded from scoring#1032Dexterity104 wants to merge 1 commit into
Dexterity104 wants to merge 1 commit into
Conversation
Collaborator
|
The validator's |
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
Stale CLOSED PRs from the mirror path now land in a storage-only bucket so the
pull_requestsrow'spr_stateflips from OPEN to CLOSED on the next evaluation. Before this change, the loader returned early without recording them, leaving phantom OPEN rows on dashboards for everymirror_enabled: truerepo.The fix mirrors PR #769, which solved the same problem on the legacy GraphQL path. The storage layer was already wired (
stale_closed_pull_requestsflows throughstore_pull_requests_bulk, andpr_stateis in theDO UPDATE SETclause ofBULK_UPSERT_PULL_REQUESTS), so the work is to add the matching mirror bucket and route it into the existing call.Changes:
MirrorMinerEvaluationgains astale_closed_prsfield_maybe_add_prappends pre-lookback CLOSED PRs there instead of returning silentlyMinerEvaluationgains a parallelmirror_stale_closed_prsslotcombinepropagates the bucket onto the legacy evaluationDatabaseStorage.store_evaluationconcatenates the adapted mirror list onto the existing stale storage call (the four parallelstore_pull_requests_bulkcalls also get folded into a single loop over apr_bucketstable for clarity)These PRs do not enter scoring or credibility math, so totals (
total_closed_prs,merged_countforcheck_eligibility, etc.) stay correct.Related Issues
Fixes #1031
Type of Change
Testing
Test coverage:
tests/validator/oss_contributions/mirror/test_load.py: the existing stale-closed test now also asserts the PR lands instale_closed_prsand thattotal_closed_prsreflects only the scoring buckettests/validator/oss_contributions/mirror/test_combine.py: setup now seeds a stale entry, andtest_aggregate_pr_count_properties_sum_both_pathsproves it does not inflatetotal_closed_prstests/validator/utils/test_storage_mirror.py: newtest_stale_closed_lists_concatenatedcovers legacy plus mirror concatenation,PullRequestadaptation, and identity propagation through the call atcall_args_list[3]Full suite: 602 passed, ruff clean.
Checklist