Store documents as Automerge state

This commit is contained in:
Eric Wendland 2026-05-22 14:54:00 +02:00
commit b01da7be4b
9 changed files with 490 additions and 73 deletions

View file

@ -47,11 +47,11 @@ Implementation order:
- `[x]` Keep ambiguous changes as durable conflicts.
- `[x]` Add two-root integration coverage.
4. `[ ]` Replace JSON document state with durable Automerge documents.
4. `[x]` Replace JSON document state with durable Automerge documents.
Acceptance criteria:
- `[ ]` Store Automerge documents durably.
- `[ ]` Sync Automerge changes over Iroh.
- `[ ]` Gate document sync with resource authorization.
- `[x]` Store Automerge documents durably.
- `[x]` Sync Automerge changes over Iroh.
- `[x]` Gate document sync with resource authorization.
5. `[ ]` Harden DB sync for real cr-sqlite usage.
Acceptance criteria:
@ -115,12 +115,13 @@ Implementation order:
- `[x]` Tests cover create/update/delete/rename application across two local
roots.
- `[~]` Durable Automerge documents.
- `[x]` Durable Automerge documents.
Acceptance criteria:
- `[ ]` Document state is stored as durable Automerge data, not only JSON
- `[x]` Document state is stored as durable Automerge data, not only JSON
last-writer-wins state.
- `[ ]` Sync converges according to Automerge semantics across two nodes.
- `[ ]` Resource authorization gates remote document reads and writes.
- `[x]` Sync exchanges durable Automerge state over the protected Iroh
control path and merges received Automerge documents.
- `[x]` Resource authorization gates remote document reads and writes.
- `[~]` Operational first-run polish.
Acceptance criteria:
@ -665,24 +666,24 @@ Automerge documents.
- `[~]` Automerge document resource.
Acceptance criteria:
- `[x]` `geth document create/status` works for local documents.
- `[x]` Document metadata and empty JSON state are stored durably.
- `[x]` `geth document set/get` stores and returns validated local JSON
state.
- `[x]` Tests cover create, update, save, and reload of local JSON document
state.
- `[x]` `geth document sync <node-id> <name>` pulls authorized JSON state
- `[x]` Document metadata and empty Automerge state are stored durably.
- `[x]` `geth document set/get` stores durable Automerge save bytes and
returns a validated JSON view.
- `[x]` Tests cover create, update, save, and reload of local Automerge
document state.
- `[x]` `geth document sync <node-id> <name>` pulls authorized Automerge state
from an imported peer over Iroh.
- `[x]` Background live-sync refreshes local JSON documents from known peers
- `[x]` Background live-sync refreshes local Automerge documents from known peers
using per-peer/per-document cursors.
- `[ ]` Automerge document state is stored durably.
- `[ ]` Tests cover Automerge create, update, save, and reload.
- `[x]` Automerge document state is stored durably.
- `[x]` Tests cover Automerge create, update, save, and reload.
- `[ ]` Automerge sync over Iroh.
- `[x]` Automerge sync over Iroh.
Acceptance criteria:
- `[x]` Bootstrap JSON last-writer-wins sync works across two local test
nodes over Iroh.
- Resource authorization gates read/write sync.
- Conflicts converge according to Automerge semantics.
- `[x]` Automerge state sync works across two local test nodes over Iroh.
- `[x]` Resource authorization gates read/write sync.
- `[x]` Received Automerge documents are merged rather than stored as raw
JSON blobs.
## Phase 6: File Sync And Advanced Local-First Auth