Entity / Laws
Reading Laws.check findings and repairs
Running Laws.check across [Publish, Release, Restock] checks every (write, invariant) pair and every state transition:
ts
const multiReport = Laws.check({ writes: [Publish, Release, Restock] })
Laws.show(multiReport)output
Product
Draft -> Published Publish undeclared
Draft -> Published Release holds
Draft unreached
Published terminal
Publish x reservedWithinStock kept: writes no member it reads
Release x reservedWithinStock kept: writes no member it reads
Restock x reservedWithinStock refused: Reserved stock cannot exceed the stock
before reserved: 0, stock: 0
input quantity: -1
after reserved: 0, stock: -1
1 entity, 2 states, 3 writes, 1 rule: 3 pairs, 2 kept, 1 refused, 0 undecidedEach status in the report tells you whether a pair or state transition is settled or needs a fix:
| Result | Meaning | Next step |
|---|---|---|
kept | Proved safe by footprint, bounds, or cases | None; emits Enumerated or Bounded |
refused (pair) | Found valid state + input breaking rule | Bound input, narrow from, or mark runtimeOnly |
undecided | Uses text, links, or unknown-vs-unknown | Cover with Walk, Scenario, or runtimeOnly |
unmeetable | No valid row matches from + when | Fix contradictory precondition |
holds | becomes proved at declaration time | None |
enforced | becomes enforced by commit postcondition | None (Data.can checks it too) |
undeclared | Write moves state without becomes | Add from/becomes or narrow write |
refused (arrow) | Transition always breaks an invariant | Expected if forbidden; else fix rule/write |
unreached | No declared write enters this state | Add creating write, or note SQL seed |
terminal | No declared write leaves this state | Expected if final; else add transition |
- Non-declared writes: Operations outside
Write(imports or commands) declare aFootprint(orFootprint.unknown, which marks all invariantsundecided). - Checked-in reports:
npx foldkit-plus laws src/laws.ts#reportprints the report so teams can check diffs intoexamples/writes/LAWS.md.