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 undecided

Each status in the report tells you whether a pair or state transition is settled or needs a fix:

ResultMeaningNext step
keptProved safe by footprint, bounds, or casesNone; emits Enumerated or Bounded
refused (pair)Found valid state + input breaking ruleBound input, narrow from, or mark runtimeOnly
undecidedUses text, links, or unknown-vs-unknownCover with Walk, Scenario, or runtimeOnly
unmeetableNo valid row matches from + whenFix contradictory precondition
holdsbecomes proved at declaration timeNone
enforcedbecomes enforced by commit postconditionNone (Data.can checks it too)
undeclaredWrite moves state without becomesAdd from/becomes or narrow write
refused (arrow)Transition always breaks an invariantExpected if forbidden; else fix rule/write
unreachedNo declared write enters this stateAdd creating write, or note SQL seed
terminalNo declared write leaves this stateExpected if final; else add transition
  • Non-declared writes: Operations outside Write (imports or commands) declare a Footprint (or Footprint.unknown, which marks all invariants undecided).
  • Checked-in reports: npx foldkit-plus laws src/laws.ts#report prints the report so teams can check diffs into examples/writes/LAWS.md.