Skip to content

Fix v8 coverage path resolution so per-file gate enforces core/ files #1301

Closed

Description

@cliffhall

Background

clients/web/vite.config.ts already lists '../../core/mcp/**/*.{ts,tsx}' and (since #1300) '../../core/react/**/*.{ts,tsx}' in coverage.include. After running npm run test:coverage, however, coverage/coverage-summary.json contains no entries for any file outside clients/web/src/ — only src/components/** and src/utils/** show up.

This means the per-file 90% / 85% / 80% / 50% threshold gate in AGENTS.md is silently not enforced for anything under core/. The condition predates #1300 — it already applied to:

After #1300 it also applies to the entire ported hook layer:

  • 14 hooks in core/react/
  • 13 state stores in core/mcp/state/
  • core/mcp/inspectorClientProtocol.ts, inspectorClientEventTarget.ts, typedEventTarget.ts, samplingCreateMessage.ts, sessionStorage.ts
  • core/mcp/__tests__/fakeInspectorClient.ts

Tests for every one of these files exist and pass; the gate just isn't checking them.

Likely cause

coverage.include is configured with a relative glob (../../core/...) that walks above the project root. v8's coverage collector probably normalizes paths against the project root and drops the resulting ..-prefixed entries before the reporter sees them. There may be a coverage.all / root / include interaction with vitest projects that strips these paths.

Acceptance criteria

  • npm run test:coverage emits per-file coverage rows for every .ts / .tsx file under core/mcp/ and core/react/ that isn't excluded by the existing exclude list.
  • The per-file threshold gate (perFile: true, lines ≥ 90, statements ≥ 85, functions ≥ 80, branches ≥ 50) is honored for those files — i.e. introducing an untested core file fails CI.
  • If any current core file falls below the gate when measured, raise its coverage or strike it from the include list with a comment explaining why.
  • coverage-summary.json keys include /Users/.../core/mcp/... and /Users/.../core/react/... paths.

Out of scope

  • Restructuring the project layout to move core/ inside clients/web/.
  • Adding workspaces.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

v2

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions