Skip to content

fix(sync): moves between providers recover, and TablePro Sync after Off keeps the edits made while off - #4768

Merged
datlechin merged 3 commits into
mainfrom
fix/sync-move-recovery
Nov 30, 2026
Merged

datlechin merged 3 commits into
mainfrom
fix/sync-move-recovery

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

  • A move to TablePro Sync with no zone listing (no last iCloud pass, iCloud forbidden by a license or profile) merges a marked service copy against this Mac's own CloudKit base when the marker names another copy. Before, a Mac whose last pass was older than the first mover's sent its older value over the moved one.
  • choose_provider(TablePro Sync) on a TablePro Sync service whose file holds a move back ends it: the row goes under the policy gate and personal sync is on again (Mover::stay_on_service).
  • run_arrival returns at once on a Done row for TablePro Sync, so a second first upload queued behind one that went through no longer drops the bases and takes the server's copy over edits made between the two.
  • The move back's CloudKit fetch and deletions go in calls of at most 200 names (cloudkit::NamedCalls, also used by the pass's fetch by name and the legacy import), halved on limitExceeded. Each deletion call fetches its own names again right before it, keeps a copy changed since the base or one this build cannot read, and commits before the next call.
  • open_move starts TablePro Sync's engine first, so a move is not read as none while the engine waits to start; signed out reads as none.
  • Mac: under a profile that forces TablePro Sync, a Mac on iCloud with an iCloud state file stays on a stopped iCloud, the Sync pane shows Your Organization Uses TablePro Sync with Review Move…, and the move runs from iCloud without the last pass instead of a first upload.
  • Mac: ProviderMoves reads openMove() per opened service, after a failed move back or read, and on status changes while a move is open. A finished move is taken up (stored provider and TablePro Sync's first pass) unless the person chose a provider since launch. A stopped move back shows Moving Back to iCloud Didn't Finish with Resume Move… and Cancel Move.
  • TablePro Sync chosen again after Off goes on from the personal bases the service file kept (Arrival::Resume): a field only one side changed merges, a field both changed opens a personal conflict (Judgement::Contest, team merge rules for that pass), decided with Keep Mine or Keep Theirs. With no kept bases, or after a move back or a restore, it is the first upload as before. The Mac's conflict sheet words a personal conflict as this Mac and its other devices.
  • open_move runs whole on the core runtime (self: Arc<Self>), so reading it from an app thread no longer panics with "requires a Tokio context" (E2E W4 on Windows).
  • A finished move back drops the service file's personal rows, so TablePro Sync chosen later starts over. A contested personal record holds its envelopes back until decided, and an open personal conflict stays contested in later passes. The Mac lists personal conflicts without Team Library and ends them at sign-out.
  • Core ADR 0104; 0051, 0054, 0055 and 0073 Status lines and the index. C# bindings regenerated (verify.sh --platform windows bindings); the open_move checksum is unchanged.
  • Tests changed on purpose: SyncProviderPolicyTests.forcedTableProSync pinned a Mac on iCloud going Off under a forced TablePro Sync; it now stays on iCloud when it has iCloud data, Off when not (settledProvider takes movesFromICloud). The FFI tests from fix(sync): a move without iCloud's last pass keeps the deletions iCloud sent, another provider ends a move, and the app closes sync #4749 that read open_move now pass their own Arc of the service.

Test plan

  • Core, fail on main and pass here (core/crates/sync/tests/engine/moves.rs):
    • a_move_without_the_last_icloud_pass_takes_what_another_device_moved_over_an_older_copy
    • a_move_without_the_last_icloud_pass_sends_only_what_the_device_changed_since_its_own_copy
    • a_move_without_the_last_icloud_pass_keeps_an_edit_another_device_moved_over_a_deletion_from_an_older_copy
    • a_first_upload_after_one_that_went_through_keeps_what_the_device_edited_since
    • staying_on_tablepro_sync_over_a_move_back_cut_short_ends_it_and_personal_sync_goes_on
    • a_move_back_with_more_deletions_than_one_cloudkit_call_takes_deletes_them_all
    • a_record_edited_on_icloud_while_the_move_back_runs_stays_there
    • each_move_back_deletion_follows_a_fetch_of_its_own_names
    • tablepro_sync_chosen_again_after_off_keeps_the_edits_made_while_off
  • FFI, fails on main with the W4 panic: the_open_move_is_read_from_a_thread_outside_the_runtime.
  • Core unit: cloudkit::named calls order and halving; MoveMarker::names.
  • Unchanged on purpose: a_first_upload_from_off_takes_the_server_s_copy_and_sends_what_the_server_lacks keeps "the server's copy wins" for a device with no kept bases, which the new rule leaves as it was.
  • Mac (ProviderMovesTests, SyncProviderPolicyTests, SyncPaneLayoutTests, TeamLibraryFieldConflictSheetTests, TeamLibraryTests): a personal conflict names this Mac and its other devices; forced TablePro Sync moves from iCloud; an unfinished move back is shown and cancelled; one read after a restart; a failed read is tried again; a finished move is taken up, and not over an Off chosen before or after the read.
  • Local verify on the rebased branch: cargo test for records, sync, sync-testing and ffi sync:: all pass; cargo clippy --locked -p tablepro-records -p tablepro-sync -p tablepro-sync-testing -p tablepro-ffi --all-targets -- -D warnings clean; cargo fmt --check clean; verify.sh test 8 suites, 202 passed; verify.sh l10n PASS; verify.sh --platform windows build PASS.
  • Review: Codex, three rounds on the moves and two on the Off-and-back change.

…Cloud pass meets this Mac's own copy, and TablePro Sync after Off keeps the edits made while off
@datlechin
datlechin merged commit 7c08ac2 into main Nov 30, 2026
1 check passed
@datlechin
datlechin deleted the fix/sync-move-recovery branch November 30, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant