fix(sync): bump updated_at on set-icon + folder-delete reassignment

Both UPDATEs mutated a synced column without touching updated_at, so the
change rode in the sync snapshot but other devices skipped it (last-write-
wins saw "not newer"). Now both SET updated_at = datetime('now') (UTC).

- POST /entries/{id}/icon (PM.Handler.Entries)
- folder delete → entries reassigned to 'All' (PM.Handler.Folders)

accessed_at stays exempt (read timestamp, not synced); bulk "clear all
icons" stays exempt (device-local favicon cache purge). Invariant documented
in CLAUDE.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-07-05 15:55:23 +01:00
parent ca8081987d
commit 4ffbd63893
3 changed files with 16 additions and 2 deletions
@@ -350,7 +350,10 @@ begin
try
LQ.Connection := DB.Connection;
LQ.SQL.Text :=
'UPDATE vault_entries SET folder = ''All'' ' +
// Bump updated_at (UTC) so the folder reassignment propagates on sync
// (last-write-wins) — otherwise other devices keep the entries in the
// just-deleted folder because the timestamp didn't move.
'UPDATE vault_entries SET folder = ''All'', updated_at = datetime(''now'') ' +
'WHERE user_id = :uid AND folder = :name';
LQ.ParamByName('uid').AsInteger := LUserId;
LQ.ParamByName('name').AsString := LName;