fix(scoring): apply penalty label multipliers instead of flooring to 1 - #1038
Conversation
|
Note 🟦🟦🟦🟦🟦🟦🟦🟦🟦🟦🟦🟦 💡 Gittensory review — advisory only
💡 Advisory only — no action taken
💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers. |
|
🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 🛠️ Maintainer review — Held for maintainer reviewReviewed 4 changed file(s) — two independent AI reviewers, synthesized. ✅ Safe to merge — both reviewers found no blocking issues.
Merge readiness: ✅ Mergeable · all CI checks green/neutral/skipped. Summary The changes correctly adjust label multiplier handling to allow penalty multipliers (<1) instead of flooring to 1, and update the breakdown reporting to reflect a new "reduced" band. Tests cover the new behavior and all CI checks pass. No security or correctness defects are introduced. 💡 Nits — non-blocking, optional
|
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
ghost
left a comment
There was a problem hiding this comment.
Held for maintainer (guardrail_area) — correct + CI green
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1038 +/- ##
===========================================
+ Coverage 71.76% 96.85% +25.08%
===========================================
Files 141 141
Lines 17499 17501 +2
Branches 6331 6334 +3
===========================================
+ Hits 12559 16951 +4392
+ Misses 3789 104 -3685
+ Partials 1151 446 -705 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Closes #994
Summary
selectLabelMultipliercomputed the per-PR label multiplier asMath.max(fallback || 1, ...matchedMultipliers). Because the neutral fallback is always>= 1, any configured penalty label multiplier below 1 (e.g.refactor: 0.5,docs: 0.3) was clamped back up to 1 and never applied. Only bonus multipliers (>= 1) took effect, soestimatedMergedScorewas inflated for exactly the low-value-label PRs penalty multipliers exist to dampen.This PR applies matched multipliers directly and falls back to the neutral default only when no configured label matches. The existing "highest matched multiplier wins" tie-break is preserved (bonus + penalty on the same PR is unchanged).
Root cause
Verified against the repo fixture
{ bug: 1.2, refactor: 0.5 }, fallback1:["refactor"]["docs"](0.3 config)["bug", "refactor"]["bug"]["feature"](no match)Changes
src/scoring/preview.ts— fixselectLabelMultiplierso sub-1 matched multipliers are not floored against the>= 1fallback.src/services/score-breakdown.ts— surface penalty label multipliers as a"reduced"band with an accurate summary/lever in score breakdown explanations.test/unit/scoring.test.ts— regression coverage for penalty-only, unmatched, bonus+penalty, customdefaultLabelMultiplier, and merged-score scaling.test/unit/score-breakdown.test.ts— assert penalty labels render asband: "reduced".Behavior changes only when matched labels are all
< 1(previously wrongly floored to 1). Unmatched labels and bonus multipliers are unchanged.Reachability
labelMultipliersis synced from the upstream registry per repo andinput.labelsis caller-supplied tobuildScorePreviewvia MCPscore_previewand score-preview / explain-breakdown routes. Any repo with a penalty label configured was affected on every preview for PRs carrying that label.API / OpenAPI / MCP contract
No schema changes. Score preview output semantics change for penalty-labeled PRs:
scoreEstimate.labelMultiplierandestimatedMergedScorenow reflect configured sub-1 multipliers instead of silently flooring to 1.Migration / deploy / secrets
None.
Security / privacy
None. Scoring math only; no auth, cookie, CORS, GitHub App output, or contributor evidence changes.
Validation
Run from repo root (Node
>= 22):Equivalent combined gate:
All gates passed locally on branch
fix/apply-penalty-label-multipliers.