Skip to content

fix(engine): weight local-scorer totalTokenScore with TEST_FILE_CONTRIBUTION_WEIGHT - #9101

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
bitfathers94:fix/issue-8875
Jul 26, 2026
Merged

fix(engine): weight local-scorer totalTokenScore with TEST_FILE_CONTRIBUTION_WEIGHT#9101
JSONbored merged 1 commit into
JSONbored:mainfrom
bitfathers94:fix/issue-8875

Conversation

@bitfathers94

Copy link
Copy Markdown
Contributor

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 typecheck
  • npx turbo run build:tsc build:verify
  • npm run test:coverage — patch coverage 100.0% of changed lines

…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
@bitfathers94
bitfathers94 requested a review from JSONbored as a code owner July 26, 2026 17:34
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.88%. Comparing base (3c1173e) to head (8949583).
⚠️ Report is 2 commits behind head on main.

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     
Flag Coverage Δ
backend 95.17% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/loopover-engine/src/local-scorer.ts 100.00% <100.00%> (ø)
packages/loopover-engine/src/scoring/model.ts 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 26, 2026
@loopover-orb

loopover-orb Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Warning

⏸️ LoopOver review result - manual review recommended

Review updated: 2026-07-26 17:51:43 UTC

6 files · 1 AI reviewer · no blockers · CI green · clean

⏸️ Suggested Action - Manual Review

  • AI review did not produce public notes: The configured AI reviewer returned no usable public assessment for this PR head.

Review summary
AI review is unavailable for this PR head. LoopOver is holding this PR for manual review until the configured AI provider returns a usable public review summary.

Nits — 1 non-blocking
  • AI review did not produce public notes — Fix the configured AI provider, then re-run LoopOver review before relying on the result.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ⚠️ Gate result — Not blocking (Advisory; not blocking this PR.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #8875
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 52 registered-repo PR(s), 41 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor bitfathers94; Gittensor profile; 52 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor
Review context
  • Author: bitfathers94
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: TypeScript
  • Official Gittensor activity: 52 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask 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.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

Decision record
  • action: hold · clause: ai_review_inconclusive
  • config: 03a7f8b529a9 · pack: oss-anti-slop
  • record: 5f5deb21684f (schema v3, head 8949583)

🟩 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.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 26, 2026
@JSONbored
JSONbored merged commit 9274eea into JSONbored:main Jul 26, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. manual-review Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(engine): local-scorer's totalTokenScore bypasses the TEST_FILE_CONTRIBUTION_WEIGHT discount when fed back into the score preview

2 participants