Page MenuHomePhabricator

[native] Update unshimClientDB to reflect best practices
ClosedPublic

Authored by ashoat on May 5 2024, 12:27 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 11, 12:52 AM
Unknown Object (File)
Sun, Nov 10, 11:06 PM
Unknown Object (File)
Sun, Nov 10, 9:59 PM
Unknown Object (File)
Sun, Nov 10, 11:55 AM
Unknown Object (File)
Fri, Nov 8, 5:44 AM
Unknown Object (File)
Fri, Nov 8, 5:38 AM
Unknown Object (File)
Fri, Nov 8, 3:40 AM
Unknown Object (File)
Oct 11 2024, 12:21 AM
Subscribers
None

Details

Summary

Noticed some issues while working on the web equivalent:

  1. The operations are performed on SQLite but not applied to the local Redux store. As a result, the updated database won't be picked up until the next app restart. Figured it would be better to apply it immediately.
  2. We were using custom logic instead of handleReduxMigrationFailure.

Depends on D11886

Test Plan

Tested the farcaster_mutual migration on a native client

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ashoat requested review of this revision.May 5 2024, 1:15 PM
This revision is now accepted and ready to land.May 6 2024, 1:06 AM

Not sure if this is the best solution, but the old code is also incorrect.

The function unshimClientDB is used in migrations 32, 33, 35, and 39 it uses handleReduxMigrationFailure which modifies keyserverStore's cookie but cookie itself was moved there in migration 44 (code on the left is doing the same unfortunately).

We should probably do something like in the case of deprecatedUpdateClientDBThreadStoreThreadInfos where handleMigrationFailure is an optional param - but not sure if it's still worth it as it's touched old migrations.

Also, wondering what's the best pattern to avoid things like this in the future, I am skeptical about factoring out code from migrations to functions because it causes situations like this one.

Thanks @kamil... those concerns make sense. As this diff isn't regressing anything, I'll go ahead and land it, and then attempt to address the issues you brought up in a separate diff.

D11928 is the follow-up to address the issue @kamil brought up