MotirBuilding in public
MOTIR · moooon
onMotir
You’re viewing a public project. Anyone can view it — no account needed. Sign in to submit, upvote, or comment on requests.View-only — you can’t edit work items
Back to roadmap
Blocked

Vitest gate (motir-core) — coverage floor over the moved surface, the host/origin seams, and a guard that every app/(public) segment has a declared host

Sub-taskopened by Zhu YueMOTIR-3885

Type: test · Executor: coding_agent · Repo: motir-core · ONE PR. The story's per-repo coverage + integration gate, run after its code cards merge because it measures their real, merged output.

It is not a static list of cases. It does three jobs at run time.

1 — Coverage floor

Run coverage over the surface this story changed — the ported landing and its components, the split origin resolver, the host-aware robots.ts and sitemap.ts, the root route's four cells, and the redirect layer — and write whatever is missing to reach the project's ≥90% per-file branch/function/line gate. Each code card ships its own units; this tops up the seams BETWEEN them.

⚠️ Sort the report before writing a bullet. A zero measures execution, not reachability. Defensive arms (an ?? fallback, an unreachable default:) are usually uncovered because they cannot fire; rule-bearing arms (a host branch, a session branch, a redirect predicate) are the opposite. Read the verdict off the PRODUCER — for a host branch, off whatever supplies the host — and where an arm is genuinely dead, assert the INVARIANT that makes it dead and cite that test by name in the ignore directive. An ignore directive with no test to cite hides the gap.

2 — The integration seams the units mock

These are the writer→consumer joins this story creates, and each is a place two cards agreed on a contract in prose:

  • origin resolver → every absolute-URL emitter. Drive the real resolved public origin through the real canonical, og:url, JSON-LD @id and sitemap builders and assert the emitted strings — the key-drift class a unit with a stubbed origin cannot see.
  • app/(authed)/ filesystem → the robots disallow list. The derivation and the file that consumes it, together, against the real tree.
  • the services → the host-partitioned sitemap. Real Postgres, real publicProjectsService / projectTagsService / legalDocumentSlugs / lib/apiDocs/surfaces, asserting each URL lands in the sitemap of the host that actually serves it.
  • redirect layer → proxy.ts matcher. A redirected path is covered by the matcher, and a path deliberately NOT redirected (/p/*, /admin) is not.

3 — Architecture and contract guards, which coverage cannot see

  • Exactly one module reads each origin variable — extend the seam guard tests/hosting/appUrlSeam.test.ts already establishes, over both variables.
  • /p/* still resolves on the application host and still carries application-host canonicals — the story-boundary assertion, as a guard rather than an intention.
  • The session cookie's scope is unchanged — no Domain attribute widened; asserted against the real Better-Auth configuration, not a comment.
  • The public routes stay session-free. /explore, /docs and /legal acquire no getSession() call in the move — a filesystem-and-AST guard in the shape of the existing meta-guards, so the property survives the next author rather than this one.

⚠️ Scaffold check, run at plan time and again before writing

Real Postgres, through the shipped test-database harness; no vi.mock of the database. The host branch is read from a request, so it is drivable per test — but verify that before writing against it: a subject gated by a process-wide server-side env read has no per-test override, and a guard written against one passes on unfixed code and stays green for ever.

Acceptance criteria

  • The coverage gate passes at the project floor for every file this story added or changed, with each ignore directive citing the invariant test that justifies it.
  • All four integration seams in §2 have a test that drives the real producer into the real consumer.
  • All four guards in §3 exist and fail when the property is violated — demonstrated by a deliberate local break, recorded in the PR.
  • No test asserts a behaviour whose implementing symbol is absent; every assertion maps to a shipped symbol.
  • The suite is green on real Postgres in CI, and adds no new flake to the lane.

Context refs

  • motir-core/CLAUDE.md § coverage — the ≥90% per-file floor
  • motir-core/tests/hosting/appUrlSeam.test.ts · tests/navigation/proxy-matcher.test.ts · tests/baseUrl.test.ts — the guards this extends
  • motir-core/tests/helpers/ — the database harness and fixture conventions
  • The four code cards this is blocked_by — their merged output is what this measures

Comments (0)

No comments yet — be the first to weigh in.

Sign in to comment

Reading is open to everyone; posting needs a Motir account.

Sign in