Skip to content

test(scoring): cover activeModelWarnings both-saturation-and-density branch#9357

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
nghetien:fix/issue-9321-a1-test-scoring
Jul 27, 2026
Merged

test(scoring): cover activeModelWarnings both-saturation-and-density branch#9357
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
nghetien:fix/issue-9321-a1-test-scoring

Conversation

@nghetien

Copy link
Copy Markdown
Contributor

Closes #9321

Summary

The activeModelWarnings function in src/scoring/model.ts has three branches, but only the "neither saturation nor density constants present" branch was exercised end-to-end through refreshScoringModelSnapshot. This adds the missing test for the "both present" branch, mirroring the existing sibling test pattern.

No production code changes — this is a pure test-coverage gap fix, as called out in the issue.

Scope

  • Backend/test only
  • test/unit/scoring.test.ts

Validation

  • npx turbo run build --filter=@loopover/engine — green
  • npx turbo run build --filter=@loopover/mcp — green
  • npx turbo run build:tsc build:verify --filter=@loopover/miner — green
  • npx vitest run --changed=upstream/main --passWithNoTests — 90/90 passed
  • npm test (full unsharded suite) — 1220/1226 test files passed; the 6 failing tests (check-ui-kit-package.test.ts, salvageability.test.ts, selfhost-metrics.test.ts, selfhost-pg-retention.test.ts ×2, worker-entry-boundary.test.ts) are pre-existing and unrelated — verified by re-running those same files with this diff stashed out, reproducing identical failures on the unmodified tree.

Safety

  • No secrets, wallets, hotkeys, trust scores, or reward values touched
  • No auth/CORS surface touched (test-only change)

UI Evidence

Not applicable — this change only adds a unit test in test/unit/scoring.test.ts; no UI, route, or component files were touched.

Notes

New test stubs a constants.py response containing SRC_TOK_SATURATION_SCALE, MIN_TOKEN_SCORE_FOR_BASE_SCORE, and MAX_CODE_DENSITY_MULTIPLIER together, calls refreshScoringModelSnapshot, and asserts the exact warning text: "Scoring constants include both exponential saturation and density-era indicators; using exponential saturation as the active model."

…branch

Exercises the "both present" branch of activeModelWarnings end-to-end
through refreshScoringModelSnapshot, mirroring the existing
"neither present" test pattern.
@nghetien
nghetien requested a review from JSONbored as a code owner July 27, 2026 13:57
@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 27, 2026
@loopover-orb

loopover-orb Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-27 14:07:01 UTC

1 file · 1 AI reviewer · no blockers · readiness 98/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This adds a genuine end-to-end test for the 'both saturation and density constants present' branch of activeModelWarnings, exercised via refreshScoringModelSnapshot with a stubbed fetch that includes SRC_TOK_SATURATION_SCALE, MIN_TOKEN_SCORE_FOR_BASE_SCORE, and MAX_CODE_DENSITY_MULTIPLIER together. Tracing the source: hasSaturationConstants and hasDensityConstants are both satisfied by this payload, so activeModelWarnings (src/scoring/model.ts) correctly returns the 'both present' warning string, which the test asserts verbatim — this is a real, reachable path, not a fabricated one. It closes #9321, is pure test-only, mirrors the existing sibling test pattern exactly, and CI passed.

Nits — 2 non-blocking
  • The new test duplicates the VALID_CONSTANTS_PY + three-line-append pattern seen in sibling tests; a small helper for 'constants.py body with overrides' could reduce this repetition across the file, though it's consistent with existing style so not required.
  • Consider extracting a `constantsResponse(overrides: string)` helper used by this and the two adjacent tests (`test/unit/scoring.test.ts` around line 352-378) to cut boilerplate, though this is optional given the file's existing convention of inlining each fetch stub.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #9321
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: 10 registered-repo PR(s), 4 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor nghetien; Gittensor profile; 10 PR(s), 0 issue(s).
Improvement ℹ️ Insufficient signal risk: clean · value: insufficient-signal · LLM: minor
Linked issue satisfaction

Addressed
The PR adds a new test that stubs a constants.py fetch containing both SRC_TOK_SATURATION_SCALE and MAX_CODE_DENSITY_MULTIPLIER, calls refreshScoringModelSnapshot, and asserts the exact 'both present' warning text appears in refreshed.warnings, matching the issue's stated requirement and template.

Review context
  • Author: nghetien
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Dart, JavaScript, Python, CSS, C#, C++, TypeScript
  • Official Gittensor activity: 10 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 <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> 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 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

@loopover-orb
loopover-orb Bot merged commit 7876a05 into JSONbored:main Jul 27, 2026
6 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(scoring): activeModelWarnings' both-saturation-and-density branch is never exercised end-to-end

1 participant