fix: sync pr_state for stale-closed PRs excluded from scoring - #769
Merged
Conversation
ai-mountain
force-pushed
the
fix/unscored-stale-closed-prs
branch
6 times, most recently
from
April 29, 2026 18:29
c160076 to
7a21b62
Compare
3 tasks
ai-mountain
force-pushed
the
fix/unscored-stale-closed-prs
branch
from
April 30, 2026 19:07
a11a992 to
28ad3e4
Compare
ai-mountain
force-pushed
the
fix/unscored-stale-closed-prs
branch
from
May 4, 2026 13:55
2c89e76 to
28646e6
Compare
Contributor
Author
|
@anderdc can you review this PR? |
anderdc
approved these changes
May 4, 2026
Contributor
Author
|
@anderdc Thanks for merging this PR. |
wdeveloper16
added a commit
to wdeveloper16/gittensor
that referenced
this pull request
May 5, 2026
wdeveloper16
added a commit
to wdeveloper16/gittensor
that referenced
this pull request
May 5, 2026
wdeveloper16
added a commit
to wdeveloper16/gittensor
that referenced
this pull request
May 5, 2026
wdeveloper16
added a commit
to wdeveloper16/gittensor
that referenced
this pull request
May 5, 2026
wdeveloper16
added a commit
to wdeveloper16/gittensor
that referenced
this pull request
May 5, 2026
wdeveloper16
added a commit
to wdeveloper16/gittensor
that referenced
this pull request
May 5, 2026
10 tasks
wdeveloper16
added a commit
to wdeveloper16/gittensor
that referenced
this pull request
May 6, 2026
wdeveloper16
added a commit
to wdeveloper16/gittensor
that referenced
this pull request
May 6, 2026
wdeveloper16
added a commit
to wdeveloper16/gittensor
that referenced
this pull request
May 6, 2026
wdeveloper16
added a commit
to wdeveloper16/gittensor
that referenced
this pull request
May 6, 2026
wdeveloper16
added a commit
to wdeveloper16/gittensor
that referenced
this pull request
May 7, 2026
3 tasks
wdeveloper16
added a commit
to wdeveloper16/gittensor
that referenced
this pull request
May 7, 2026
wdeveloper16
added a commit
to wdeveloper16/gittensor
that referenced
this pull request
May 8, 2026
wdeveloper16
added a commit
to wdeveloper16/gittensor
that referenced
this pull request
May 8, 2026
wdeveloper16
added a commit
to wdeveloper16/gittensor
that referenced
this pull request
May 9, 2026
1 task
wdeveloper16
added a commit
to wdeveloper16/gittensor
that referenced
this pull request
May 9, 2026
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
Fixes phantom OPEN rows on miner dashboards caused by the 35-day creation cliff introduced in #406. Stale-closed PRs now have their
pr_statepersisted while remaining excluded from credibility scoring — #406's intent (no fresh credibility penalty when miners close old backlog PRs) is preserved.stale_closed_pull_requestsbucket onMinerEvaluationfor CLOSED PRs that are observed by the scanner but excluded from scoring.created_dt < lookback_date_filterskip intry_add_open_or_closed_printo the new bucket instead of dropping the PR entirely.store_pull_requests_bulk/BULK_UPSERT_PULL_REQUESTSpath — no schema change, no migration.Previously frozen
pr_state='OPEN'rows now UPSERT to their real GitHub state.total_{merged,open,closed}_prsproperties are intentionally unchanged — the new bucket is storage-only and does not inflate counts. This keepscalculate_credibilityinputs and all scoring buckets identical totest. The dashboard mismatch (e.g. 7 Open in the table vs 3 in the header tile) resolves because the table now reads the refreshedpr_state='CLOSED', not because totals changed.UPSERT semantics
BULK_UPSERT_PULL_REQUESTSzeroes scoring columns (earned_score,token_score,collateral_score, multipliers) on conflict. For a PR that was previously OPEN with collateral and is now CLOSED-not-merged and out-of-window, zero is the correct value — the PR no longer provides collateral. No partial-update query needed.Related Issues
Fixes #768
Type of Change
Testing
tests/validator/test_unscored_stale_prs.py— 5 tests covering: stale routing to the storage-only bucket, totals NOT inflated, fresh-PR regression guard, mixed fresh/stale, multi-stale totals invariant.tests/validator/utils/test_storage_mirror.py— 1 test confirmingstore_evaluationcallsstore_pull_requests_bulkwith the new bucket as a separate (4th) call.Checklist
pull_requeststable andBULK_UPSERT_PULL_REQUESTSquery as-is.calculate_credibilityinputs unchanged; fix: ignore stale closed PRs in lookback window #406's no-fresh-credibility-penalty guarantee holds.total_*_prsproperties; totals on/miners/{id}remain consistent with scoring buckets.