Date: 2026-05-29
Time: 14:02
I'll work from the test file content you provided plus the imports to explain the code.
conflict-free-replicated-data-types/crdts.py — The implementation behind all four CRDTs; particularly how OR-Set tracks unique tags per element to achieve add-wins semantics, and how CRDTReplicaGroup.sync_all() achieves full-mesh convergenceconflict-free-replicated-data-types/crdts.py:ORSet.merge — The most complex merge logic; understanding how it unions tags and resolves concurrent add/remove is key to understanding tests 12 and 13conflict-free-replicated-data-types/crdts.py:LWWRegister.merge — How tiebreaking by replica ID is implemented when timestamps match (test 8 depends on this)crdt-semilattice-properties — The mathematical foundation: why commutativity + associativity + idempotency of merge guarantees eventual consistency without coordination (Chapter 5/9 of DDIA)conflict-free-replicated-data-types/testertestcrdts.py — The meta-test layer; understanding what it validates about the test suite itselfcrdt-tests-cover-20-scenarios — The test suite is organized into exactly 20 numbered scenarios, each in its own test class, covering all four CRDT types plus the replica group harnessorset-add-wins-semantics — OR-Set uses add-wins conflict resolution: a concurrent add and remove of the same element always resolves to the element being present, because remove only tombstones locally-observed tagslww-tiebreak-by-replica-id — When two LWW-Register writes have identical timestamps, the lexicographically higher replica ID wins deterministicallypncounter-composed-of-two-gcounters — PNCounter state is structured as two sub-counters (p for increments, n for decrements), confirming the standard "positive minus negative" decompositioncrdt-merge-returns-self — merge() mutates and returns self (enabling chaining like deepcopy(a).merge(b)), rather than returning a new instance