Entity / Laws
Laws: where does a rule go
When a business rule lives in two places—once in a database check and again in a form or click handler—one copy inevitably drifts. "A published product stays published", "reserved stock never exceeds stock on hand", and "only the owner may rename a product" each belong in a single declarative law owned by whoever controls that state.
In Foldkit Plus, those declarations sit in foldkit-entity (field shapes, invariants, preconditions, and states), foldkit-guard (authorization rules), and foldkit-sync (shared document laws). The server writer, database CHECK constraints, client pre-checks, and forms all read the same declaration. Before running a database, Laws.check analyzes every declared write against every invariant and reports which rules hold and which still need enforcement.