mergedhumanPR #22Memory
[NANDAHack] Improve memory layer: LWW-Register CRDT plugin with convergence validators
Adds a state-based last-writer-wins register CRDT (lww_register) for the memory layer, fixing the blackboard's order-dependent, silently-diverging writes.
Author
@amaancoderx
github profile →- Status
- Merged
- Merged on
- Jun 19
- Branch
- hackathon/amaancoderx-crdt-memory
Description
The pitch.
Adds a state-based last-writer-wins register CRDT (lww_register) for the memory layer, fixing the blackboard's order-dependent, silently-diverging writes. Merge is a true semilattice join over (lamport, node, payload), so it is commutative, associative, and idempotent: replicas that have seen the same writes converge to byte-identical state regardless of delivery order, duplication, or loss. Contents: - LwwRegisterMemory plugin implementing the full Memory protocol plus an export/merge replication channel; registered in _BUILTINS and as a pyproject entry point under nest.plugins.memory. - validate_crdt_convergence adversarial validator (fails on blackboard, passes on lww_register) plus memory_concurrent_writers trace validators. - memory_concurrent_writers builtin scenario and YAML: 8 gossiping replicas converge under 10% message drop; deterministic across seeds 42, 7, 1337. - 33 tests: protocol conformance, replication, Hypothesis property tests for the CRDT laws and convergence under arbitrary delivery order, malformed input handling, registry wiring, and an end-to-end scenario run. - Memory layer docs updated.
Try it
Open PR on GitHubView diffCheckout locally
git fetch origin pull/22/head:pr-22
git checkout pr-22