Skip to content

test(coverage): raise and stabilize global coverage at 97% #84

Description

@JSONbored

Parent roadmap: #82

Background

Contributor PRs have been hovering near the coverage threshold. As the project becomes a public Gittensor target, CI needs enough test margin that small feature work does not accidentally pull branch coverage below the gate.

Goal

Raise and stabilize the test suite so the repo enforces 97% global coverage and contributors are guided toward 98%+ branch coverage locally.

Current Behavior

The repo has historically targeted 95% coverage and some PRs have failed or nearly failed around the branch threshold.

Desired Behavior

CI enforces 97% global coverage and documentation/templates make it clear that every behavior change needs branch/fallback/regression coverage.

Implementation Requirements

  • Identify currently undercovered files/branches from coverage output.
  • Add targeted tests around existing behavior rather than inflating coverage with shallow tests.
  • Update contributor guidance and PR templates to mention the 97% CI gate and 98% local target.
  • Preserve or improve test runtime.
  • Avoid changing production behavior unless a real uncovered bug is found and fixed with tests.

Public/Private Output Boundaries

Coverage work should not add public product output, scoreability claims, or release notes beyond normal test/CI wording.

Acceptance Criteria

  • npm run test:ci passes with at least 97% global coverage for lines, statements, functions, and branches.
  • Branch coverage has meaningful buffer above the threshold.
  • PR template/test guidance states the new policy.
  • New tests cover real branches, fallback paths, and sanitizer behavior where available.

Testing Requirements

  • npm run test:ci must pass.
  • Global coverage must remain at or above 97% for lines, statements, functions, and branches.
  • Aim for 98%+ branch coverage locally to avoid CI variance.
  • Add tests for every new branch, fallback path, sanitizer rule, and regression.
  • Add invariant/property-style tests when behavior depends on sorting, gating, scoring, queue pressure, source-upload safety, public/private boundaries, or upstream drift.
  • Public GitHub output must be tested against forbidden language: wallet, hotkey, raw trust score, payout, reward estimate, farming, private reviewability, and public score estimate.
  • MCP/local tooling must prove source contents are not uploaded.

Additional Test Scenarios

  • Run the full coverage gate.
  • Confirm no snapshot or generated changelog files are modified by the test run.
  • Confirm CI failure output clearly points contributors toward coverage details.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions