Vitest gate (motir-marketing) — the /p/* coverage floor, the public-API seam, and the standing no-database-client rule
Opened by Zhu Yue ·
The story's motir-marketing suite gate — the second half of the per-repo split. It runs after this story's five motir-marketing page cards merge and measures their real, merged result.
1 · Coverage floor over the /p/* surface this story added — app/p/** and lib/publicProject.ts — filling whatever the per-card units left between them. This repository's suite is jsdom + node with no database, so it is fast and there is no excuse for a thin one.
2 · The seam the units mock: the public-API client. Every page here reads through one module, and every unit test of a page mocks it. So the seam nothing covers is the module against the shapes motir-core actually returns: drive recorded real responses from the public contract through lib/publicProject.ts and out to the components' props, including the cursor round trip. A key that drifts between the served document and the DTO restated in this repository is exactly the failure public-surface-hosts.md §8 cost 2 names, and it is invisible to a mock that was written from the same assumption as the code.
3 · The guarantees coverage cannot see.
- The standing no-database rule.
lib/explore.tsstates it — "this repository does NOT read the database … No database client (the standing repo rule, asserted by a test)". Find that assertion, and make sure it reachesapp/p/**andlib/publicProject.tstoo rather than only the surfaces it was written for. - Origins do not cross. Every canonical,
og:urland JSON-LD@idon a/p/*page namesSITE_ORIGIN; every API read namesAPP_ORIGIN. Getting these the wrong way round is silent in production and is precisely whatlib/siteOrigin.ts's header warns about. - The error state is reachable. With the public API unreachable, every
/p/*route renders its error state rather than throwing — asserted per route, since this is the state that only exists because the renderer and the data are now in different deployments.
Do not re-assert what the page cards already ship, and do not duplicate the E2E: this is a suite, not a browser. Its residue is the seam, the guards, and the coverage top-up.
Acceptance criteria
- Coverage over
app/p/**andlib/publicProject.tsmeets this repository's floor, with the gaps filled here. - A seam test drives recorded real public-API responses through the data module to the rendered output for each
/p/*route, cursor paging included, and fails on a key drift. - The no-database-client assertion covers the new files; a deliberate
@prisma/clientimport anywhere underapp/p/**turns the suite red. - A test asserts
SITE_ORIGINfor every canonical /og:url/ JSON-LD@idon/p/*, andAPP_ORIGINfor every API read. - Every
/p/*route renders its error state — not an exception — when the public API is unreachable, asserted per route. - The suite runs in the existing
testjob with no new CI job, andpnpm teststays a seconds-long run. - No file outside
motir-marketingis touched.
Context refs
motir-marketing/vitest.config.mts·tests/setup.ts— the harnessmotir-marketing/tests/explore/·tests/legal/— the closest precedents for testing a surface fed by the public APImotir-marketing/tests/appOrigin.test.ts·tests/siteOrigin.test.ts·tests/destinations.test.ts— the origin assertions to extendmotir-marketing/lib/explore.ts— the standing no-database rule and where it is assertedmotir-core/app/api/openapi/public.json/route.ts— the served contract the recorded fixtures must come frommotir-core/docs/decisions/public-surface-hosts.md§8 costs 1 and 2
Discussion
No comments yet.
Adding to this discussion signs you in on app.motir.co and brings you back to this request.