Page MenuHomePhabricator

[native][web] Add migrations unshimming delete messages
ClosedPublic

Authored by tomek on Wed, Apr 9, 7:57 AM.
Tags
None
Referenced Files
F6082985: D14561.diff
Sun, Apr 20, 10:44 PM
F6080100: D14561.id.diff
Sun, Apr 20, 7:00 PM
F6064244: D14561.id47803.diff
Sun, Apr 20, 11:12 AM
Unknown Object (File)
Sun, Apr 20, 1:56 AM
Unknown Object (File)
Fri, Apr 18, 9:48 PM
Unknown Object (File)
Fri, Apr 18, 10:45 AM
Unknown Object (File)
Fri, Apr 18, 4:06 AM
Unknown Object (File)
Fri, Apr 18, 4:06 AM
Subscribers

Details

Summary

This migration handles received messages that were unsupported.

https://linear.app/comm/issue/ENG-10465/unshim-delete-message

Depends on D14560

Test Plan

Run the app in an older version, receive a delete message, run an updated app - check if the unsupported messages disappear and deleted messages are replaced.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tomek requested review of this revision.Wed, Apr 9, 8:15 AM
tomek edited the test plan for this revision. (Show Details)
ashoat added inline comments.
web/redux/persist.js
822–826 ↗(On Diff #47718)

Why don't we need handleReduxMigrationFailure here?

This revision is now accepted and ready to land.Wed, Apr 9, 7:56 PM
tomek added inline comments.
web/redux/persist.js
822–826 ↗(On Diff #47718)

It's an interesting question. This util was initially introduced in https://phab.comm.dev/D11885 where handleReduxMigrationFailure wasn't present as a parameter, but it was used internally when handling exceptions. Then in https://phab.comm.dev/D13889 handleReduxMigrationFailure was replaced by rethrowing an exception. I don't understand why we removed this call, but I believe it should be there. @bartek do you have some context?

This revision now requires review to proceed.Thu, Apr 10, 6:41 AM
bartek added inline comments.
web/redux/persist.js
822–826 ↗(On Diff #47718)
  • In D13889, original unshimClientDB was renamed to legacyUnshimClientDB, and new unshimClientDB was introduced. The former was used for legacy migrations.
  • There is some context in D11928 as to why handleMigrationFailure was introduced as a parameter to the unshim func. But I guess it's only for native, and web has never had this param.

Then in https://phab.comm.dev/D13889 handleReduxMigrationFailure was replaced by rethrowing an exception.

In https://phab.comm.dev/D13889?id=45703 @ashoat did these changes to the unshim func after I failed to do the migration (see the diff history). I didn't have much knowledge about unshimming and migrations and I didn't argue with these changes. Unfortunately, I have no more context beyond that.
Just note that migration I introduced there was native-only and it was no-op for web, so the unshim func wasn't really tested.

Anyway, since the unshim func on web doesn't take the handleMigrationFailure param, this diff is okay and any fixes/adjustment to the unshimming should probably be done separately.

This revision is now accepted and ready to land.Fri, Apr 11, 12:20 AM
ashoat requested changes to this revision.EditedFri, Apr 11, 8:06 AM

A cursory glance shows that createAsyncMigrate handles calling handleReduxMigrationFailure when an exception is thrown. I wish both @tomek and @bartek had looked at the code a little closer here.

This revision now requires changes to proceed.Fri, Apr 11, 8:06 AM

Revert error handling change

ashoat added inline comments.
native/redux/persist.js
1590 ↗(On Diff #47770)

It looks like native's unshimClientDB is different since it doesn't throw an exception. It would probably be safe to change it to match web given that both use createAsyncMigrate, but I suppose that's outside the scope of this diff, and probably not the best thing to prioritize right now

This revision is now accepted and ready to land.Mon, Apr 14, 6:41 AM
native/redux/persist.js
1590 ↗(On Diff #47770)

Created a general task https://linear.app/comm/issue/ENG-10552/review-client-migrations-error-handling to track reviewing our error handling