HomePhabricator
Diffusion Comm 5d62218e3325

[lib] Update `convertClientDBThreadInfoToRawThreadInfo` to validate…

Description

[lib] Update convertClientDBThreadInfoToRawThreadInfo to validate MemberInfos

Summary:
Based on what we found while testing D10297, it's critical that we ensure that we validate the stringified JSON that we retrieve from ClientDBThreadInfo. Specifically, it's possible for ClientDBThreadInfo to have either stringified MinimallyEncodedMemberInfo or LegacyEncodedMemberInfo stored in the .members field, and we should A. validate that the data is correctly formed B. determine which format the data is in.

This diff is a proof-of-concept for how can also handle things for roles and currentUser.

NOTE: It could be argued that there's too much looping through data here and we're doing "unnecessary work" with all the invariants, but I think it's helpful at least for now to validate things while testing to make sure things work. As a followup, we can consider using a less intense approach/trust that the data stored in ClientDBThreadInfo will always be correctly formed, etc. Personally think it would give me peace of mind to have this in place to surface issues when we initially "flip the switch."

Depends on D10297

Test Plan: Will be tested along with changes in D10297

Reviewers: ashoat, ginsu, tomek, rohan

Reviewed By: ashoat

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