Repository navigation
Add bidirectional EPUB annotation sync - #35
Merged
Merged
Conversation
42lizard
marked this pull request as ready for review
September 26, 2026 14:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sync and Open now synchronize EPUB highlights and attached notes between PocketBook and Readest, including edits and deletions.
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
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.
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.