Skip to content

fix(sync): a deleted connection's history deletions sync, pulls keep saved-query edits, and Windows runs keep their database - #4763

Merged
datlechin merged 9 commits into
mainfrom
fix/history-sync-lane-f
Nov 30, 2026
Merged

datlechin merged 9 commits into
mainfrom
fix/history-sync-lane-f

Conversation

@datlechin

@datlechin datlechin commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Summary

  • History (core sync): a run's deletion whose connection the connection list no longer holds now goes up when the state file holds the run as on the server and never recorded the connection as kept off sync. Otherwise it stays on the device, so a Local only connection's run ids never leave it. A list not read yet still waits.
  • iCloud: a Standing row follows its connection's current standing on every push, so a connection that syncs again after Local only sends its later deletion without a fetch in between.
  • Saved queries (core sync): a pull writes with the store digest its kind last read (SavedQueries::write_over). The store refuses it with ImportOutdated, mapped to the stale store error, when the person edited since. Each kind keeps its own read, and a sibling's write moves it on only when both read the same store.
  • Windows: HistoryRun and HistoryEntry carry Database, and a query tab records the database the run began in, so other devices show where a Windows run ran.
  • iOS: the SSH unlink and SSL require flags live in the core's connection records (ssh_profile_unlinked, tls_mode_unsettled). The UserDefaults keys are read once and moved, keeping only the ids of records this build cannot read. The move's write is named in the downgrade mirror's record, so a later edit by the previous stable is still taken in.
  • .claude/rules/data-sync-storage.md: the iOS flags row.
  • Changelog fragments for the Mac, Windows and Linux.
  • Test changed on purpose: adapters::saved_queries::tests::a_pulled_change_keeps_the_connection_name_the_device_shows now reads the store before the pull's write, as the engine does.
  • Paired docs: docs(features): a deleted connection's history leaves other devices docs#327.

Test plan

  • Fail before the fix, pass here:
    • sync engine: the_deletion_of_a_deleted_connection_s_runs_reaches_the_server, a_connection_kept_here_and_then_deleted_keeps_its_runs_deletions_here, a_local_only_connection_deleted_before_it_ever_synced_sends_nothing_of_its_runs, a_local_only_connection_no_pass_saw_keeps_its_runs_deletions_here;
    • sync cloudkit: a_connection_that_syncs_again_sends_its_deletion_with_no_fetch_between;
    • sync lib: a_pull_never_writes_over_an_edit_made_after_its_read, an_edit_between_the_reads_of_one_page_keeps_the_kind_read_first_off_it;
    • iOS CoreLibraryStoreTests: earlierDeviceFlagsMoveIntoTheRecords, previousStableEditAfterTheFlagsMoved, earlierFlagsOfAHeldConnectionStay;
    • Windows QueryTabHistoryTests: ARunIsKeptWithTheDatabaseItRanIn, ARunInTheDatabaseTheTabPickedIsKeptThere.
  • Pinning tests: storage a_write_based_on_an_older_read_writes_nothing_and_one_on_the_last_read_lands, sync a_connection_is_gone_only_from_a_list_that_was_read, ffi a_recorded_run_keeps_the_database_the_app_named, interop HistoryTests.ARunKeepsTheDatabaseItRanIn (Windows CI).
  • cargo test after merging main: sync lib 402, engine 183, cloudkit 180 and every other sync test target, storage saved_queries 83, ffi history 8, ffi sync:: 77. cargo fmt --check clean.
  • cargo clippy --locked --all-targets -D warnings on storage, sync, sync-testing, ffi, account, cli, foreign-import, mcp, records, session: clean.
  • verify.sh ios on CoreLibraryStoreTests, LibraryRecordMappingTests, AppStateLibraryTests, ConnectionFormEditsTests, IOSConnectionImportIconTests, IOSConnectionImportServiceTests, IOSSyncCoordinatorTests: PASS, 237/237 (CoreStore unchanged on main since).
  • Windows TablePro.App.Model.Tests on macOS with a placeholder core library: 1443 pass. 45 fail only because no core library loads there; LocalizationTests.EveryCodeTheCoresSyncKeysAndAccountReturnIsWorded fails on main too (account.no_install_id from feat(core): give each OS user on a machine a device row of its own #4746 has no Windows string).
  • Codex review: three rounds; round 1 found three mediums (shared read digest across kinds, a never-synced Local only connection's run ids, iOS flags of unread records), round 2 found two (a connection no pass saw, iCloud rows that never followed a connection syncing again), all fixed with tests; round 3 no findings. Accepted trade-off: after a state reset, a deleted connection's run outside the refetched window keeps its server copy, since missing evidence never sends ids.

… saved-query pull never writes over an edit made after its read
…ed-query kind writes over its own read, and iOS keeps unread records' flags
…a run the server holds, and iCloud's standing rows follow a connection that syncs again
Standing rows stay for connections a base names, as main's rejoin rule reads them; the history adapter's base check covers a connection that never synced.
@datlechin
datlechin merged commit 259c901 into main Nov 30, 2026
1 of 2 checks passed
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