Page MenuHomePhabricator

[lib] Update `convertClientDBThreadInfoToRawThreadInfo` to validate `MemberInfo`s
ClosedPublic

Authored by atul on Dec 11 2023, 5:15 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Nov 6, 1:37 PM
Unknown Object (File)
Wed, Nov 6, 12:57 AM
Unknown Object (File)
Wed, Nov 6, 12:44 AM
Unknown Object (File)
Tue, Nov 5, 10:30 PM
Unknown Object (File)
Tue, Nov 5, 10:25 PM
Unknown Object (File)
Oct 15 2024, 9:19 PM
Unknown Object (File)
Oct 15 2024, 9:19 PM
Unknown Object (File)
Oct 15 2024, 9:19 PM
Subscribers
None

Details

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

Diff Detail

Repository
rCOMM Comm
Branch
master
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

atul published this revision for review.Dec 11 2023, 5:17 PM
ashoat added inline comments.
lib/utils/thread-ops-utils.js
41–53

Can we collapse this into a single loop?

This revision is now accepted and ready to land.Dec 11 2023, 8:32 PM

address feedback: merge loops

shorter invariant message