(motir-core) Story gate — vitest coverage floor, the writer to consumer seams, and the crash-recovery guarantees a percentage cannot see
The story's per-repo vitest gate. It runs AFTER the story's code subtasks merge, because it measures their real merged coverage and tests the seams BETWEEN them — neither is knowable before they land.
It does three things, and none of them is a pre-enumerated list of cases.
1 — Coverage floor
Run coverage over the story's changed surface (lib/jobs/** and whatever the engine added) and, wherever it is below the project's per-file gate (>=90% branch / function / line), write the missing unit and branch tests to reach it. Each subtask ships its own units as the floor; this tops up what falls between them.
2 — Integration seams
The writer-to-consumer paths the unit tests mock. Concretely, for this story: an event emitted through sendEvent traversing the real dispatcher into a real job_queue row and out through a real worker claim into the handler — not a fake at either end. A key that drifts between the dispatcher's write and the worker's read is exactly what unit tests on both sides individually pass while the pair is broken.
3 — Architecture and crash guards — what a percentage cannot see
- Two workers never execute one
job_queuerow. Genuine concurrency against a real Postgres, accepting every legitimate interleaving. - A run resumes correctly after the worker is killed mid-step — the memoized steps are not re-executed, the un-memoized ones are.
- The engine stays behind the seam: nothing outside
lib/jobs/**imports the queue library directly, mirroring the existing ESLint boundary for Inngest. An import-boundary assertion, not a convention. - A job absent from the cutover configuration still routes to Inngest — the guard protecting the 23 jobs this story does not move.
Real Postgres throughout, never mocks.
Acceptance criteria
- Coverage over the story's changed surface meets the project's per-file gate, with the gaps filled rather than the threshold lowered.
- The dispatcher-to-worker seam is exercised end to end with no fake on either side.
- The concurrency, crash-resume, import-boundary and default-routing guards above each exist and each fails when its property is broken — demonstrated by breaking it, not asserted.
- The suite runs in CI on the standard lane and needs no bespoke harness.
Context refs
vitest.config.ts— the coverageincludeset and the per-file thresholdstests/jobs/— the existing job suites and their real-Postgres helperstests/helpers/db.ts— truncation between testseslint.config.mjs— the import boundary this mirrors