Repository navigation
fix(sync): a device signed in again after its removal takes over its state file instead of failing with wrong_identity - #4708
Merged
Conversation
…le its removed row left
…a repaired file names no older certificate
This was referenced Nov 28, 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
sync.state.wrong_identityfor good: Sync Now, the key screens, Team Library, and Sign Out's key erase and Team Library delete.keys::open_service_state, ADR 0081):StateStore::move_to_row);device_removedalone still erases nothing: the erase runs at the person's next sign-in on a new row.StateFiles::other_rowreads which row of the account the file is bound to; a refused open now closes its connection before it lets the lock go, so the next open never waits on it.KeyService::erase_replaced_rowshares Sign Out's record and erase steps, split out offinish_signing_out.avfrom 1 to the device's own pin, not only the pin's and the certificates the key tables hold: a file repaired from its checkpoint keeps the pin but no older certificate (Codex review finding).ServiceEngine::startuses it, so macOS, iOS and Windows heal at their next start while signed in. The exported FFI is unchanged, so no binding changes.sync.state.wrong_identityorsync.state.integrityis a newstateUnreadablefailure. The question then offers no Upload and says the sync data couldn't be read, instead of "The upload did not finish. The team library refused the change". Publish and status texts get the same words.TeamLibraryTests.uploadListsWhatIsLeftandsignOutListsHiddenEditsreadunsentChanges()andupload()through their newResult.Test plan
ffisync::tests::a_sign_in_on_a_new_row_after_a_removal_starts_as_a_new_device(approve on one row, server removes it, open on a new row of the same account: syncs, needs approval, old row's keys gone). On main it fails onkey_statewithsync.state.wrong_identity.syncaccount_keys::replaced_row: take-over as a new device keeping bases; a take-over cut off partway finishing at the next sign-in; the erase sends no revoke; account keys of everyavup to the pin go; a file holding key rows keeps its row;other_rownames only another row of the same account and makes no file.AccountSettingsModelTests.unreadableSyncDataOffersNoUpload.cargo test --locked -p tablepro-sync -p tablepro-sync-testing: all suites pass (account_keys 91, engine 178, state_integrity 165, team_library 53, ...).cargo test --locked -p tablepro-ffi --lib sync::: 70 passed.cargo clippy --locked -p tablepro-sync -p tablepro-sync-testing -p tablepro-ffi --all-targets -- -D warnings: clean.cargo fmt --check: clean.verify.sh --jobs 4 test AccountSettingsModelTests TeamLibraryTests TeamLibraryHeaderTests: PASS, 58 passed.verify.sh linton the changed Swift files: PASS.ServiceEngine::start.ava repaired file no longer names). The reset keys of a pending reset on a file put back from an older copy stay in the device store, as after Sign Out on such a file; ADR 0081 records it, since the device store lists no items by account.