f7e1bddda6
The sync POST handler rewrote books.updated_at = now() whenever a pushed book's resolved reading_status differed from the server row's. A book that was imported locally and never given a status sends reading_status: undefined, while the server stores null, so `undefined !== null` reported a spurious status change. The 1-day re-sync window re-pushes every recently touched book on each sync, so the server stamped those books with a fresh, batch-identical timestamp every cycle, floating them to the top of the date-sorted library (and above a book the user had just read). Normalize nullish reading_status values before comparing so a statusless book never registers as a status change. Verified on-device via CDP: PUSH_SENT carried the old timestamp while PUSH_RETURNED came back with a fresh now() for exactly the statusless books. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>