Sync fidelity: preserve handle created_at; don't discard sync data on conflict-copy cleanup - #451
Merged
Merged
Conversation
…nflict copy - contacts:update now preserves contact_handles.created_at across re-insert, mirroring the existing pattern for emails/phones/links (fixes #435). - deleteConflictCopies now clears the project's sync_pushed rows before deleting a detected cloud-provider conflict copy, so rows that only landed in the discarded copy get re-pushed on the next sync instead of being silently lost (fixes #436). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
contact_handles.created_atacross the delete+re-insert on every contact update, mirroring the existing pattern already used for emails/phones/links in the same transaction. Previously handles were re-stamped withnowevery time, churning their sync-merge ordering across clients.deleteConflictCopies(sync poller) now clears the project'ssync_pushedrows before deleting a detected cloud-provider "conflicted copy" file. Per the follow-up in Conflicted-copy cleanup can permanently discard another client's pushed sync data #436 after the Sync: explicit replication state — per-project push tracking, full-scan pull, deletion tombstones #449 replication-state redesign, this is the modern equivalent of the original fix sketch: marking the project's rows dirty forces a full re-push next sync (all push paths are idempotent upserts), so rows that only ever landed in the discarded conflict copy aren't silently lost.Closes #435
Closes #436
Test plan
npm run rebuild:node && npm test— full suite passes (502 tests)preserves handle created_at across updatetest insrc/test/contacts.test.ts(backdates, then asserts preservation across update)src/test/poller.test.tscoveringdeleteConflictCopies: clearssync_pushedfor the affected project only (leaves other projects' rows alone) when a conflict copy is found and deleted; leavessync_pusheduntouched when no conflict copy existsnpx tsc --noEmit -p tsconfig.node.json— cleannpm run rebuild— restored Electron-targeted native binaries after testing🤖 Generated with Claude Code