Skip to content

fix(scoring): correct constant name + fallback to match upstream values (#806, #807)#815

Merged
JSONbored merged 1 commit into
mainfrom
fix/upstream-scoring-constants
Jun 17, 2026
Merged

fix(scoring): correct constant name + fallback to match upstream values (#806, #807)#815
JSONbored merged 1 commit into
mainfrom
fix/upstream-scoring-constants

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Internal gittensory fix — two verified scoring-sync correctness bugs (2026-06-17 audit). The values mirror the documented upstream gittensor scoring constants; nothing is filed upstream.

#806 — treasury emission-share never synced

gittensory keyed ISSUE_TREASURY_EMISSION_SHARE; upstream publishes it as ISSUES_TREASURY_EMISSION_SHARE (plural). The mismatch froze it at the local default forever and produced a false 'unmodeled' drift warning. Renamed; SCORING_CONSTANT_NAMES derives from the keys, so it now syncs.

#807 — MAX_CONTRIBUTION_BONUS fallback was 5x the real value

Fallback was 25; the real value is 5. Hourly fetch normally overwrites it, but on a fetch failure the contribution bonus was silently 5x inflated. Set to 5 in model.ts + the preview.ts literal.

Tests

New regression + updated the fetch-failure-fallback test (had codified the buggy 25). vitest run test/unit/scoring.test.ts -> 31 passed; scoring files typecheck clean.

Closes #806
Closes #807

Two real upstream-sync correctness bugs found in the 2026-06-17 scoring audit.
Both affect the value gittensory shows contributors (and the PMF conversion hook).

- #806: the treasury emission share was keyed `ISSUE_TREASURY_EMISSION_SHARE` but
  upstream entrius/gittensor uses `ISSUES_TREASURY_EMISSION_SHARE` (plural). The
  name never matched, so the value was frozen at the local default forever AND
  upstream's real constant was reported as "unmodeled" drift. Renamed to the
  upstream spelling; SCORING_CONSTANT_NAMES derives from the keys, so it now syncs.
- #807: the MAX_CONTRIBUTION_BONUS fallback was 25 but upstream is 5. The hourly
  fetch normally overwrites it, but on any fetch failure the contribution bonus was
  silently 5x-inflated. Fallback set to 5 in model.ts and the preview.ts literal.

Regression test asserts the upstream name/value and that the plural name is no
longer flagged unmodeled; updated the fetch-failure-fallback test to expect 5.

Closes #806
Closes #807
@ghost

ghost commented Jun 17, 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 #815 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.

@dosubot dosubot Bot added the size:S label Jun 17, 2026
@ghost ghost added the gittensory:reviewed label Jun 17, 2026
@ghost

ghost commented Jun 17, 2026

Copy link
Copy Markdown

gittensory · advisory review

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

Changed files: src/scoring/model.ts, src/scoring/preview.ts, test/unit/scoring.test.ts

Suggested action: 🛠️ Request changes. (reviewers split: request changes / merge) Address the suggestions below before merging.

Reviewer A · gpt-oss-120b — recommends 🛠️ request changes
The PR aligns scoring constants with upstream naming and default values, updating the model, preview calculation, and adding tests to verify the changes.

Suggestions

  • Search the codebase for any remaining references to the old constant name ISSUE_TREASURY_EMISSION_SHARE and update them or provide a backward‑compatible alias.
  • Add a unit test for contributionBonusRamp to ensure it correctly uses the new fallback of 5 when the upstream value is missing.
  • Update any documentation/comments that still mention the old constant name or the previous default of 25.

Worth double-checking

  • If other modules still rely on ISSUE_TREASURY_EMISSION_SHARE, they may now receive undefined values, causing runtime errors or incorrect scoring.
  • Changing the fallback for MAX_CONTRIBUTION_BONUS without a test of the ramp logic could introduce subtle regression in contribution bonus calculations.

Reviewer B · nemotron-3-120b-a12b — recommends ✅ merge
The PR fixes two issues: corrects the constant name for treasury emission share to match upstream plural spelling (ISSUES_TREASURY_EMISSION_SHARE) and adjusts the fallback value for MAX_CONTRIBUTION_BONUS from 25 to 5 to match upstream's value, preventing 5x inflation when upstream fetch fails. Changes are minimal, well-tested, and align with project conventions.

No blocking issues spotted.

@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.76%. Comparing base (54ed808) to head (18e55db).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #815   +/-   ##
=======================================
  Coverage   96.76%   96.76%           
=======================================
  Files          97       97           
  Lines       13992    13992           
  Branches     5098     5098           
=======================================
  Hits        13540    13540           
  Misses         86       86           
  Partials      366      366           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored
JSONbored merged commit aaeff16 into main Jun 17, 2026
20 checks passed
@JSONbored
JSONbored deleted the fix/upstream-scoring-constants branch June 17, 2026 08:17
@github-actions github-actions Bot mentioned this pull request Jun 17, 2026
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: MAX_CONTRIBUTION_BONUS fallback is 5x upstream (25 vs 5) [Bug]: treasury emission-share constant name mismatch never syncs from upstream

1 participant