Learn / Events, folds and gates
Message allowlists, authorization rules, and laws
Declaring a MessageSet restricts which kinds of change a caller can ask for:
- A Sync replica rejects any Message outside
durable. - An AI agent can send only the Messages exposed in its capability set (Agents).
- A client cannot originate a Message marked
serverOnly.
If your union contains no Message that deletes an audit record, neither a view nor an agent can delete one. The only bypass is structural installation (checkpoints or URL restoration) through declared infrastructure seams; see the two write paths.
An allowlist alone still lets invalid states pass. Decide between authorize and laws (or Entity.invariant for Remote rows) by what they check:
authorizechecks one Message before it runs. A durable Message with no entry inauthorizepasses authorization by default. Whenever you add a new durable Message, check whether existingauthorizerules should apply to it too.lawscheck every Message after it runs. BecauseatMost100Todosinspectsafter.todos.length, adding anImportedTodosMessage later is automatically held to the 100-item cap.Entity.invariantchecks every row write. On database-backed Entities, invariants run on everyWriteregardless of which mutation triggered it; see What every row holds.
Rules run once at admission
A Message is checked when the server admits it to the journal. Once committed, it is a historical fact:
- Replicas never re-run
authorizeduring replay. - Tightening an
authorizerule orlawlater applies to new submissions without invalidating past snapshots. - On database rows, an existing row that predates a new
invariantis judged by the row the next write leaves behind, allowing a repair write to succeed.