fix(engine): weight local-scorer totalTokenScore with TEST_FILE_CONTRIBUTION_WEIGHT - #8977
Conversation
…IBUTION_WEIGHT computeLocalScorerTokens summed raw test lines into totalTokenScore, so feeding that total back into buildScorePreview bypassed the 0.05x test-file discount preview.ts applies when deriving its own total. Compute the weighted total the same way as derivedTotalTokenScore so a test-heavy local preview matches the gate. Tests use `?? 0.05` when reading DEFAULT_SCORING_CONSTANTS so strict typecheck accepts the Record<string, number> index (TS18048). Closes JSONbored#8875
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
|
Caution 🛑 LoopOver review result - fixes requiredReview updated: 2026-07-26 15:15:45 UTC
Review summary Nits — 1 non-blocking
CI checks failing
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed 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. 🟩 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.
|
|
LoopOver is closing this pull request on the maintainer's behalf (CI is failing (validate, validate-tests)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
Problem
Closes #8875.
computeLocalScorerTokensreturned a raw unweighted line sum astotalTokenScore. When that value is fed back intobuildScorePreviewas an explicit total, preview honors it as-is and skips theTEST_FILE_CONTRIBUTION_WEIGHT(0.05×) discount it applies when deriving its own total — so a test-heavy local scorer preview over-counts test lines in the contribution-bonus ramp.Re-filed after #8970: this repo is one-shot (follow-up commits auto-close). This PR includes the weight fix and the TS18048
?? 0.05typecheck narrowing in a single commit.Fix
Compute
totalTokenScoreassource + TEST_FILE_CONTRIBUTION_WEIGHT * test + nonCode, matchingpreview.ts'sderivedTotalTokenScore, using the sharedDEFAULT_SCORING_CONSTANTSconstant.Tests
buildScorePreviewmatches the derived-total path for contribution bonus / estimated merged score.loopover_run_local_scorerexpectation updated.?? 0.05soRecord<string, number>indexing typechecks cleanly.Reverting the weight fails the agreement test.
git diff --checkclean.Scope
Validation
git diff --checkvitest run test/unit/local-scorer.test.ts(7 pass)vitest run test/unit/mcp-run-local-scorer.test.ts(2 pass)Safety