From 3810450c20326998aef17c0acfcd5893e7b3ca20 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Wed, 31 Dec 2025 15:46:41 +0900 Subject: feat(crdt): replace LWW conflict resolution with Automerge merge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ConflictResolver now defaults to CRDT strategy which uses Automerge to merge local and server documents during sync conflicts. This provides conflict-free resolution that preserves changes from both sides. Key changes: - Add CRDT merge methods for all entity types (deck, card, note, etc.) - Update resolve methods to accept optional CRDT binary data - Fall back to server_wins when CRDT data is unavailable or invalid - Add comprehensive tests for CRDT conflict resolution scenarios 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/client/sync/push.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/client/sync/push.test.ts') diff --git a/src/client/sync/push.test.ts b/src/client/sync/push.test.ts index bce4652..19b39da 100644 --- a/src/client/sync/push.test.ts +++ b/src/client/sync/push.test.ts @@ -1140,7 +1140,10 @@ describe("generateCrdtChanges", () => { expect(crdtChanges[0]?.documentId).toBe("deck:deck-1"); expect(crdtChanges[0]?.binary).toBeDefined(); // Verify it's valid base64 - expect(() => base64ToBinary(crdtChanges[0]!.binary)).not.toThrow(); + const binary = crdtChanges[0]?.binary; + if (binary) { + expect(() => base64ToBinary(binary)).not.toThrow(); + } }); it("should generate CRDT changes for cards", () => { -- cgit v1.2.3-70-g09d2