One Writer, No Lies
Rent the view. Own the truth.
LOCAL the truth
outbox 0 rows
REMOTE the view
record 0 pages
SYSTEM DIAGRAMS
Keep the mechanism in view
The simulation above plays six acts of a two-way sync: naive, then owned, then receipted, then laddered, then dry-run gated. These four diagrams hold that same machinery still, in the order the acts build it. Step through each one with the controls below its frame; the full diagram is always the resting state, and each is linkable on its own for a larger view.
Three protocols, one system
Every field, prose section, and event in this simulation gets one of three write protocols, chosen by its data shape, not by convenience. Structured fields diff to a single changed value and patch only that value, so one declared owner per field removes a whole class of merge conflict. Shared prose keeps its writer's fenced section and falls back through a write ladder when a direct patch will not land. Events queue durably in an outbox, and a record is not considered delivered until its downstream id docks back upstream as a receipt. Data shape chooses the protocol, and the protocol chooses the guarantee.
- Structured fields diff to one changed value and patch only that value; one declared owner per field means there is nothing to merge.
- Shared prose keeps each writer's fenced section, and falls back through the write ladder when a direct patch cannot land.
- Events queue in a durable outbox; a record counts as delivered only once its id docks back upstream as a receipt.
The write ladder
Act 4 climbs this ladder every time a shared-prose section needs an update. It tries the boring outcome first: if the remote text already means the same thing, it writes nothing. Failing that, it swaps just the marker-fenced section, then a full safe replacement guarded by a child-reference check, then an anchor after the page's one unique heading, and finally an append after a verified-unique tail. Every rung is politer than a blind overwrite, and the ladder only descends when the rung above could not land safely. A transport error at any rung triggers a read-back check instead of a retry into the unknown.
- Rung 1: if the remote already matches, the write is a no-op. Zero writes is the preferred outcome.
- Rung 2: a targeted section swap patches only the marker-fenced text, leaving every other writer's content untouched.
- Rung 3: a full safe replacement runs only after a child-reference guard proves nothing owned would be dropped.
- Rung 4: when content-sensitive patching is blocked, insertion anchors after the page's one unique heading.
- Rung 5, the last resort: shrink a verified-unique tail anchor until placement needs no guessing. A transport error triggers a read-back check instead of a blind retry.
The receipt loop
Act 3 is where an event actually delivers. A local outbox row ships with no downstream reference yet; a key check runs before any write; a miss creates the remote page; and the remote id writes back to the local row as the receipt. Before this loop closed, a crash between create and receipt was a live bug: a retry with no durable key check could create a second remote page. After the fix, the retry queries the sync key first, finds the page that already exists, and writes only the missing receipt. Delivery is not done until proof docks upstream.
- A local outbox row ships with no downstream reference yet.
- A key check misses, so the reconciler creates the remote page.
- The remote page id writes back to the local row as its receipt.
- Before the fix: a crash between create and receipt let a retry create a second remote page, because there was no durable key check.
- After the fix: a retry queries the sync key first, finds the existing page, and writes only the missing receipt. Exactly one page.
The orchestration gate
Act 5 is the weekly discipline this simulation is built to defend: dry run first, write only what earns it. Six lanes always run dry, in a fixed order, with zero writes. A gate then asks three questions: was live requested, did the dry run find real drift, and did every lane finish clean. Any no, or any lane that failed or came back partial, stops the run before it writes a byte. Only a clean yes on all three opens phase two: guarded live execution of the approved drifting lanes, each write followed by a read-back or a loud failure.
- Phase 1 always runs dry: six lanes execute in a fixed order, and nothing writes yet.
- The gate asks three questions: was live requested, was drift found, and did every lane pass clean.
- Any no, or any failed or partial lane, stops the run with zero writes.
- Only a clean yes on all three opens phase 2: guarded live execution, each write followed by a read-back or a loud failure.