Remote / Declared writes
How one row version decides everything
Every declared write passes through three checks on one version of the row:
- Authorization (
Forbidden):foldkit-guardreads the row at revisionrand checks write rules. - Statement commit: The writer executes
update ... set ..., revision = revision + 1 where id = ? and revision = r and <when> and <invariants>. - Refusal classification: If no row changed, a follow-up check reports whether the row disappeared, moved past revision
r(Conflict), failed<when>(Unmet), or broke an invariant (Invalid).
On the client, any read of the row combines the committed row with pending set fields and pending increment/decrement amounts (committed + pending sets + pending increments), recomputed on read.