Entity / Laws
Asking before sending: Data.can
Data.can reads the same rules over rows already held in your Model and predicts—purely in memory—whether a declared write would succeed:
ts
const Data = Remote.make({
model: ShopApp.model.remote,
entities: [Product],
mutations: [Publish, Release, Restock],
})
Data.can({ remote: Remote.initial }, Release, { id: 'p1', status: 'published' })
// Can.Undecided: Product p1 is not heldData.can returns Can.Yes, Can.No({ refusal }), or Can.Undecided({ reasons }). Use it as a UI hint (for example, to disable a button). Data.mutate still sends writes when invoked because local rows can be stale or missing fields. See Asking before sending and Agent capabilities over declared writes.
Who owns the final decision
| Component | Authoritative decision | Early hint only |
|---|---|---|
Server writer (foldkit-remote-drizzle) | Every Entity refusal on commit | — |
Sync journal (foldkit-durable) | Document laws on commit | Replica's LawBrokenError |
| SQL database | State invariants via CHECK | Transition invariants (omitted from DDL) |
Remote client (Data.mutate, Data.can) | — | Held Forbidden, Invalid, and Unmet |
| Forms and CRUD | — | Input-complete invariants by path |