Carry tags through the sync merge !9

merged merged by cmc on 2026-10-24 04:09 UTC · krz/domain-dig:fix-sync-field-loss into main

Discussion

cmc

payloadTrackedDomain and mergedTrackedDomain rebuild TrackedDomain field by field and both omitted tags, so it fell back to the initialiser's empty default. applyMergedPayload writes the merged payload back through saveTrackedDomains, so the first sync emptied every tracked domain's tags — and the watchlist's tag filter with them. Pre-existing; found while reviewing !7, which carried the behaviour across rather than changing it silently.

The merge treats an empty list as "nothing to say" rather than "cleared", because records written before this decode with no tags at all. Without that, the first sync after the fix would still drop them.

Also pins the updatedAt store round trip. !7's authority bookkeeping decides whether a row has been pushed by comparing a recorded date against the row's own updatedAt after it has been written to the store and read back; if that were lossy, every row would read as unpushed and local would win every merge. It is exact today — the stores encode dates as a Double through the default JSONEncoder strategy, not as a formatted string — and nothing pinned it.

Audited the rest of the same class: payloadTrackedDomain and mergedTrackedDomain now construct 19 of 19 fields (lastSnapshotID and lastChangeSummary are deliberately nil), and normalizedWorkflow already carried all 7 of DomainWorkflow's.

110 tests, 0 failures. The three tags tests were confirmed failing before the fix.