Back to Super Productivity

Operation Log & Sync Documentation

docs/sync-and-op-log/README.md

18.18.08.2 KB
Original Source

Operation Log & Sync Documentation

The Operation Log is the single client sync pipeline for SuperSync and file providers. Persistent NgRx actions update the live projection and are captured as durable operations; restart uses a structurally screened snapshot plus the retained operation tail. Vector clocks detect causal order and concurrent edits.

                    Persistent NgRx action
                     ┌────────┴────────┐
                     ▼                 ▼
               NgRx reducers     operation capture
                     │                 │
                     ▼                 ▼
            runtime projection      SUP_OPS
                                  (ops, clocks,
                               checkpoints, snapshot)
                                           │
                                           ▼
                                    Sync Providers
                       ┌───────────────────┴──────────────────┐
                       ▼                                      ▼
                   SuperSync                       File providers
               (ordered op API)           (shared v2 or v3 envelopes)

The v2/v3 envelopes are common adapter formats, not a common physical write guarantee. Dropbox and OneDrive can enforce API compare-and-swap (CAS), while WebDAV/Nextcloud is atomic only when the server supplies strong ETags; weak or missing ETags fall back to a best-effort check. LocalFile likewise has a best-effort read/check/write race and is single-writer/backup-only.

Start here

Current mechanics live in the executable owners linked by these documents. Overview and history documents explain the model but do not override code, tests, or a focused contract.

You want to…Read
Build a five-minute whole-system mental modelsync-architecture.html — standalone maintainer field guide; open the local file in a browser
Write an effect/reducer/bulk-dispatch correctlycontributor-sync-model.md — the one invariant, drop-vs-defer selector rule, and lint boundaries
Compare SuperSync and file v2/v3field guide: transports
Trace remote apply, conflicts, or restart recoveryremote apply, causality, restart
Change SECTION conflict/recovery behaviorsection-conflict-replay.md — narrow commutativity, state-projected replay, and released-client compatibility contract
Find executable coverage for a SuperSync scenariosupersync-scenarios.md — scenario-to-test index, not a prose specification
Research rejected alternatives or cross-version policyoperation-log-architecture.md — deep rationale and history plus the normative A.7.11 schema-bump policy

Reference docs

StatusDocumentScope
Overviewsync-architecture.htmlHigh-level maintainer map: local intent, transports, crash-safe apply, causality, exceptional boundaries, restart recovery, and executable owners
Contractcontributor-sync-model.mdContributor invariant: one replay-atomic transition = one op; replayed/remote ops must not re-trigger effects
Contractsection-conflict-replay.mdSECTION conflict commutativity, state-projected semantic replay, atomic replacement, and released-client compensation
Contractpackage-boundaries.mdDependency/ownership boundaries for @sp/sync-core, @sp/sync-providers, app wiring
Contractconflict-journal-and-review.mdDisjoint-field auto-merge plus the dormant device-local journal/review capability and its security boundary
Contractpersisted-model-fields.mdAdding fields to persisted models: optional-plus-default invariant, heal paths, and the latent hydration-validation failure (#8965)
Contractvector-clocks.mdVector-clock implementation, storage/pruning ownership, and history
Contractsupersync-encryption-architecture.mdEnd-to-end encryption wire format, key lifecycle, integrity boundary, and known limitations
Mixedoperation-log-architecture.mdDeep rationale and implementation history plus the normative A.7.11 cross-version/schema-bump contract; use executable owners for volatile detail

Executable scenario index

DocumentScope
supersync-scenarios.mdRepresentative scenario-to-test routing; executable tests own behavior

Active plans

DocumentScope
sqlite-migration.mdCurrent native SQLite durability rationale, landed foundation, remaining rollout gates
LocationContent
packages/super-sync-server/docs/architecture.mdSuperSync server-only architecture reference
packages/super-sync-server/SuperSync server implementation
ARCHITECTURE-DECISIONS.mdLoad-bearing product/data decisions

Retired diagram filenames remain as small forwarding stubs so historical links continue to resolve. operation-rules.md and sqlite-migration-followup.md are also compatibility pointers; they are not independent sources of current behavior or status.