Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gittensor/validator/oss_contributions/scoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,11 @@ def _score_eligible_repo_prs(
) -> None:
"""Compute earned scores for an eligible repository's merged PRs."""
spam_multiplier = calculate_pr_spam_penalty_multiplier(cfg, len(open_prs), repo_eval.total_token_score)
credibility_multiplier = round(repo_eval.credibility, 2)

for pr in merged:
pr.open_pr_spam_multiplier = spam_multiplier
pr.credibility_multiplier = credibility_multiplier
# Credibility is a gate only (#1340), not a per-PR tax.
pr.credibility_multiplier = 1.0
pr.calculate_final_earned_score()
repo_eval.total_score += pr.earned_score

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ def test_zeroed_thresholds_repo_has_no_gate():
assert pr.earned_score == 10.0 # single PR, credibility 1.0


def test_per_repo_credibility_multiplier():
"""An eligible repo applies its own credibility ratio as the PR multiplier."""
def test_credibility_is_gate_only_not_a_multiplier():
"""#1340: past the gate, credibility no longer taxes earned score."""
merged = [_merged('foo/a', n) for n in range(1, 5)]
closed = [_mirror_pr('foo/a', 99, state='CLOSED')]

Expand All @@ -110,11 +110,13 @@ def test_per_repo_credibility_multiplier():

finalize_miner_scores({1: evaluation}, {'foo/a': _gate_repo()})

# credibility = 4 / (4 + 1) = 0.80, exactly at the gate
assert evaluation.repo_evaluations['foo/a'].is_eligible is True
assert evaluation.repo_evaluations['foo/a'].credibility == 0.8
assert all(pr.credibility_multiplier == 0.8 for pr in merged)
assert all(pr.earned_score == 8.0 for pr in merged)
repo_eval = evaluation.repo_evaluations['foo/a']
# credibility = 4 / (4 + 1) = 0.80, exactly at the gate — still computed as a ratio,
# used only for eligibility, not as a per-PR multiplier.
assert repo_eval.credibility == 0.8
assert repo_eval.is_eligible is True
assert all(pr.credibility_multiplier == 1.0 for pr in merged)
assert all(pr.earned_score == 10.0 for pr in merged)


def test_open_pr_spam_is_scoped_per_repo():
Expand Down
Loading