Sync protocol & write-path atomicity
A mutation either lands in full — five rows, one transaction — or it never happened. The audit log alone reconstructs final state. This is the contract every surface inherits.
01 The invariant
Content mutations flow through ctx.transact(doc_id, fn). The dispatcher persists the Y.Doc update, the audit entry, and the outbox event inside a single write-path transaction. If any step throws, the resident Y.Doc is evicted and nothing commits.
02 Crash-fuzz sweep
We sweep every in-transaction query position across cold and warm paths — 32 cases — asserting the commit is all-or-none. The reject arm verifies document visibility is unchanged and the error-audit survives in a separate transaction.
03 Why it matters
Humans and agents write to the same document concurrently. Atomicity is what lets an agent's tracked suggestion and a human's accept resolve to one convergent state — with a perfect audit trail for both principals.