Skip to content

feat(scoring): sync dropped upstream constants and cap non-code token contribution (#809) - #991

Closed
jason020818 wants to merge 1 commit into
JSONbored:mainfrom
jason020818:feat/809-sync-scoring-constants-noncode-cap
Closed

feat(scoring): sync dropped upstream constants and cap non-code token contribution (#809)#991
jason020818 wants to merge 1 commit into
JSONbored:mainfrom
jason020818:feat/809-sync-scoring-constants-noncode-cap

Conversation

@jason020818

Copy link
Copy Markdown
Contributor

Summary

Addresses #809. The knownOnly constants parser dropped MAX_OPEN_PR_REVIEW_COLLATERAL_MULTIPLIER, MAX_LINES_SCORED_FOR_NON_CODE_EXT, and DEFAULT_ISSUE_DISCOVERY_SHARE (absent from SCORING_CONSTANT_NAMES), so they never synced from upstream and surfaced as unmodeled drift. Add all three to DEFAULT_SCORING_CONSTANTS so they sync.

Model the non-code line cap in preview.ts: a PR's non-code token contribution is now capped at MAX_LINES_SCORED_FOR_NON_CODE_EXT before it feeds the component total, so a large generated/non-code file cannot inflate the contribution-bonus ramp (an explicit caller totalTokenScore is still honoured as-is).

Scope: DEFAULT_ISSUE_DISCOVERY_SHARE is already applied as the upstream default in registry/normalize.ts:62; the review-collateral multiplier now syncs and can be modeled in a focused follow-up.

Tests

The three constants are modeled + no longer flagged as drift; the non-code cap clamps the component total (nonCode 500 and 300 yield the same contribution bonus, 100 is lower). npx vitest run test/unit/scoring.test.ts → 44 passed · npx tsc --noEmit → clean · git diff --check → clean · full unit suite ripple-checked.

Closes #809.

… contribution (JSONbored#809)

The knownOnly constants parser dropped MAX_OPEN_PR_REVIEW_COLLATERAL_MULTIPLIER, MAX_LINES_SCORED_FOR_NON_CODE_EXT, and DEFAULT_ISSUE_DISCOVERY_SHARE (absent from SCORING_CONSTANT_NAMES), so they never synced from upstream and surfaced as unmodeled drift. Add all three to DEFAULT_SCORING_CONSTANTS so they sync.

Model the non-code line cap in preview.ts: a PR's non-code token contribution is now capped at MAX_LINES_SCORED_FOR_NON_CODE_EXT before it feeds the component total, so a large generated/non-code file cannot inflate the contribution-bonus ramp (an explicit caller total is still honoured as-is). DEFAULT_ISSUE_DISCOVERY_SHARE is already applied as the upstream default in registry/normalize.ts; the review-collateral multiplier now syncs and can be modeled in a follow-up.

Tests: the three constants are modeled + no longer flagged as drift, and the non-code cap clamps the component total (500 and 300 yield the same contribution bonus; 100 is lower).
@jason020818
jason020818 requested a review from JSONbored as a code owner June 22, 2026 05:34
@dosubot dosubot Bot added the size:S label Jun 22, 2026
@ghost ghost added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jun 22, 2026
@ghost

ghost commented Jun 22, 2026

Copy link
Copy Markdown

🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥

⛔ Maintainer review — Blockers found

Reviewed 3 changed file(s) — two independent AI reviewers, synthesized.

ℹ️ A required check is failing. CI failures are closed, not iterated in place — fix it and open a new focused PR.

Merge readiness: ❌ CI is red — approval withheld until it's green. Failing: see the checks tab.

Summary

The changes correctly add missing upstream scoring constants, update the parser to handle numeric literals with underscores and exponents, and cap non‑code token contributions per upstream spec. Tests verify the new constants and the capping behavior. No obvious security issues or correctness bugs are introduced. However, CI reports failing validation and test coverage checks (codecov thresholds not met), indicating the change is not yet ready for merge.

🛑 Hard blockers — must fix before merge

  • The codecov/patch check failed with 50.00% coverage (target 96.61%), indicating that not all new code is tested.

💡 Nits — non-blocking, optional

  • Ensure the constant default MAX_LINES_SCORED_FOR_NON_CODE_EXT matches upstream default (currently 300).
  • Verify that the constant helper used in preview.ts is correctly imported after the change.
  • Add additional unit tests to increase coverage of the new parsing logic and the capped non‑code token path to meet the project’s coverage threshold.
  • Investigate and fix the failing validate check – ensure all new fields/types conform to expected schemas.
  • Consider documenting the newly added constants in the scoring module README or comments for future maintainers.
  • Consider adding a comment explaining why the MAX_CONTRIBUTION_BONUS was changed to 5.
  • Consider adding a comment explaining the purpose of the SCORING_CONSTANT_NAMES set.

This repo uses one-shot review: a rejected PR is closed, not iterated in place. Address the above and open a new focused PR.

@ghost ghost added the reviewbot-review label Jun 22, 2026
@ghost

ghost commented Jun 22, 2026

Copy link
Copy Markdown

Note

Gittensory Gate skipped

PR closed before full evaluation. No late first comment was created.

Signal Result Evidence Action
Gate result ⚠️ Skipped #991 is no longer open. No action.

💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

@ghost ghost added the gittensory:reviewed label Jun 22, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 70.01%. Comparing base (363c0fb) to head (1de970a).

Files with missing lines Patch % Lines
src/scoring/preview.ts 50.00% 0 Missing and 1 partial ⚠️

❗ There is a different number of reports uploaded between BASE (363c0fb) and HEAD (1de970a). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (363c0fb) HEAD (1de970a)
2 1
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #991       +/-   ##
===========================================
- Coverage   96.61%   70.01%   -26.60%     
===========================================
  Files         110      110               
  Lines       15079    15080        +1     
  Branches     5451     5451               
===========================================
- Hits        14569    10559     -4010     
- Misses        106     3231     +3125     
- Partials      404     1290      +886     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(scoring): pull + model upstream constants not currently fetched

1 participant