fix: apply review_quality_multiplier to open PR collateral - #745
Conversation
8a0312b to
322a764
Compare
|
@anderdc Pls review this PR. |
|
We generally just add 'multipliers' to the collateral. I'm not sure if review penalty should be added. Let me chew on it |
Adding The reason |
0348256 to
6bea99b
Compare
|
The point of collateral is to 'put your money where your mouth is' on a PR, with this addition you're more ok with review iterations because it eases up on your collateral (at the cost of your resulting PR). So still debating, the argument isn't particularly compelling but also not dismissed. Any more thoughts? |
|
Fair point. But the thing is, collateral already multiplies by |
|
On the "more ok with review iterations" concern - I don't think it actually plays out that way. The case we care about deterring is someone opening a bunch of speculative PRs and walking away. Those PRs haven't been touched by a maintainer yet, so What does change is collateral on PRs that a maintainer actively reviewed and asked for changes on. Today those get hit twice: full collateral while they're open, AND lower earned score if they merge. With this change they get hit once, and the open-side collateral matches what the merged PR will actually be worth. On the multipliers question more broadly: collateral today isn't a flat deposit, it's #613 (label_multiplier) and #691 (state_reason gate) added missing pieces to collateral for the same consistency reason, so there's precedent. If you'd actually prefer to strip all four and make collateral flat |
|
We should not make collateral less for an open PR that has requested changes. If we do this, we are incentivizing open PRs to go through iterations as it becomes less of a tax on miners. I'd prefer if the inverse happened and it became more of a tax, if anything. The goal is to find ways to have the network produce consistently merge-able PRs from the second they're made (0 iterations/requested changes), this doesn't align with that goal. Yes, it's more 'accurate' and 1:1 with what the merged score would be. |
@LandynDev Thanks for clarifying. I agree collateral should not become lower when a PR gets requested changes. If not, it can be another spam gap.
I would also cap it so it cannot grow forever: That keeps the incentive aligned with merge-ready PRs while still using the review quality signal. What do you think about it? @anderdc @LandynDev |
|
Let's actually do that and see how it goes, that makes more sense to me. The goal is mergeable quality PRs from the get-go. |
c4116f3 to
1c4fc9c
Compare
|
@anderdc Ready to review |
1c4fc9c to
b67f619
Compare
|
|
||
| # PR Review Quality Multiplier | ||
| REVIEW_PENALTY_RATE = 0.15 # 15% deduction per CHANGES_REQUESTED review from a maintainer | ||
| OPEN_PR_REVIEW_COLLATERAL_RATE = REVIEW_PENALTY_RATE # Same per-review step, but increases open PR collateral |
There was a problem hiding this comment.
no need for another separate constant for this, let's just make them both use REVIEW_PENALTY_RATE
…review-quality-open-pr-collateral
|
@anderdc I've updated. Pls check again. |
Summary
calculate_open_pr_collateral_scoreappliedrepo_weight,issue, andlabelmultipliers but silently ignoredreview_quality_multiplier. An open PR with maintainerCHANGES_REQUESTEDreviews was charged the same collateral as a clean PR, overstating the merged earned score it is meant to approximate.Three coupled sites were hiding the bug:
gittensor/classes.py-changes_requested_countwas gated behindif is_merged:, so open PRs got0even though the GraphQL query already fetcheschangesRequestedReviewsfor every PR.gittensor/validator/oss_contributions/scoring.py-calculate_pr_multipliershardcodedpr.review_quality_multiplier = 1.0in the open-PR branch.calculate_open_pr_collateral_scoreomittedreview_qualityfrom its multipliers dict.Changes
_count_maintainer_changes_requestedinclasses.pyand call it unconditionally so both merged and open PRs get a real count.review_quality_multiplierout of theif is_merged:branch incalculate_pr_multipliers.'review_quality'to the multipliers dict incalculate_open_pr_collateral_scoreand update its docstring.No GraphQL changes -
changesRequestedReviewsis already fetched inline (#519), so there is no new API cost.Related precedents
label_multiplierto open-PR collateral (same shape)is_valid_issuestate_reason gate to open-PR collateral (same shape)Related Issues
Closes #744
Type of Change
Testing
21 tests in
tests/validator/test_review_quality_multiplier.pypass. New coverage:TestChangesRequestedCountFromGraphQL.test_open_pr_also_counts_maintainer_reviews- flips the old assertion; open PRs now parsechangesRequestedReviews.TestReviewQualityMultiplierOnOpenPRCollateral- direct collateral math under clean, penalized, and zero-multiplier conditions.TestReviewQualityMultiplierThroughScoringPipeline- end-to-end regression guards:calculate_pr_multipliersappliesreview_qualityto open PRsOPEN_PR_COLLATERAL_PERCENTFull validator suite: 254 passed.
ruff check,ruff format, andpyrightall clean.