Add three-way file root apply

This commit is contained in:
Eric Wendland 2026-05-22 14:41:09 +02:00
commit 606641dd4a
5 changed files with 602 additions and 27 deletions

View file

@ -161,12 +161,15 @@ watermarks. Repeated remote file-root syncs retain the previous imported remote
tree as the base and compare base/local/remote tree state. When both local and
remote roots changed, geth records durable concurrent edit, delete/edit, or
divergent rename conflicts instead of applying remote content. `geth cas root
apply <root> --to <path>` is the first conservative
materialization path: it creates missing files and directories from the CAS tree,
does not delete extra local files, does not overwrite differing local files, and
records conflicts for manual resolution. The daemon also has durable local
file-conflict records with explicit resolution choices; richer three-way apply
will extend those records instead of silently applying ambiguous remote changes.
apply <root> --to <path>` is conservative when the target has no registered
base: it creates missing files and directories from the CAS tree, does not
delete extra local files, does not overwrite differing local files, and records
conflicts for manual resolution. When the target path matches a registered
local root with a previous scan, apply uses that scan as the base for a
three-way base/local/remote check. It can safely accept remote creates, updates,
deletes, and renames only when the current local filesystem still matches the
base; ambiguous paths remain durable conflicts. The daemon also has durable
local file-conflict records with explicit resolution choices.
As a bootstrap network path, `geth cas fetch <node-id> <hash>` dials an
imported signed peer card over the daemon-owned Iroh control ALPN. The serving
@ -176,7 +179,7 @@ before returning blob bytes. The requester verifies that the returned bytes hash
to the requested BLAKE3 CAS hash before storing them. Successful fetches update
durable local provider metadata keyed by CAS hash and peer node, which can be
inspected through `geth cas providers <hash>`. Iroh-blobs provider/fetch
integration and richer three-way file application are future work.
integration is future work.
`geth-db` currently registers local SQLite paths as DB resources and reports
local-only sync status plus a read-only SQLite schema summary/hash. It also

View file

@ -40,12 +40,12 @@ Implementation order:
- `[x]` `geth status` reports the current bootstrap backend, target crate,
target version, and blocker for CAS, KV, and pubsub.
3. `[ ]` Polish file sync reconciliation.
3. `[x]` Polish file sync reconciliation.
Acceptance criteria:
- `[ ]` Add a safe three-way apply path for non-conflicting
- `[x]` Add a safe three-way apply path for non-conflicting
create/update/delete/rename changes.
- `[ ]` Keep ambiguous changes as durable conflicts.
- `[ ]` Add two-root integration coverage.
- `[x]` Keep ambiguous changes as durable conflicts.
- `[x]` Add two-root integration coverage.
4. `[ ]` Replace JSON document state with durable Automerge documents.
Acceptance criteria:
@ -108,11 +108,11 @@ Implementation order:
- `[~]` File sync reconciliation polish.
Acceptance criteria:
- `[ ]` `cas root apply` has a richer three-way base/local/remote reconcile
- `[x]` `cas root apply` has a richer three-way base/local/remote reconcile
path for safe updates and deletes.
- `[ ]` Ambiguous changes continue to produce durable conflicts instead of
- `[x]` Ambiguous changes continue to produce durable conflicts instead of
overwriting local files.
- `[ ]` Tests cover create/update/delete/rename application across two local
- `[x]` Tests cover create/update/delete/rename application across two local
roots.
- `[~]` Durable Automerge documents.
@ -717,8 +717,12 @@ and future group key evolution.
and directories from a CAS tree without deleting extras or overwriting local
edits.
- `[x]` Apply records durable conflicts for differing local paths.
- `[ ]` Future completion adds a richer three-way apply using base/local/remote
trees for automatic safe updates and deletes.
- `[x]` `geth cas root apply <root> --to <path>` uses a registered local
root's previous scan as the base for automatic safe creates, updates,
deletes, and renames when the current local filesystem still matches that
base.
- `[x]` Ambiguous three-way changes remain durable conflicts instead of being
overwritten.
- `[x]` Conflict handling.
Acceptance criteria: