feat(scoring): surface the non-code line cap in the score breakdown#1978
Conversation
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-01 07:04:04 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 7 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 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.
|
Add a nonCodeLineCap breakdown component (sibling of the open-PR / open-issue / merged-history floor breakdowns) that surfaces the upstream MAX_LINES_SCORED_FOR_NON_CODE_EXT cap: non-code token score beyond that many changed non-code lines is not scored. It reads neutral unless the observed non-code line count actually exceeds the cap. Exposes nonCodeLineCap and nonCodeLinesObserved on the score-preview gates (openapi schema regenerated to match).
1e68fa2 to
9b92c8f
Compare
What
Adds a
nonCodeLineCapcomponent to the score-breakdown explanation — a sibling of the open-PR / open-issue / merged-history floor breakdowns — that surfaces the upstream non-code line scoring cap (MAX_LINES_SCORED_FOR_NON_CODE_EXT, default 300). Non-code token score beyond that many changed non-code lines is not scored, so a docs/config/data-heavy PR can silently lose non-code contribution the breakdown otherwise never explains.Why
explainScoreBreakdownalready surfaces every scored multiplier and every history/spam floor (open-PR, open-issue, merged-history), but not this cap. A miner adding a large non-code change has no visibility into why non-code lines past the cap add no score. This closes that gap with the same actionable-lever shape the other breakdowns use.Behavior
neutral(zero leverage) when no non-code line count is observed for the preview.neutralwhen the observed non-code line count is within the cap.reducedwhen it exceeds the cap, with a move-substantive-logic-into-source lever.Changes
nonCodeLineCapandnonCodeLinesObservedon the score-previewgates— both are already computed insidecomputeScoreCore(viaapplyNonCodeLineCap); this only surfaces them, it does not change any scoring math.nonCodeCapBreakdowninscore-breakdown.ts, wired intoexplainScoreBreakdown.No linked issue
No linked issue: this is a maintenance change that surfaces an existing upstream scoring cap in the breakdown — a pure projection over values already computed in
computeScoreCore— so there is no tracking issue to link.Tests
test/unit/score-breakdown.test.tscovers all three branches (unobserved / within-cap / over-cap) plus the component-name contract. Scoring, preview, and openapi-contract suites are green; the change is a pure projection over already-computed values.