Skip to content

feat(sdk): Loop over and delete all backup versions on identity reset#6744

Open
kaylendog wants to merge 3 commits into
mainfrom
kaylendog/backups/loop-delete
Open

feat(sdk): Loop over and delete all backup versions on identity reset#6744
kaylendog wants to merge 3 commits into
mainfrom
kaylendog/backups/loop-delete

Conversation

@kaylendog

@kaylendog kaylendog commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

This PR adjusts the identity reset logic to loop on GET /_matrix/client/v3/room_keys/version, deleting all backups until none remain.

When we reset our identity, we delete the current backup version, but not any other versions if they happen to exist. This can leave clients in a broken state where they are unable to enable key backup since one already exists server-side. Deleting all backup versions on reset should fix this issue.

  • I've documented the public API changes in the appropriate changelog files (see Writing changelog entries).
  • This PR was made with the help of AI.

Signed-off-by: Skye Elliot actuallyori@gmail.com

@kaylendog kaylendog self-assigned this Jul 13, 2026
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
@kaylendog kaylendog force-pushed the kaylendog/backups/loop-delete branch from f8efc61 to b2f3c40 Compare July 13, 2026 07:37
@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.89%. Comparing base (390f6c0) to head (b461727).
⚠️ Report is 9 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
crates/matrix-sdk/src/encryption/backups/mod.rs 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6744      +/-   ##
==========================================
- Coverage   89.91%   89.89%   -0.02%     
==========================================
  Files         398      398              
  Lines      111310   111308       -2     
  Branches   111310   111308       -2     
==========================================
- Hits       100083   100062      -21     
- Misses       7420     7437      +17     
- Partials     3807     3809       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@codspeed-hq

codspeed-hq Bot commented Jul 13, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 50 untouched benchmarks


Comparing kaylendog/backups/loop-delete (b461727) with main (afc182e)

Open in CodSpeed

@kaylendog kaylendog marked this pull request as ready for review July 13, 2026 08:14
@kaylendog kaylendog requested a review from a team as a code owner July 13, 2026 08:14
@kaylendog kaylendog requested review from poljar and uhoreg and removed request for a team July 13, 2026 08:14

@uhoreg uhoreg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable, but a couple of nits.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doc comment needs updating too

@kaylendog kaylendog Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in b461727

@@ -0,0 +1 @@
Resetting your cryptographic identity now iteratively deletes all server-side key backup versions.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change affects more than just resetting. It also affects recover_and_fix_backup and, of course, direct calls to disable_and_delete. If you don't want to list them all, maybe something like "Functions that delete key backups, such as resetting your cryptographic identity, ..."?

@kaylendog kaylendog Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in b461727

@kaylendog kaylendog force-pushed the kaylendog/backups/loop-delete branch from 218cfb2 to b461727 Compare July 14, 2026 07:36
@kaylendog kaylendog requested review from uhoreg and removed request for poljar July 14, 2026 07:36
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.

2 participants