Skip to content

fix(sync): a new or recovered device joins a team at its current key, and own key alerts show on the keys page - #4752

Merged
datlechin merged 4 commits into
mainfrom
fix/keys-team-join-personal-notices
Nov 30, 2026
Merged

datlechin merged 4 commits into
mainfrom
fix/keys-team-join-personal-notices

Conversation

@datlechin

@datlechin datlechin commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Root cause, R1 item 11: a device with no version of a team joined at the lowest version wrapped to its account and walked up by Advancing. Its first team pull is a snapshot, whose certificates all land before any version is judged, so each version on the way was judged against its signer's newest av after the whole history. A new device stopped with keys.stale on any version a teammate signed before a later device removal, recovery or replace. After a recovery the account's own older wraps read as stale too, and the next signer as keys.not_holder.
  • The join keeps the first-use pick, then reads the chain above it by the holder rule, each signature counted as it was made: it verifies under its certificate, a replaced IK's older ones included, under no av older than one the chain names for its account below it or in another wrap of the same version. It takes the newest chained version that Advancing takes, else the first-use version as before.
  • A gap, a restart, or a version that does not chain ends the walk. Another account's restart, and a version an invented account appends, are judged by Advancing as before.
  • advance tries clear_stop right after a call stops a team by a catch-up, so a holder's re-confirmation the same pull brought clears it at once. Before, the stop waited for a later key object.
  • Progress::refuse keeps one refusal per record, since the clear judges again what the stop refused.
  • Core ADR 0108, amending 0056: its Status line and index row.
  • Root cause, R1 item 13: Conflict { personal } and the account's own RecoveryKeyReplaced had no reader on the Mac or Windows. The team pages keep only notices about a team or its members.
  • FFI: new KeyNoticeKindTag::OwnRecoveryKeyReplaced, which key_notices gives for a replace notice naming this account. C# bindings regenerated.
  • macOS: Settings > Account > End-to-End Encryption shows an Alerts section first, in the team page's notice style. "Your recovery key was replaced. Only the new one works from now on." (info), or the personal or history key conflict (error), each with Dismiss.
  • macOS model: reads the notices with the page and on every key change, keeps them when a read fails, drops them on an account change.
  • Windows: the End-to-end encryption page shows the same two as closable InfoBars, as its reset notices are.
  • Changed tests:
    • core a_new_member_joins_at_the_version_it_was_confirmed_with_then_follows_the_rule is now a_new_member_joins_at_the_newest_version_wrapped_to_it_and_reads_the_one_below_down_the_ring (Joined at 4, not 3 then 4)
    • Windows OpeningThePageRunsAPassThatEndsTheUnknownState and AnUnknownStateAfterAFailedPassEndsInItsFailureWithNoOtherCall: their call lists gain notices
    • macOS accountChangeForgetsState also checks the alerts.

Test plan

  • Fail on main, pass here:
    • device flows team_join::a_device_new_to_a_team_joins_at_the_version_its_account_holds_after_its_signers_moved_on (main: keys.stale at version 2)
    • team_join::a_device_recovered_with_r_joins_a_team_at_the_version_its_account_holds (main: a stale wrap, then keys.not_holder at version 2)
    • unit a_device_new_to_the_team_joins_past_versions_signed_under_an_av_their_signer_has_left
    • unit a_catch_up_stop_takes_a_re_confirmation_the_same_call_holds
    • unit a_wrap_a_removed_device_signs_after_a_rotation_named_its_accounts_later_av_adds_no_holder
    • the renamed join test.
  • Guards, pass on main and here:
    • a_device_new_to_the_team_never_joins_above_a_version_no_holder_signed
    • a_device_new_to_the_team_never_joins_past_another_accounts_restart_of_a_version_its_account_held
    • a_device_new_to_the_team_never_joins_a_version_signed_under_an_av_its_signer_left_before_the_one_below
    • flow team_join::a_catch_up_stop_takes_a_re_confirmation_the_same_pull_brought. On main the harness's next empty page clears that stop; the unit test above is the one that fails on main.
  • FFI: sync::tests::an_own_recovery_key_replace_reads_as_the_account_s_own_and_a_teammate_s_names_the_teammate.
  • After the rebase on main 747957b440 (the last rebase onto b9c3ba9d32 touched none of these files):
    • cargo test -p tablepro-sync: 1095 passed.
    • cargo test -p tablepro-ffi --lib sync::: 73 passed.
    • cargo clippy --locked -p tablepro-sync -p tablepro-sync-testing -p tablepro-ffi --all-targets -- -D warnings: clean.
    • cargo fmt --check: clean.
  • Before the rebase: cargo test -p tablepro-sync, 1073 passed; cargo test -p tablepro-ffi, 528 passed.
  • verify.sh test AccountKeysModelTests AccountKeysScreenTests AccountSettingsModelTests TeamKeysPresentationTests TeamKeysModelTests ResetKeysModelTests: PASS, 116 of 116.
  • verify.sh lint on the changed Swift files: PASS.
  • verify.sh l10n: the Mac checks pass. The iOS and widget ones need the iOS project, which this tree did not generate, and no iOS file changed.
  • verify.sh --platform windows bindings: PASS after regenerating, on main 747957b440. The last rebase onto b9c3ba9d32 only auto-merged main's own 8-line change in Generated/.
  • Windows TablePro.App.Model.Tests built and run on the Mac: 0 warnings, 1351 passed.
  • Codex review, read-only, two rounds.
    • Round 1, fixed: a wrap a removed device signs after another holder's rotation named the account's later av was judged only against the versions below. Each wrap is now held against every verified wrap of its version too, with a unit test.
    • Round 1, fixed: the C# bindings were not regenerated.
    • Round 2: no findings.
  • Changelog: apple/changelog.d/4752.fixed.md, 4752.fixed.1.md; windows/changelog.d/4752.fixed.md, 4752.fixed.1.md.
  • Docs: docs(sync): alerts on the End-to-End Encryption page docs#324 (draft), merges after this one.

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