11.6.7 Story vitest gate — coverage floor, the DTO→schema→payload seams, and the guards the alignment owes
The story's per-repo coverage + integration gate, run over the merged surface. It does not enumerate cases up front — each code card ships its own units, and this measures what they actually left.
1. Coverage floor
Run coverage over the story's changed surface and, wherever a file is under the gate (per-file ≥90% branches / functions / lines), write the missing unit and BRANCH tests. New modules — the seam, the exemption registry, the derived-set computation — get explicit threshold entries; an unnamed new file is an ungated one.
2. Integration SEAMS the units mock away
- DTO → schema → payload, per resource: take a real DTO from a real service call against real Postgres, run it through the shared schema, and assert the payload. A fixture written to match the schema proves the schema matches itself.
- The narrowings: for each declared subset, assert it is a genuine derivation — changing the base shape incompatibly breaks it, rather than leaving a look-alike compiling.
- The exemption registry against the tool registry: every registered tool resolves to derived-or-exempt, driven off
lib/mcp/registry.tsrather than a copied list. - The zod boundary: no module imports both
zodandzod/v4, asserted over the tree.
3. Contract guards coverage percentage cannot see
- No tool builds
structuredContentfrom a hand-authored object literal or anas unknown ascast. - Tool NAMES,
tools/listdescriptions, argument shapes and scopes are byte-identical to their pre-story values — the freedom this story promised to leave alone, asserted rather than trusted. - The human-readable
contenttext block of each tool is unchanged.
Scope BOUNDARY
Ends at lib/mcp's and the shared schema layer's suites. It does NOT re-test /api/v1 route behaviour (11.2/11.3's gates own it) and does NOT duplicate 11.6.6's drift guard — that ships as product code; this covers the seams around it. It does NOT drive both live surfaces end to end (11.6.8). It changes no product code: a coverage gap only closable by making a branch reachable is a finding to report, not a refactor to slip in.
Acceptance criteria
- Every new and modified file meets the per-file ≥90% floor and has an explicit threshold entry.
- Each shared resource has a DTO→schema→payload seam test driven from a real service call against real Postgres.
- Every declared narrowing is proven to be a derivation, by a fixture that breaks it via the base shape.
- Every tool in
lib/mcp/registry.tsresolves to derived-or-exempt, driven off the registry. - No module imports both zod entrypoints — asserted over the tree, not per file.
- Tool names, descriptions, argument shapes, scopes and
contenttext are asserted unchanged from their pre-story values. - Each contract guard is proven to FAIL when its property is violated.