Remote / Declared writes

How one row version decides everything

Every declared write passes through three checks on one version of the row:

  1. Authorization (Forbidden): foldkit-guard reads the row at revision r and checks write rules.
  2. Statement commit: The writer executes update ... set ..., revision = revision + 1 where id = ? and revision = r and <when> and <invariants>.
  3. 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.