Principles that only live in prose do not survive agent throughput. Every row here names a check. Each spec that establishes an invariant adds its checker in the same change.
Not every check below exists yet, and the
pnpm lint:invariantsentry point that would run them together is itself still planned — the first spec that needs it introduces it. Until then the checks that do exist run underpnpm typecheck,pnpm testandpnpm lint. Treat a row whose check is not yet implemented as a debt marker, not as enforcement.Row 8 landed with SPEC-0002 (#880); rows 9–10 are reserved by the SPEC-0003 B1 / SPEC-0010 stack (#884, #886) and land with it. SPEC-0014 adds row 11.
| # | Invariant | Check | Runs | Established by |
|---|---|---|---|---|
| 1 | The frontend imports only @adt/types |
apps/studio/tsconfig.json references only packages/types, and its package.json declares only @adt/types — a direct import of any other package fails pnpm typecheck |
every PR | existing |
| 2 | No unconditional clear* / DELETE of user-touched entities |
storage-layer test + lint rule banning new call sites | every PR | SPEC-0001 |
| 3 | Sections and quizzes are created only via the ID factories | unit test over every creation path | every PR | SPEC-0008 (#834) |
| 4 | PIPELINE is the single source of stage/step truth |
CI check: generated DAG section in ARCHITECTURE.md matches code | every PR | existing |
| 5 | Downstream input comparison; preserve protected work/history; scoped publication; visible warnings and Core TTS text fallback; skip is temporary and pruning persists | catalog execution/freshness, scoped speech, retained catalog, immutable asset and history tests; AC-1–16 evidence; human approval remains pending | pnpm test; Studio walkthrough and packaging checks before rollout |
SPEC-0001 |
| 6 | Prompt output contracts | validator suite per prompt (page sectioning exists; extend) | every PR | SPEC-0003, SPEC-0004 |
| 7 | No provider key in logs or model-call records | log scrubber test + grep in CI | every PR | security chain (Block 1) |
| 8 | Manual and unknown-authorship units survive ordinary own-stage and upstream runs; guarded saves reject stale versions; replacement retires identities only on successful publication | apps/api/src/routes/manual-edit-survival.test.ts, packages/pipeline/src/__tests__/catalog-execution.test.ts, Studio draft conflict tests |
pnpm test; human UI/release verification remains separate |
SPEC-0002 (owner-approved with explicit deferrals; independent PR approval pending) |
| 9 | B1 generation preferences preserve content; admission revalidates at every execution boundary; explicit reset retains history; ordinary Storyboard publishes safe page pairs with honest coverage | apps/api/src/services/sectioning-lifecycle.test.ts, sectioning-preflight-runners.test.ts, sectioning-existing-book.test.ts, apps/api/src/services/storyboard-publication.test.ts, and packages/storage/src/__tests__/sectioning-book-writer.test.ts under pnpm test |
every PR | SPEC-0003 B1 implementation (review pending) |
| 10 | Historical tuples cannot be edited arbitrarily. Extract's node history is deleted only by a confirmed, content-bound Extract Retry or Replace on an Extract-only book (SPEC-0003 RAC-20–23). Explicit physical repair restores only verified exact bytes with continuous tuple proof, a transaction-scoped permit, immutable damage audit and a fresh selected version. Lost continuity cannot be recreated as proof. | packages/storage/src/__tests__/history-recovery.test.ts checks exact bytes, audit, stale requests, SQL overwrite/tuple reuse refusal and lost tracking; sectioning-reset-crash.test.ts checks real reset rollback/crash boundaries; the Extract-only predicate and re-run route tests (RAC-20–23, planned in #1214) check the deletion exception |
pnpm test |
SPEC-0003 approved recovery exception; PR approval pending; Extract re-run exception proposed in #1215 |
| 11 | Per-element authored content (element-audio) is never cleared or deleted |
source scan over apps/api/src/** and the pipeline clear lists (getStageRerunClearNodes, IMAGE_SET_CHANGE_CLEAR_NODE_TYPES) asserting "element-audio" appears in none of them, plus deletePage / clearExtractedData and storage tests per preserved path |
every PR | SPEC-0014 |