Skip to content

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

Merged
datlechin merged 20 commits into
mainfrom
fix/core-move-deletions-and-close
Nov 30, 2026
Merged

datlechin merged 20 commits into
mainfrom
fix/core-move-deletions-and-close

Conversation

@datlechin

@datlechin datlechin commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Summary

  • A move to TablePro Sync whose last iCloud pass can't run, and the forced move with iCloud forbidden, now delete on the service what this Mac already saw deleted on iCloud. The iCloud engine keeps each deletion the zone sends in a new zone_deletions table (state file schema 3; schema 1 and 2 files upgrade at open), drops a row once the zone sends the record again, and the arrival reads the table when it has no zone listing. A restored file's rows count only once its refill read the zone.
  • The move sheet says that items deleted on other devices since this Mac's last iCloud sync stay on this Mac.
  • Off chosen over a move, or iCloud chosen from Off, ends it: a move begun before it commits nothing more, personal sync rests on the service, its move row goes, and an iCloud file a move marked is left as a move back leaves it with nothing deleted, so iCloud chosen later syncs again.
  • Off told to iCloud's service, which the Mac also sends as TablePro Sync's service replaces iCloud's after a finished move, ends only an unfinished move, so the iCloud file keeps its done mark for the person's later Off or move back.
  • Sync opened Off ends a move from iCloud, done or not. When the service before still holds the state files, that waits until the new service starts, and open_move and every move call wait for it, so the end never lands on a move started since.
  • An arrival checks for a choice that ended the moves under the service's session before it turns personal sync on, also when it goes on from an open row, so a resumed move sends nothing once Off was chosen.
  • Moves, the resume and the end of the moves run one at a time on a service (ServiceSync::moving).
  • As sync opens, an unfinished move resumes only from the provider it left and only while its row is still open. One left open under Off by an older build ends instead of going on as a first upload, which deleted the iCloud file.
  • SyncService::close stops the engines, ends their schedulers and the pass in flight, and refuses any new engine start; calls that are no pass, as Team Library's delete after a sign-out, still run. The iCloud engine lets go of its file at once, TablePro Sync's when the app lets go of the service. The Mac closes a service it lets go (sign-in change, provider change) and the open one at the quit; Windows closes it on dispose and frees it after.
  • A sync bearer asked for while the account's token, discovery, license or keys call found the server out of reach takes that answer instead of waiting out the window again, and a refresh whose install ID check (0097) found the server out of reach stops there. A relaunch with the server paused now shows Waiting to Retry after about 10 s, not 20 to 25 s.
  • The Mac tells a write made at launch to the stored provider's service, so on TablePro Sync it no longer opens an Off service first that TablePro Sync's then waits on for the state file.
  • State file schema 3 under ADR 0105: zone_deletions is in ADDED_AFTER_FORMAT_2, the oldest reader stays 2, and a file a format 2 build restamped clears the table again.
  • ADR 0086 records the rulings; 0016, 0054 and 0073 Status lines, the index and core/ARCHITECTURE.md point to it. .claude/rules/data-sync-storage.md notes the close.
  • Paired docs PR: docs(features): a move without iCloud's last sync keeps deletions this Mac saw, and Off ends a move docs#321.

