MOTIR-4037Done
Story-level vitest — coverage floor, integration seams, and the single-reader/architecture guards (both arms)
Opened by Zhu Yue ·
The story's mandatory coverage + integration + guard gate, run AFTER the feature subtasks merge. Three jobs at run time:
- Coverage floor — run coverage over the story's changed surface and, wherever below the ≥90% branch/fn/line floor, write the missing unit/branch tests.
- Integration seams — drive the gate's real output through its consumers over real Postgres: a public route with
MOTIR_CLOUDunset → 404 and set → 200 (both arms);setAccessLevelrejectingpublicwhile acceptingopen/limited/private. - Architecture / contract guards — the guarantees coverage cannot see: the single-reader rule project-wide (no non-billing caller of
isCloudBilling(),MOTIR_CLOUDread only throughisCloud()), and no rawprocess.env['MOTIR_CLOUD']read outside the named predicate.
Acceptance criteria
- Coverage ≥90% branch/fn/line on every file the story's subtasks touched; missing tests written to reach it.
- Integration seams: the gate's real behaviour driven end-to-end with real Postgres, both arms (
MOTIR_CLOUDunset and set). - Architecture guards: single-reader asserted project-wide; no
process.env['MOTIR_CLOUD']read outsidelib/billing/availability.ts.
Context refs
lib/billing/availability.ts— the predicateapp/api/public/— the gated routeslib/services/projectMembersService.ts·app/api/projects/[key]/access/route.ts— the publish path
Discussion
No comments yet.
Adding to this discussion signs you in on app.motir.co and brings you back to this request.