MOTIR-4223Blocked
Vitest gate (motir-core) — the address store and services, the certificates adapter and job, the host-resolution contract, and the widened CORS / return-target
The story-level Vitest gate for motir-core — a coverage floor over the ten code cards' merged surface, the seams between them that their own units mock away, and the architecture guards coverage cannot see. It runs LAST among the motir-core cards (blocked_by every one of them) because it measures what actually merged; it does not pre-enumerate what those cards should have tested — "already covered by the per-subtask floor" is the expected normal it resolves at run time.
What it does at run time
- Coverage floor —
vitest --coverageover the changed surface:lib/publicAddresses/**,lib/repositories/publicAddressRepository.ts,lib/services/publicSubdomainService.ts·customDomainService.ts·publicAddressesService.ts· theentitlementsServiceaddition,lib/jobs/definitions/publicAddressCertificateRefresh.ts,app/api/public/hosts/**,app/api/workspaces/[workspaceId]/public-subdomain/**,app/api/projects/[key]/public-addresses/**,lib/publicProjects/cors.ts·returnTarget.ts, and the two pane components. Wherever a file is under the project's per-file floor (≥90 % —CLAUDE.md§ coverage), write the missing unit / branch tests. - Integration seams, real Postgres — the writer → consumer paths the units mock: (a) claim a subdomain through the service →
GET /api/public/hosts/{host}resolves it, rename it → the old host resolves as an alias withredirectTo; (b) add a custom domain → verify with a stubbed resolver and port → the status job (with the port stubbed to issued) → the lifecycle'slistshowsissued→makePrimary→ the subject DTO'saddresses.primaryis that host andGET /api/public/projectsreports itsprimaryHost; (c) the entitlement cap inside the lifecycle's transaction under real concurrency; (d) CORS and the hand-off return target for a host that the store says is live, and for one it says is an alias. - Architecture / contract guards — the Fly-adapter dependency guard and the tenant-domain single-reader guard exist (assert they RUN in CI, not merely exist);
pg_policiesforpublic_address; cross-tenant isolation: workspace A's admin cannot read or write workspace B's subdomain or a project's addresses in B through any of the new routes (404, no existence leak); the public host route answers identically with and without a session cookie (anonymous by construction); the four public-surface guard tests cover the new operation with no exemption; everyRecord<PublicAddressStatus, …>andRecord<EntitlementKind, …>in the tree is total (typecheck is the proof — assert the build ran).
Acceptance criteria
- Every file in the changed surface meets the per-file floor after this card, with the coverage report attached to the PR.
- Seams (a)–(d) exist as real-Postgres tests driving real service and route code with only the platform port and the DNS resolver stubbed; (c) is genuinely concurrent.
- The cross-tenant isolation test proves a
404for every new route addressed at another workspace's or project's resources, and the anonymous-posture assertion holds for the host route. - No production code changes except test helpers; no file outside
motir-coreis touched.
Context refs
motir-core/CLAUDE.md§ coverage · § E2E discipline;tests/api/public/(the four guard suites) ·tests/ciFleet/orchestratorPortBoundary.test.ts·tests/hosting/appUrlSeam.test.ts— the guards this re-asserts- Every
motir-corecard of this story: store · subdomain service · adapter · entitlement · lifecycle · job · host contract · CORS / return · pane 1 · pane 2 - MOTIR-4120 — the previous story's gate for this repository