Skip to content

Bring all servers to the 90% per-file coverage gate; reintroduce the rule to AGENTS.md #4474

Description

@cliffhall

Goal

Bring every server up to the ≥ 90% per-file test-coverage gate used in the inspector repo, enforce it in tooling, and then reintroduce the rule into AGENTS.md#4473 deliberately deferred it so the rule wouldn't be aspirational fiction on day one. Once this issue lands, the rule is true and stays true.

The gate (per the inspector v2/main reference)

  • Per-file threshold of ≥ 90 on all four dimensions: lines, statements, functions, branches
  • Genuinely-unreachable branches are not waved through by lowering the gate — they get a justified inline ignore at the source (/* v8 ignore ... -- <reason> */ for TS; # pragma: no cover # <reason> for Python)
  • Coverage is a separate, deliberate command (npm run coverage), not baked into the fast validate loop — mirroring inspector's split (validate = fast unit tests; coverage = instrumented gate)

Scope

TypeScript servers (vitest + @vitest/coverage-v8 already in place):

Python servers (pytest + pyright + ruff in place; coverage tooling TBD):

  • fetch, git, time
  • Add pytest-cov/coverage.py; note coverage.py's fail_under is global, not per-file — pick the per-file enforcement mechanism as part of this work (e.g. coverage json + a small check script, matching the TS gate's semantics)
  • uv run coverage equivalent documented per server

Tasks

  • Audit current coverage per server — record the baseline in a comment on this issue (some servers may be far from 90; the audit sizes the work)
  • Write the missing tests, server by server (each server can be its own PR — independent, reviewable chunks)
  • Annotate genuinely-unreachable branches with justified ignores instead of gate-lowering
  • Enforce: per-file 90/90/90/90 thresholds in each TS vitest config; per-file mechanism for Python
  • Root coverage script (TS chain) + per-server Python invocation
  • Decide CI posture and document it: inspector runs validate in CI and keeps the coverage gate local-only — adopt the same unless there's a reason not to
  • Reintroduce the rule into AGENTS.md ("Always test new or modified code" section): per-file ≥ 90 on all four dimensions, justified-ignore policy, coverage vs validate split — wording adapted from the inspector reference

Dependencies

Acceptance

  • Every TS server passes its per-file 90% gate via npm run coverage
  • Every Python server passes the equivalent gate
  • Gates are enforced by configuration, not convention
  • AGENTS.md states the rule, and the rule is true on the day it's stated

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions