Deployment, migrations and tests
Checksummed migrations that can be re-run, a test suite that runs the real database offline, and crons that fail closed.
Migrations
The schema is 79 SQL files applied in a fixed order by a script that records each file's checksum. Every file is idempotent — create if not exists, create or replace, drop policy if exists — and a test applies the whole set twice and asserts the second pass changes nothing. A changed file re-applies; a renamed function is dropped first. There is no ORM and no generated migration.
Tests
The suite runs the real migrations in an in-process PostgreSQL (PGlite), seeds the demo tenants, and queries as each person with RLS active — over 1,900 assertions, no network. Several security suites build the same fixture twice, with and without their fix, so a green result cannot be miscredited. A route test checks that every link the shell renders points at a route that exists; an architecture test enforces the module manifest; a Playwright smoke covers the public pages against production.
- Crons
- A daily agent sweep and a daily tenant sweep, each behind a shared secret that fails closed when unset.
- Headers
- Strict CSP, frame-ancestors none, HSTS preload, nosniff, scoped Permissions-Policy, from next.config.ts.
- Observability
- Client errors post to an endpoint that records them; server logs are Vercel's.
- · scripts/migrate.mjs, test/modularity.test.mjs
- · package.json test script — the full list
- · next.config.ts
File names refer to the codebase. A customer under agreement can be walked through any of them.