feat(phase-4): CRDT semantics for convergent multi-agent writes (691 tests green)
Implements the full Phase 4 CRDT primitive library and protocol:
CRDT primitives (muse/core/crdts/): - VectorClock: causal ordering with increment, merge, happens_before, concurrent_with - LWWRegister: last-write-wins scalar with timestamp+author tiebreak - ORSet: observed-remove set with add-wins property and token tracking - RGA: replicated growable array with parent_id-tracked commutative join - AWMap: add-wins key-value map - GCounter: grow-only counter with per-agent slots
Protocol extensions (muse/domain.py): - CRDTSnapshotManifest TypedDict: files + vclock + crdt_state + schema_version - CRDTPlugin @runtime_checkable protocol: crdt_schema(), join(), to_crdt_state(), from_crdt_state()
Schema (muse/core/schema.py): - CRDTDimensionSpec TypedDict: per-dimension CRDT type declaration - CRDTPrimitive literal union: "lww_register" | "or_set" | "rga" | "aw_map" | "g_counter"
Merge engine (muse/core/merge_engine.py): - crdt_join_snapshots(): Phase 4 entry point — always succeeds, no conflicts
Tests (tests/test_crdts.py): - 79 new tests covering all three lattice laws (commutativity, associativity, idempotency) for every CRDT primitive, plus serialisation and merge engine integration
Docs (docs/architecture/supercharge-plan.md): - Phase 4 marked complete; completion checklist added
Verification: mypy zero errors, typing_audit zero violations, 691 tests green
Co-authored-by: Gabriel Cardona <gabriel@tellurstori.com>
Comments
0No comments yet. Be the first to start the discussion.