fix(engine): weight local-scorer totalTokenScore with TEST_FILE_CONTRIBUTION_WEIGHT - #8970
Closed
philluiz2323 wants to merge 2 commits into
Closed
fix(engine): weight local-scorer totalTokenScore with TEST_FILE_CONTRIBUTION_WEIGHT#8970philluiz2323 wants to merge 2 commits into
philluiz2323 wants to merge 2 commits into
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. Closes JSONbored#8875
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
…ypecheck DEFAULT_SCORING_CONSTANTS is Record<string, number>, so the indexed weight was possibly undefined under strict typecheck. Default to 0.05 to satisfy TS18048.
Contributor
|
This repository reviews pull requests one-shot: the PR must be correct as originally opened. Pushing an additional commit closes it automatically instead of restarting review — open a fresh pull request with every fix included. |
9 tasks
❌ 3 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
This was referenced Jul 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.Fix
Compute
totalTokenScoreassource + TEST_FILE_CONTRIBUTION_WEIGHT * test + nonCode, matchingpreview.ts'sderivedTotalTokenScore, using the sharedDEFAULT_SCORING_CONSTANTSconstant.Tests
buildScorePreviewmatches the derived-total (no explicit total) path for contribution bonus / estimated merged score.loopover_run_local_scorerexpectation updated accordingly.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