Errors, Encryption, and Repair
SyncError distinguishes local-store failure, remote request failure,
operational setup, internal logic contradiction, suspected remote data loss,
and wrong encryption key. These imply different remedies and should not become
one string at the library boundary.
Sync validates the key before changing either side. Downloads locate the first gap and use saturating arithmetic, making partial previous runs recoverable. Idempotent record insertion tolerates re-downloading already present suffixes.
Packfile manifests are committed only after their covered history is expanded locally. Temporary network failure aborts; permanently unexpandable content is reported as data loss and skipped so unrelated streams can continue.
After convergence, each domain projection rebuilds independently and warns on failure. This prefers maximum locally usable state over one all-or-nothing transaction spanning unrelated databases. Offline operation is the ultimate failure mode: capture and search remain useful without the server.