Skip to content

moooon

Motir

Vibe your whole project. Bring an idea — Motir's three AI layers plan it, track it, and ship it, end to end. You're looking at Motir, built in Motir.

  • Vibe Project
  • Open Source
  • AI Agent
  • AI Loop
1
requests
0
upvotes
145
planned
1,361
shipped

Motir · Work items

MOTIR-2233Done

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.ts rather than a copied list.
  • The zod boundary: no module imports both zod and zod/v4, asserted over the tree.

3. Contract guards coverage percentage cannot see

  • No tool builds structuredContent from a hand-authored object literal or an as unknown as cast.
  • Tool NAMES, tools/list descriptions, 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 content text 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.ts resolves 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 content text are asserted unchanged from their pre-story values.
  • Each contract guard is proven to FAIL when its property is violated.

Context refs

  • Subjects: 11.6.2 · 11.6.3 · 11.6.4 · 11.6.5 · 11.6.6.
  • tests/mcp/tool-coverage.test.ts · tools.test.ts · scopes.test.ts — the shipped MCP-side totality tests to extend rather than duplicate.
  • motir-core/CLAUDE.md § coverage — the ≥90% per-file rule.
  • Story: 11.6.