Skip to content

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

Closed
andriypolanski wants to merge 3 commits into
JSONbored:mainfrom
andriypolanski:fix/8875-local-scorer-test-file-weight-v2
Closed

fix(engine): weight local-scorer totalTokenScore with TEST_FILE_CONTRIBUTION_WEIGHT#9088
andriypolanski wants to merge 3 commits into
JSONbored:mainfrom
andriypolanski:fix/8875-local-scorer-test-file-weight-v2

Conversation

@andriypolanski

Copy link
Copy Markdown
Contributor

Summary

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (e.g. Closes #123) — a linked open issue is required for every contributor PR.

Validation

  • git diff --check
  • npx vitest run test/unit/local-scorer.test.ts — 7 passed
  • npm run test --workspace @loopover/engine -- test/local-scorer.test.ts — passed
  • npx vitest run test/unit/mcp-cli-plan-scorer-tools.test.ts -t "loopover_run_local_scorer computes" — passed
  • CI-scoped Codecov simulation — 100% patch lines (4/4) on packages/loopover-engine/src/local-scorer.ts
  • npm run typecheck
  • npm run actionlint
  • npm run test:coverage
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

Narrow engine scoring alignment fix; full test:ci left for CI. Targeted local-scorer + MCP tool tests cover the weighted total and preview agreement path.

Notes for reviewers / gate

  • No secrets, wallets, hotkeys, trust scores, or reward values.
  • Does not touch site/, CNAME, **/lovable/**, or CHANGELOG.md.
  • No UI Evidence (backend-only).

Made with Cursor

andriy-polanski and others added 3 commits July 26, 2026 16:31
…IBUTION_WEIGHT (JSONbored#8875)

Apply the same test-file discount preview.ts uses when deriving totalTokenScore
so feeding localScorer totals back into buildScorePreview no longer bypasses
the gate's contribution-bonus weighting on test-heavy diffs.

Co-authored-by: Cursor <cursoragent@cursor.com>
@superagent-security

Copy link
Copy Markdown
Contributor

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

@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

Caution

🛑 LoopOver review result - reject/close recommended

Review updated: 2026-07-26 17:00:58 UTC

6 files · 1 AI reviewer · 1 blocker · CI green · clean

🛑 Suggested Action - Reject/Close

Review summary
The AI review returned non-blocking notes for this change but did not include a separate narrative summary. Review the nits below before deciding this PR.

Nits — 4 non-blocking
  • The diff includes migrations/0182_decision_replay_inputs.sql marked as a bare rename with no content change and no mention in the PR description — worth confirming this is just incidental repo state and not an accidentally bundled unrelated change.
  • If TEST_FILE_CONTRIBUTION_WEIGHT can ever be 0 or undefined in a scoring model snapshot, add a fallback test case for that boundary.
  • Pull request duplicates other open work — Check for an existing pull request or issue covering this change and coordinate or consolidate before continuing.
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.

Why this is blocked

📋 Copy for AI agents — paste into your coding agent
Fix the following blocker(s) from this PR review:

1. Linked issue overlaps another open PR: Other open pull requests reference the same linked issue set: #9071. — Review the related PRs before spending reviewer time on duplicate work.

Decision drivers

  • ❌ Code review — 1 blocker (1 reviewer)
  • ❌ Gate result — Blocking (Repo-configured hard blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #8875, #8970
Related work ⚠️ Same linked issue: #9071 Another open PR references the same linked issue.
Change scope ❌ 8/20 High review scope from cached public metadata (2 linked issues).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 201 registered-repo PR(s), 126 merged, 22 issue(s).
Contributor context ✅ Confirmed Gittensor contributor andriypolanski; Gittensor profile; 201 PR(s), 22 issue(s).
Improvement ✅ Minor risk: low · value: minor
Linked issue satisfaction

Addressed
The diff changes computeLocalScorerTokens to compute totalTokenScore using sourceTokenScore + TEST_FILE_CONTRIBUTION_WEIGHT * testTokenScore + nonCodeTokenScore, matching preview.ts's weighting, and adds a test comparing an explicit-total preview against a preview-derived total for a test-heavy diff, asserting contributionBonus and estimatedMergedScore agree. This satisfies both listed deliverable

Review context
Contributor next steps
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.

🟩 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 commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (Linked issue overlaps another open PR; duplicate of open PR #9071). 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.

@loopover-orb loopover-orb Bot closed this Jul 26, 2026
@andriypolanski

andriypolanski commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

Hi, @JSONbored
pr #9071 has to be closed right away like my previous pr #9072, but not closed, so this pr is closed.
please reopen and review again.

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.

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