readest/docker/volumes/db/init
Huang Xin 165e3192ae
fix(sync): merge book metadata on its own clock so page turns cannot clobber edits (#5438) (#5442)
A metadata edit (title, author, tags, metadata incl. language) shares the
books row with page-turn progress, which dominates updated_at: any device
that reads the book after the edit pushes a stale-metadata row with a newer
updated_at and whole-row LWW reverts the edit server-side; on pull, the
locally-read book keeps its stale copy. RSS feed books are read daily on
every device, making the loss near-deterministic (issue #5438).

Give the metadata group its own field-level LWW timestamp, the same fix
reading_status (#4634) and the cover (#4544) received:

- migration 018 adds books.metadata_updated_at (nullable, additive)
- getBookWithUpdatedMetadata stamps it on every metadata edit; the ingest
  subject-tag append stamps it too since tags ride the metadata clock
- the server merge resolves the group by the stamp on both row outcomes,
  with a value-level no-op guard; an unstamped-vs-unstamped tie follows the
  row winner so legacy rows keep their historical behavior
- useBooksSync grafts the fresher group client-side and recomputes
  primaryLanguage (what TTS reads) from the adopted metadata, also when
  adopting a new cloud book
- the file-sync mergeBookMetadata mirrors the clock, and
  shouldApplyRemoteBookMetadata triggers on a metadata-only-newer remote
- the calibre plugin stamps metadataUpdatedAt when a push changes the
  group and carries the server stamp otherwise

The other half of the issue, feeds missing on Android entirely, is the
already-merged #5314 which is not in the shipped 0.11.20 builds.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-02 15:46:39 +02:00
..
schema.sql fix(sync): merge book metadata on its own clock so page turns cannot clobber edits (#5438) (#5442) 2026-08-02 15:46:39 +02:00