Page MenuHomePhabricator

[web/native] Clear device specific data after restoration
AbandonedPublic

Authored by michal on Feb 14 2024, 7:30 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jun 1, 10:40 AM
Unknown Object (File)
Thu, May 23, 6:54 AM
Unknown Object (File)
Tue, May 21, 1:40 PM
Unknown Object (File)
Tue, May 21, 1:40 PM
Unknown Object (File)
Tue, May 21, 1:00 PM
Unknown Object (File)
Feb 29 2024, 2:17 PM
Unknown Object (File)
Feb 20 2024, 6:32 PM
Unknown Object (File)
Feb 20 2024, 4:02 AM
Subscribers

Details

Summary

After restoration we should clear device specific data from the KeyserverStore. It should be filled in by the new device during primary device restoration/ secondary device login.

Depends on D11074

Test Plan

On web and mobile:

  • Restore from backup
  • Restart/ reload the app
  • Check the testing alert introduced in D10787, see if the data from the database has data removed

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

Let me know if I'm missing something, but if there's some data we don't need in the backup, shouldn't we prevent it from being included, instead of clearing it after restoration?

Let me know if I'm missing something, but if there's some data we don't need in the backup, shouldn't we prevent it from being included, instead of clearing it after restoration?

The reason for that is probably due to my concerns that I outlined in D10780. I think that you are right - we should avoid backing those data up instead of removing them after restoration. The problem is that those data are "invisible" in C++ since for KeyserverStore we don't have a C++ db entity like for MessageStore but we just store a JSON string under some id key instead. We could do parsing with folly but it is inefficient, buggy and shows weakness of db design.
The best solution is to migrate db and have a C++ struct for KeyserverStore matching the JS type. With this we would be able remove device specific data from backup with simple SQL query. But the fastest solution to ship is to remove such data in JS after restoration.

Is there a codepath that will lead to populating data that we remove here with accurate data?

I'm not entirely opposed to parsing the JSON in C++ via Folly. Seems better than storing the data only to throw it away

In that case, I will abandon this diff as we will go with a different approach.