Skip to content

# fix(scoring): single-source fallbacks from DEFAULT_SCORING_CONSTANTS (Fixes #812) - #1107

Closed
bohdansolovie wants to merge 1 commit into
JSONbored:mainfrom
bohdansolovie:fix/812-single-source-scoring-fallbacks
Closed

# fix(scoring): single-source fallbacks from DEFAULT_SCORING_CONSTANTS (Fixes #812)#1107
bohdansolovie wants to merge 1 commit into
JSONbored:mainfrom
bohdansolovie:fix/812-single-source-scoring-fallbacks

Conversation

@bohdansolovie

Copy link
Copy Markdown
Contributor

Fixes #812

Summary

Remove duplicated fallback literals scattered across preview.ts and derive every scoring constant lookup from DEFAULT_SCORING_CONSTANTS in model.ts.

Problem

Every constant(constants, "KEY", <literal>) call in preview.ts duplicated a value already declared in DEFAULT_SCORING_CONSTANTS. When defaults changed (e.g. #807 MAX_CONTRIBUTION_BONUS 25→5), call-site literals could silently drift. Density-era constants (MIN_TOKEN_SCORE_FOR_BASE_SCORE, MAX_CODE_DENSITY_MULTIPLIER) were not even in the defaults map — only hardcoded at lookup sites.

Changes

  • src/scoring/model.ts — add density-era constants to DEFAULT_SCORING_CONSTANTS; SCORING_CONSTANT_NAMES derives from keys only
  • src/scoring/preview.tsconstant() reads fallbacks from DEFAULT_SCORING_CONSTANTS; remove all inline literal fallbacks (including feat(scoring): pull + model upstream constants not currently fetched #809 review-collateral and non-code cap constants)
  • test/unit/scoring.test.ts — regression: empty-constants preview matches explicit-defaults preview; density branch retained; density constants no longer flagged as unmodeled drift

Scope boundary

Does not remove the density-model branch — current_density_model remains a supported activeModel in types, OpenAPI, and score-breakdown.ts.

API / OpenAPI / MCP contract

No schema changes. Preview math values unchanged when snapshot constants are present.

Validation

npm run test:ci

Distinct from prior PRs

…ixes JSONbored#812)

Derive every preview.ts constant() fallback from DEFAULT_SCORING_CONSTANTS
instead of duplicated inline literals. Add density-era constants to the defaults
map and regression tests proving empty-constants previews match explicit defaults.

Co-authored-by: Cursor <cursoragent@cursor.com>
@bohdansolovie
bohdansolovie requested a review from JSONbored as a code owner June 23, 2026 21:08
@dosubot dosubot Bot added the size:M label Jun 23, 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 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.79%. Comparing base (a0b0ea7) to head (c0d244a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1107   +/-   ##
=======================================
  Coverage   94.79%   94.79%           
=======================================
  Files         153      153           
  Lines       18553    18554    +1     
  Branches     6708     6708           
=======================================
+ Hits        17587    17588    +1     
  Misses        408      408           
  Partials      558      558           

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

@ghost

ghost commented Jun 23, 2026

Copy link
Copy Markdown

Note

Gittensory command help
Gittensory updated this command response in place from cached public-safe context.

Signal State
Command @gittensory help
Scope #1107
Actor author

Command: @gittensory help

Command result

Commands

  • Available public commands and their safest use on a PR thread.

Findings

  • @gittensory help shows this command list.
  • @gittensory ask <question> answers contribution-quality Q&A with source citations and freshness.
  • @gittensory preflight summarizes public PR hygiene.
  • @gittensory blockers explains public readiness blockers.
  • @gittensory duplicate-check summarizes duplicate/WIP caution.

Evidence

  • Invocation authorized for author command use.
  • Output is sanitized before posting to GitHub.

Next actions

  • Comment one listed command on the PR thread when more context is needed.
Source and freshness
  • Source: static command catalog.
  • Freshness: shipped command list.
  • Boundary: public GitHub comment; non-public scoring and planning context is omitted.
Additional safe details
  • @gittensory miner-context confirms public Gittensor miner context.
  • @gittensory next-action gives a public-safe next step.
  • @gittensory reviewability summarizes PR readiness without private review internals.
  • @gittensory repo-fit summarizes repository fit from cached public-safe signals.
  • @gittensory packet prepares public-safe PR packet guidance.
  • @gittensory queue-summary gives maintainers cached queue-level context.
  • @gittensory review-now lists maintainer-only review candidates.
  • @gittensory needs-author lists PRs that need author cleanup.
  • @gittensory confirmed-miners lists cached confirmed-miner PRs.
  • @gittensory duplicate-clusters lists duplicate/WIP clusters.
  • @gittensory burden-forecast projects maintainer review load and queue-growth risk.
  • @gittensory intake-health summarizes contributor-intake health.
  • @gittensory outcome-patterns summarizes what the repo merges vs closes.
  • @gittensory noise-report highlights queue noise to triage first.

Feedback

  • Use a thumbs-up or thumbs-down reaction to mark whether this answer helped. Feedback is aggregate-only and never changes deterministic results.

💰 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 gittensory:reviewed gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. labels Jun 23, 2026
@ghost

ghost commented Jun 23, 2026

Copy link
Copy Markdown

Gittensory is closing this pull request on the maintainer's behalf (conflicts with the base branch — resolve and open a fresh PR). This is an automated maintenance action — if you believe it's mistaken, reopen the PR or ping a maintainer and it will be reviewed.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gittensory approves — the gate is satisfied and CI is green.

@ghost ghost closed this Jun 23, 2026
@bohdansolovie

Copy link
Copy Markdown
Contributor Author

Hi, @JSONbored
@gittensory approved my PR and closed without merge.
please check this.

@bohdansolovie

Copy link
Copy Markdown
Contributor Author

Hi, @JSONbored
@gittensory approved my PR and closed without merge.

@bohdansolovie

Copy link
Copy Markdown
Contributor Author

Hi, @JSONbored
please check my PR.
Why was my PR closed?

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:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(scoring): single-source fallbacks + drop dead density branch

1 participant