Test plan

  • Fail on main, pass here:
    • tablepro-account a_bearer_asked_for_while_a_refresh_waits_on_a_silent_server_takes_its_answer (checked: with the rule off it fails with "the bearer called the server again").
    • tablepro-sync engine moves: a_move_without_the_last_icloud_pass_takes_the_deletions_icloud_sent_the_device_before, a_forced_move_with_icloud_forbidden_takes_the_deletions_icloud_sent_the_device_before, a_provider_chosen_over_a_move_that_stopped_short_ends_it_and_icloud_syncs_the_file_again, off_over_a_finished_move_lets_icloud_sync_the_file_again_and_deletes_nothing_there, off_told_to_icloud_s_service_after_the_move_went_through_keeps_the_file_s_mark, off_chosen_while_a_resumed_move_reads_icloud_sends_nothing_up, a_move_begun_before_a_provider_choice_ended_the_moves_commits_nothing.
    • tablepro-ffi: a_move_the_person_turned_sync_off_over_never_starts_again_by_itself, a_move_from_icloud_left_open_under_off_ends_as_sync_opens, a_finished_move_outlives_icloud_s_own_off_and_ends_as_sync_opens_off, a_first_upload_asked_for_before_sync_settled_waits_for_the_old_move_to_end, a_closed_service_ends_tablepro_sync_s_pass_in_flight_and_runs_none_after_it, a_closed_service_runs_no_pass_and_lets_go_of_its_state_files.
  • New behavior: a_move_reads_no_deletion_from_an_icloud_file_put_back_until_a_refill_read_the_zone, a_move_reads_the_deletions_an_icloud_file_put_back_received_after_its_refill, a_record_saved_again_in_the_zone_after_its_deletion_is_no_deletion_for_a_later_move, cloudkit a_deletion_the_zone_sent_stays_until_the_zone_holds_the_record_again, state_integrity a_schema_2_file_opens_fresh_in_this_schema_with_its_rows and a_changed_schema_2_file_is_refused over fixtures/schema_2.txt, written by the schema 2 build (4feb33a).
  • Mac: SyncEngineHostTests/aRetiredServiceCloses, SyncProviderCoordinatorTests/quitClosesTheOpenService, SyncProviderCoordinatorTests/aWriteOnTableProSyncOpensItsService.
  • Windows: SyncTests.AClosedServiceRefusesTheCallsAfterIt (CI).
  • Local, on f462d39 (main at 2cb1566): cargo clippy --locked -p tablepro-account -p tablepro-sync -p tablepro-sync-testing -p tablepro-ffi --all-targets -- -D warnings clean; account 248, sync 1158, ffi sync:: 83 passed. One merge earlier: verify.sh test SyncEngineHostTests SyncProviderCoordinatorTests ProviderMovesTests 90/90, Windows bindings regenerated (PASS), Interop SyncTests 8/8, Mac strings extracted (localization.py extracted ok).

…ns, another provider ends a move, and the app closes sync
…ns-and-close

# Conflicts:
#	core/ARCHITECTURE.md
#	core/crates/sync/src/cloudkit/modify/pass.rs
#	core/crates/sync/src/cloudkit/modify/zone.rs
#	core/crates/sync/src/moves/mod.rs
#	core/crates/sync/src/state/file.rs
#	core/crates/sync/src/state/integrity/digest.rs
#	core/crates/sync/tests/state_integrity/upgrade.rs
#	core/docs/decisions/0016-tablepro-accounts.md
#	core/docs/decisions/0054-one-sync-engine-in-the-core-for-tablepro-sync-and-icloud.md
#	core/docs/decisions/README.md
…ence every arrival, read a restored file's deletions after its refill
…ns Off, settled once the service before lets go
…oad's iCloud file before a read opens it again
…ns-and-close

# Conflicts:
#	core/crates/sync/src/state/integrity/upgrade.rs
#	core/docs/decisions/0054-one-sync-engine-in-the-core-for-tablepro-sync-and-icloud.md
#	core/docs/decisions/README.md
…ns-and-close

# Conflicts:
#	core/ARCHITECTURE.md
#	core/crates/ffi/src/sync/open.rs
#	core/docs/decisions/README.md
#	windows/src/TablePro.Interop/Generated/tablepro_ffi.cs
#	windows/tests/TablePro.Interop.Tests/SyncTests.cs
…ns-and-close

# Conflicts:
#	core/crates/account/src/account/mod.rs
#	core/docs/decisions/0016-tablepro-accounts.md
#	core/docs/decisions/README.md
…ns-and-close

# Conflicts:
#	apple/TablePro/Resources/Localizable.xcstrings
@datlechin
datlechin merged commit 3c8ce05 into main Nov 30, 2026
2 of 3 checks passed
@datlechin
datlechin deleted the fix/core-move-deletions-and-close branch November 30, 2026 08:11
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