HomePhabricator
Diffusion Comm 4f8b105b534f

[native] Introduce `assertAllThreadInfosAreLegacy` to address migration 29…

Description

[native] Introduce assertAllThreadInfosAreLegacy to address migration 29 flow issues

Summary:
We can safely assume that when older migrations are run that all of the RawThreadInfos will be LegacyRawThreadInfos and we don't need to worry about MinimallyEncodedRawThreadInfos. So, instead of updating all of those migration functions to accomodate MinimallyEncodedRawThreadInfos, we can instead use assertAllThreadInfosAreLegacy to assert that we'll always be passing LegacyRawThreadInfos to them.

We basically go through every RawThreadInfo and ensure that it's a LegacyRawThreadInfo by asserting that the minimallyEncoded field is missing. Then, at the callsite (migration 29), we immediately cast back to:

{
  +[id: string]: LegacyRawThreadInfo,
}
NOTE: Discussed an alternative approach with @ashoat that allows us to avoid any-casting. Will put up rest of the diffs in this stack, then: 1. Either update this diff in place 2. Introduce follow-up diff

[skip-ci]


Depends on D10280

Test Plan: CI/flow/etc.

Reviewers: ashoat, ginsu, tomek, rohan

Reviewed By: ashoat

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D10281