Skip to content

Implement durable revision-aware Nextcloud sync#1121

Draft
hweihwang wants to merge 1 commit intomainfrom
durable-revision-aware-sync
Draft

Implement durable revision-aware Nextcloud sync#1121
hweihwang wants to merge 1 commit intomainfrom
durable-revision-aware-sync

Conversation

@hweihwang
Copy link
Copy Markdown
Contributor

Summary

  • Add durable board revision metadata to the Nextcloud board document while keeping legacy top-level snapshot fields compatible.
  • Make HTTP saves revision-aware and conflict-safe with baseRev, idempotent stale-save handling, and 409 responses that return the latest normalized board document.
  • Persist durable revision metadata in IndexedDB and runtime sync state, and keep load, recovery, and raw version readers compatible with both legacy and revisioned board JSON.

Technical details

  • The Nextcloud persistence service now normalizes every board document to { meta, elements, files, appState, scrollToContent }, defaults legacy and empty files to persistedRev: 0, validates baseRev, and treats stale identical snapshots as idempotent success while stale divergent snapshots raise a typed conflict carrying the current normalized document. Matching baseRev writes incremented persistedRev, updatedAt, and updatedBy, and the controller exposes that through GET and PUT without making the file lock the public conflict contract.
  • The client now stores persistedRev, lastServerUpdatedAt, and lastServerUpdatedBy in Dexie and runtime sync state, sends full durable snapshots including sanitized appState and scrollToContent, and uses a conflict-aware worker retry loop. A 409 never clears pending local state, identical conflicts collapse to idempotent success, and divergent conflicts merge local pending data with the server snapshot, persist the rebased pending state locally, and retry against the new durable revision.
  • Load, restore, version preview, and read-only rendering paths now normalize both legacy and revisioned raw board JSON, preserve durable metadata when restoring local state, and ignore top-level meta for rendering so raw file and history readers stay compatible.

Signed-off-by: Hoang Pham <hoangmaths96@gmail.com>
@hweihwang hweihwang marked this pull request as draft April 1, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant