Repository navigation
fix(connections): keep Local only connections out of remote edits and deletions - #3178
Merged
Merged
Conversation
Signed-off-by: Ngô Quốc Đạt <[email protected]>
This was referenced Sep 29, 2026
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
SyncCoordinator.applyRemoteConnectionnever readlocalOnly, so the Local only rule was enforced on push only and the pull replaced the stored connection with the remote record.applyRemoteConnectionDeletionsremoved every id the pull named and ranConnectionLocalState.purge(origin: .remote)on the same unfiltered set.A connection can be made Local only after it has already synced, and that writes no tombstone, so its iCloud record stays live for other devices to edit or delete. Both pull paths now leave a stored Local only connection alone. The pull is still acknowledged and the record still goes into the record cache, so including the connection in sync again pushes with the server's current change tag and the local copy wins.
Tests
Two new cases in
TableProTests/Core/Sync/SyncCoordinatorEchoTests.swift, both drivingapplyPullResultand reading storage back:localOnlyConnectionIgnoresRemoteEdit: a pull carrying a changed copy of a Local only connection leaves its host, Safe Mode level andlocalOnlyflag unchanged. Fails without the fix:stored.hostcame back"db.elsewhere"andstored.preferredSafeModeLevelcame back.silent.localOnlyConnectionKeepsSavedQueriesOnRemoteDeletion: a pull whosedeletedRecordIDsnames a Local only connection and a synced one removes only the synced one, and the Local only connection keeps its saved query while the synced one's is purged. Fails without the fix: the Local only connection came backnil. With the row kept but the purge given the unfiltered set, it fails onfetchFavorite(id: keptQuery.id) != nil.SyncCoordinatorEchoTests,SyncCoordinatorSQLFavoritePullTests,SyncCoordinatorTokenExpiryTests,FavoriteDatabaseSyncTestsandCredentialProfileSyncTests: 40 executed, 40 passed.swiftlint lint --stricton the changed Swift files: 0 violations.Docs
The docs rewrite branch covers the user-facing text.