-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Identity reset backup fixes #3790
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3790 +/- ##
==========================================
+ Coverage 84.06% 84.07% +0.01%
==========================================
Files 261 261
Lines 27352 27365 +13
==========================================
+ Hits 22993 23008 +15
+ Misses 4359 4357 -2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good but needs a bit more polish.
@@ -423,6 +423,39 @@ impl Backups { | |||
Ok(()) | |||
} | |||
|
|||
/// Deletes the current backup version from the server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this need a bit more of a warning, feel free to add some disable()
mehod from, and to, this one.
As usual, an doc example wouldn't hurt either.
|
||
olm_machine.backup_machine().disable_backup().await?; | ||
|
||
self.set_state(BackupState::Unknown); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both the OK and error case go into the Unknown
state, so you can just have one set_state()
in the main part of the function, just before you return the result
.
@@ -780,11 +780,15 @@ async fn test_reset_identity() { | |||
assert_eq!(client.encryption().recovery().state(), RecoveryState::Enabled); | |||
|
|||
// Disabling backups | |||
Mock::given(method("DELETE")) | |||
.and(path("_matrix/client/r0/room_keys/version/1")) | |||
Mock::given(method("GET")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are not quite testing the happy path if you never need to mock the DELETE
endpoint. You're returning a 404 on the GET version call, so the SDK concludes that a backup doesn't exist and doesn't need to be deleted.
A valid test, but if we had a test for the happy path, which does need to delete the backup as well.
294c424
to
50973fe
Compare
…s if they weren't previously enabled locally - also change back the state from `disabling` to `unknown`
…ed locally, resulting in conflicts and failing to correctly setup the newly reset session
50973fe
to
1402382
Compare
This PR handles 2 different issues:
backups().disable
method does not delete the remote backup if the backups haven't been setup yet locallyWe've introduced a new
delete_backup
method what will delete remote backups and that can be used from the identity reset flows to correctly setup the fresh session.