ADR 0015. Runner: node:test (built in), TypeScript executed natively by Node 26. npm test runs every workspace; npm run check runs typecheck + check-deps + OpenAPI freshness.
| Layer | What | Where / command |
|---|---|---|
| Contracts | codec round trips and fuzzing (only CodecError), schema validation, route-table invariants (every tenant route has a role) |
shared/test (npm test -w @linorahq/shared) |
| Document core | keys properties, apply/validate table per Reject, inverse round trip (byte-identical snapshots), snapshot/structure codec stability, query results, ScanBatch + StructIndex == DocCore verdicts on 100K random batches, perf micro-benchmarks (ns/op, bytes/node) |
packages/doc/test |
| Convergence | N sessions + simulated sequencer (real ScanBatch + StructIndex), random latency/reorder/disconnects and conflict cases; replicas byte-identical to a journal replay; ACK verdicts match client expectations |
packages/sync-client/test (fixed seeds in CI, random nightly) |
| Realtime | upgrade auth, role/scope per frame, dedupe, ack-after-commit with process kill, backpressure (busy, slow_consumer), presence coalescing, revocation |
apps/realtime/test against Docker Postgres |
| API | auth flows, CSRF, PAT scopes, role matrix, foreign-tenant 403/404 for every route, HTTP vs WS op verdict equality, audit entries | apps/api/test against Docker Postgres |
| Doc workers | compaction equivalence (content hash), LRU cap, minSeq, render | apps/docworker/test |
| MCP | handshake, tools/list, scripted e2e against a local stack | apps/mcp/test |
| E2E | two browsers + one MCP agent on one file: edits, cursors, undo isolation, page switching, reconnect | tools/e2e (Playwright) |
| Perf gate | in-app benchmarks (pan/zoom, drag-all, page tour) for 4,000 pages and 5M shapes vs docs/perf/baseline.json (fps within 3%, worst-zoom GPU <= 3.6 ms) + memory report |
npm run bench (reference M4 Pro; CI smoke at 10% tolerance) |
| Load | 100k+ WS clients with the ADR 0020 distribution; p99 op/presence latency, RSS per tier, CPU per thread, validation ns/op, DB rows/s and commit latency, reconnect storm | tools/loadtest (WP-H, Linux) |