Remote / Declared writes
Who owns what
| Part | Package | Owns | Does not |
|---|---|---|---|
| The declaration | foldkit-entity (Write) | what changes, when it makes sense, what it increments or computes | any I/O; it is a value |
| The invariants | foldkit-entity (Entity.invariant) | what every stored row, and every update over the row before, must hold, whoever writes it | who may write; whether this write applies now |
| The rules | foldkit-guard | who may write which row and member, decided over the row being written | the statement; it hands the writer what to check |
| The writer | foldkit-remote-drizzle (writer) | the one update … where that checks and writes; the ledger, when given one | who may write |
| The client | foldkit-remote (Data.mutate) | the operation id; what shows until the answer; refusing at once a write it can already tell is invalid or forbidden; for a durable write, the outbox that sends it | authority: a prediction or a local refusal decides nothing on the server |
The table row is the one authoritative fact. The ledger is not a second copy of it: it records only which operations already landed, so a retry is not applied again. The client's prediction is a display, recomputed from the store each time it is read, and dropped when the answer arrives.
A declared write writes one row by id. A write that spans rows is a handler
(RemoteServer.mutation, guarded by GuardServer.mutation), which checks the
interaction but not what its code writes. A declared write that must survive a
reload or a lost connection can be durable (below); the server still decides
it once, and a refusal is final. Edits that must merge with other devices'
offline edits belong to Sync; see Editing server data through a
journal.