Repository navigation
Bring all servers to the 90% per-file coverage gate; reintroduce the rule to AGENTS.md #4474
Description
Activity
I audited the current
filesystembaseline onmainat76d64c82using Node 22.23.2.Command:
cd src/filesystem npm ci npm test
Results: 7 test files and 152 tests pass.
File Statements Branches Functions Lines All files 45.91% 51.80% 40.32% 45.33% index.ts0% 0% 0% 0% lib.ts77.34% 65.75% 89.47% 76.92% path-utils.ts94.44% 94.28% 100% 94.44% path-validation.ts76.66% 80% 100% 76.66% roots-utils.ts91.66% 71.42% 100% 91.66% The main structural issue is that the integration tests exercise the compiled server through child processes, so Vitest's V8 report records
index.tsas completely uncovered even though those tests call many registered tools.I'd be happy to take the
filesystemslice. Before starting the implementation, could you confirm the preferred direction forindex.tscoverage?- Refactor server construction/registration so the server can be exercised in-process by Vitest, or
- Collect and merge V8 coverage from the spawned server processes.
Also, since #4473 is still open and
maindoes not yet contain the plannedAGENTS.md/validatesetup, should this slice wait for #4473 or proceed independently and rebase afterward?Hi @cliffhall,
I’m following up on the filesystem coverage slice. Before I start, would you prefer in process server construction for index.ts coverage, or collecting coverage from spawned processes? Should this work wait for #4473, or is an independent PR welcome?
Thanks for the baseline audit, and sorry for the slow reply. This work is now part of the 2026-07-28 Spec Refactor tracker, #4857, and this issue is closing in favor of:
- Bugs, Coverage, and SDK Wave 1 Part 1: TypeScript servers: extensive unit tests + per-file 90% coverage gate #4854 Part 1: TypeScript servers, with extensive unit tests and the per-file 90% coverage gate
- Bugs, Coverage, and SDK Wave 1 Part 2: Python servers: extensive unit tests + per-file 90% coverage gate #4855 Part 2: Python servers, with the same gate
Both come first in the tracker. They pin down current behavior as a regression net before the SDK v2 migrations (Parts 3 and 4) and the move to the 2026-07-28 spec (Parts 5 and 6).
Answers to your two questions:
- Coverage of
index.ts: go with option 1, building the server in the same process. Refactor server construction (e.g. acreateServer()factory thatindex.tscalls) and exercise it with an SDKClientover an in-memory transport. Keep at most a thin spawn-based smoke test for the binary entry point. Tests should use only the public client API and wire-level results, so the Part 3 codemod can update them without changing any assertions. - Adopt AGENTS.md (with CLAUDE.md pointer) modeled on the inspector repo #4473: no need to wait. The test and coverage work doesn't depend on it. Putting the rule back into
AGENTS.mdis tracked in Bugs, Coverage, and SDK Wave 1 Part 1: TypeScript servers: extensive unit tests + per-file 90% coverage gate #4854 as a follow-up once both suites land.
You're very welcome to take the
filesystemslice of #4854 as its own PR. Please target thev2/mainbranch (notmain) and reference #4854 in the PR.
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)
/* v8 ignore ... -- <reason> */for TS;# pragma: no cover # <reason>for Python)npm run coverage), not baked into the fastvalidateloop — mirroring inspector's split (validate = fast unit tests; coverage = instrumented gate)Scope
TypeScript servers (vitest +
@vitest/coverage-v8already in place):everything,filesystem,memory,sequentialthinkingcoverage.thresholdswithperFile: true, 90 across lines/statements/functions/branches) in each server's vitest confignpm run coveragechaining the per-workspace coverage runs (companion to Adopt AGENTS.md (with CLAUDE.md pointer) modeled on the inspector repo #4473'svalidatechain)Python servers (pytest + pyright + ruff in place; coverage tooling TBD):
fetch,git,timepytest-cov/coverage.py; note coverage.py'sfail_underis 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 coverageequivalent documented per serverTasks
coveragescript (TS chain) + per-server Python invocationvalidatein CI and keeps the coverage gate local-only — adopt the same unless there's a reason not toAGENTS.md("Always test new or modified code" section): per-file ≥ 90 on all four dimensions, justified-ignore policy,coveragevsvalidatesplit — wording adapted from the inspector referenceDependencies
Acceptance
npm run coverageAGENTS.mdstates the rule, and the rule is true on the day it's stated