Core Laws
Every replica must converge under reordering, duplication, and delay. We track this with three constraints: commutativity, associativity, and idempotence.
merge(a, b) = merge(b, a)
merge(a, merge(b, c)) = merge(merge(a, b), c)
merge(a, a) = a
Interpretation: the merge function is a join in a semilattice; every state moves upward.
Observation Surfaces
State view: materialized snapshot per replica.
Delta view: only changes, with delivery guarantees.
Audit view: causal history and vector clock checks.
User view: reconciled interface projection.
Failure Modes
Most issues are not inconsistency, but mismatched expectations about visibility and causal order. Mark the boundary conditions.
Surface the divergence window; do not mask it with animation.
Convergence should be observable as a countdown, not a surprise.
Audit merges with content-addressed checkpoints.
Spec Console Hooks
Expose the lattice height, merge frequency, and unresolved deltas as live panels.
metrics: { merge_rate, height, pending_deltas }
probe: /api/crdt/status
trace: { op_id, actor, seen, applied_at }