The server has no updatedAt on tags and sends updated_at = created_at, so a
local tag rename always looked newer than the server row: after a sign-out /
sign-in, a stale phone rename overwrote a later web rename. Tags now always
take the server version on pull (an offline tag rename is lost, as before),
locked by a smoke source check. Lists and tasks keep the keepLocal rule.
Refs #149
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move the construction of pulled rows into a pure, import-free module
(src/services/syncRules.ts) executed by node --test:
- pulled{List,Task,Tag}Values always build the full row; an existing row
keeps its local createdAt, and a task keeps its calendarEventId (the
server has no such column, so the pull used to null it);
- keepLocal: in a whole-account pull (since === SYNC_EPOCH), a local row
strictly newer than the server copy is left untouched and re-queued in
the outbox, so edits made while signed out survive the reconnection;
- server deletions still always apply; task-tag links are unchanged.
fullSync and initialReset use SYNC_EPOCH. REVIEW.md lists syncRules.ts
in the Haut table (Sync zone) with the new rules, and the smoke test
keeps the module import-free.
Refs #149
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>