Skip to content

Add bidirectional EPUB annotation sync - #35

Merged
42lizard merged 5 commits into
mainfrom
feat/annotation-sync
Sep 26, 2026
Merged

42lizard merged 5 commits into
mainfrom
feat/annotation-sync

Conversation

@42lizard

@42lizard 42lizard commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

Sync and Open now synchronize EPUB highlights and attached notes between PocketBook and Readest, including edits and deletions.

Sync / Open
  validate the local EPUB
  reconcile reading progress
  reconcile annotations
    persist identities, baselines and pending uploads
    verify cloud acknowledgements / native transactions

Native Edit replaces an annotation UUID, while reopening merely normalizes its anchors. The reconciliation handles both without duplicate uploads. Conflicting edits are preserved and reported. Unsupported colors, styles and ranges are skipped with a warning; potentially related deletions are deferred. The simulator now models annotation storage and the notes endpoint. Library scans now persist only inserted, changed, or removed local books instead of rewriting the whole local library; unchanged scans perform no row writes.

Evidence

  • Before: application sync sent empty notes arrays and could not import or export annotations.
    After: all 19 simulator/core/UI/packaging tests pass, including create/edit/delete in both directions, lost responses, durable retries, newer server timestamps, stale deletion responses, unsupported replacements, and application Sync/Open integration.
  • Regression checks count actual inserts, updates and deletes across initial, unchanged, reordered, changed-position, changed-metadata, added and removed books; the application scan also succeeds with deletes prohibited for an unchanged library.
  • Qt6 ARM build and loader/resource/ABI checks pass.
  • A controlled import into Beren und Lúthien displayed the exact highlighted paragraph and attached note on PB743G/U743g.6.11.1683. Device screenshots and a post-open database snapshot confirmed persistence and anchor normalization. Automatic app sync is now confirmed by the device journal: two live annotations have matching local/remote baselines, one annotation is deleted on both sides, and no uploads remain pending. The native database contains the Readest edit “codex note edited on readest” and the PocketBook replacement “readest import test edit onpb”, with one live native row per mapping.
  • A captured-device fixture reconciled against a mock cloud without repeat uploads.
  • macOS targeted annotation/application tests pass. The full macOS run hits a resume fault-injection assertion failure; the complete Linux and simulator suites pass.

Merge Danger

Door: one-way

Reverting the executable does not undo annotation changes already synchronized. Native writes are restricted to the verified firmware. Conflicts and unsupported records remain visible rather than being silently overwritten. The cloud API has no conditional-write operation; preflight reads reduce but cannot eliminate its concurrent-write window.

Blast Radius: annotations

Writes affect Readest note records and the selected book's native annotation rows. The new app-owned journal is isolated by account, book, local path and EPUB SHA-256. Device round-trip evidence has been collected. Startup diagnosis found that offline workers were not protected from device standby. Operations now retain the existing standby guard through result delivery, with a one-second firmware grace period for queued UI rendering. Regression tests cover offline success/failure and completion callbacks that start another operation. Four device launches without per-event logging passed, including Home exit and no wake-up taps: service initialization took 6.25 s on the first launch after USB, then 1.34 / 1.35 / 1.36 s. The user confirmed normal visible behavior. Temporary UI and detailed phase probes were removed; the existing operation log retains monotonic millisecond timestamps.

@42lizard
42lizard marked this pull request as ready for review September 26, 2026 14:22
@42lizard
42lizard merged commit e0fd528 into main Sep 26, 2026
2 checks passed
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