Sync / Replicated state
One edit, end to end
With all four pieces in place, this is the path a single CreatedTodo takes:
view dispatches CreatedTodo
|
v
update applies it; the Model shows it visible
|
v
the mount's Command submits it: replayed, given an id, saved
saved to the outbox
|
v
replica.start exchanges: cursor + pending → server
|
v
server: validate, authorize, reduce, assign sequence, committed
persist; answer with the tail, acks, rejections
|
v
replica: advance the base, drop settled edits,
replay the rest; the mount re-installs the sliceThree layers carry the edit, and it helps to keep their names apart. The
Message is the application's meaning, CreatedTodo({ id, title }). The
operation is that Message encoded inside Sync's envelope (document, replica,
local sequence, a stable opId, the cursor the replica knew), which is what
the outbox holds and the wire carries. The committed operation is the same
plus the server's sequence and the actor it trusts. Sync adds the envelopes;
the Message stays the vocabulary.