fix(engine): weight local-scorer totalTokenScore with TEST_FILE_CONTRIBUTION_WEIGHT - #9101
Conversation
…IBUTION_WEIGHT computeLocalScorerTokens emitted a raw unweighted line sum as totalTokenScore. When a caller feeds that value back into buildScorePreview as an explicit total, preview honours it as-is and skips the 0.05x TEST_FILE_CONTRIBUTION_WEIGHT discount it applies when deriving its own total from components -- so a test-heavy diff's local-scorer preview over-counts test lines in the contribution-bonus ramp, contradicting preview.ts's own numbers. Compute totalTokenScore as source + TEST_FILE_CONTRIBUTION_WEIGHT * test + nonCode, matching preview.ts's derivedTotalTokenScore. The weight is now a strongly-typed named export in model.ts (single-sourced with DEFAULT_SCORING_CONSTANTS) so the non-snapshot local scorer can apply it without indexing the constants map. Closes JSONbored#8875
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9101 +/- ##
==========================================
- Coverage 93.88% 93.88% -0.01%
==========================================
Files 810 810
Lines 80600 80602 +2
Branches 24454 24454
==========================================
- Hits 75675 75673 -2
Misses 3560 3560
- Partials 1365 1369 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Warning ⏸️ LoopOver review result - manual review recommendedReview updated: 2026-07-26 17:51:43 UTC
Review summary Nits — 1 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. Decision record
🟩 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 LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
fix(engine): weight local-scorer totalTokenScore with TEST_FILE_CONTRIBUTION_WEIGHT
computeLocalScorerTokens emitted a raw unweighted line sum as totalTokenScore.
When a caller feeds that value back into buildScorePreview as an explicit total,
preview honours it as-is and skips the 0.05x TEST_FILE_CONTRIBUTION_WEIGHT discount
it applies when deriving its own total from components -- so a test-heavy diff's
local-scorer preview over-counts test lines in the contribution-bonus ramp,
contradicting preview.ts's own numbers.
Compute totalTokenScore as source + TEST_FILE_CONTRIBUTION_WEIGHT * test + nonCode,
matching preview.ts's derivedTotalTokenScore. The weight is now a strongly-typed
named export in model.ts (single-sourced with DEFAULT_SCORING_CONSTANTS) so the
non-snapshot local scorer can apply it without indexing the constants map.
Closes #8875
Validation
Verified locally on this branch before opening:
npm run typechecknpx turbo run build:tsc build:verifynpm run test:coverage— patch coverage 100.0% of changed lines