Skip to content

test(scoring): cover pure upstream-constant parsers in scoring/model.ts #2091

Description

@JSONbored

src/scoring/model.ts has no dedicated test file; its pure parser/detector functions are only incidentally exercised. Add a focused unit test that drives every branch of the pure exports so they reach 100% branch-counted patch coverage independent of the fetch paths.

Deliverables

  • Create test/unit/scoring-model.test.ts
  • parsePythonNumberConstants: underscore separators in integer AND fractional parts (1_000_000, 0.000_001, 3.14_15), exponents (1e-9, 5.8e1), knownOnly:true filtering vs knownOnly:false, and non-matching lines (skip via continue)
  • findUnmodeledConstantKeys / findUnmodeledUpstreamConstants: assert known + NON_SCORING_UPSTREAM_CONSTANT_NAMES (e.g. EMISSION_SHARE_TOLERANCE, DEFAULT_PROGRAMMING_LANGUAGE_WEIGHT) are excluded and result is sorted
  • detectActiveModel: pending_saturation_model, current_density_model, and unknown branches (both hasSaturationConstants and hasDensityConstants sides)
  • scoringSnapshotStalenessWarning: exactly-at-window boundary (null) vs past-window (warning string), with explicit now arg
  • isTimeDecayEnabled: each truthy token (1/true/yes/on, case-insensitive) and the falsey/undefined arm
  • Do NOT test fetchText/fetchJson/getOrCreateScoringModelSnapshot network paths — scope to the pure exports

References

  • src/scoring/model.ts:208
  • src/scoring/model.ts:220
  • src/scoring/model.ts:270
  • src/scoring/model.ts:285
  • src/scoring/model.ts:289

size: S · gittensor:bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions