gabriel / muse public
fix patch task/fix-ops-commute-addressed-ops #1 / 1
AI Agent gabriel · 4 days ago · Jun 4, 2026 · Diff

fix: ops_commute handles AddressedInsertOp/AddressedDeleteOp (no position key)

Both op types share op=="insert"/"delete" with InsertOp/DeleteOp but have no position field. ops_commute was doing a["position"] unconditionally, causing KeyError during muse pull when the code domain generated AddressedInsertOps.

Fix: guard with "position" not in a/b before accessing the field. The semantic is: AddressedOps at the same address are a conflict; at different addresses they commute. This matches the Map-CRDT address-keyed commutativity described in the module docstring.

Nine new tests in TestOpsCommuteAddressedOps cover the previously untested paths.

sha256:26e130b630b6a51f141dc4cc495ddfd11a1186ef4407b9530ed1c8ae528cd3ce sha
+14 ~8 symbols
sha256:0859d6df4a76ce54cf1a432aff58fabc4e33c058ed8adab40f10b604e788be81 snapshot
+14
symbols added
~8
symbols modified
0
dead code introduced
Semantic Changes 22 symbols
+ docs/
+ muse/
+ tests/
+ tools/
~ muse/core/op_merge.py .py 1 symbol modified
~ tests/test_op_merge.py .py 14 symbols added, 7 symbols modified
+ TestOpsCommuteAddressedOps class class TestOpsCommuteAddressedOps L650–704
+ test_addressed_delete_and_move_commute method method test_addressed_delete_and_move_commute L684–688
+ test_addressed_deletes_at_different_addresses_commute method method test_addressed_deletes_at_different_addresses_commute L668–671
+ test_addressed_deletes_at_same_address_commute_consensus method method test_addressed_deletes_at_same_address_commute_consensus L673–677
+ test_addressed_insert_and_addressed_delete_different_addresses_commute method method test_addressed_insert_and_addressed_delete_different_addresses_commute L679–682
+ test_addressed_insert_inside_patch_commutes_at_different_addresses method method test_addressed_insert_inside_patch_commutes_at_different_addresses L695–699
+ test_addressed_insert_inside_patch_conflicts_at_same_address method method test_addressed_insert_inside_patch_conflicts_at_same_address L701–704
+ test_addressed_inserts_at_different_addresses_commute method method test_addressed_inserts_at_different_addresses_commute L657–660
+ test_addressed_inserts_at_same_address_do_not_commute method method test_addressed_inserts_at_same_address_do_not_commute L662–666
+ test_move_and_addressed_delete_commute method method test_move_and_addressed_delete_commute L690–693
+ _adel function function _adel L641–642
+ _ains function function _ains L637–638
+ AddressedDeleteOp import import AddressedDeleteOp L20–20
+ AddressedInsertOp import import AddressedInsertOp L20–20
~ MoveOp
← Older Oldest on task/fix-ops-commute-addressed-ops
All commits
Newer → Latest on task/fix-ops-commute-addressed-ops

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:26e130b630b6a51f141dc4cc495ddfd11a1186ef4407b9530ed1c8ae528cd3ce --body "your comment"