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)
Tue, Oct 15, 9:19 PM
Unknown Object (File)
Tue, Oct 15, 9:19 PM
Unknown Object (File)
Tue, Oct 15, 9:19 PM
Unknown Object (File)
Tue, Oct 15, 9:19 PM
Unknown Object (File)
Tue, Oct 15, 9:19 PM
Unknown Object (File)
Tue, Oct 15, 9:19 PM
Unknown Object (File)
Sep 24 2024, 7:56 PM
Unknown Object (File)
Sep 9 2024, 9:31 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
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 ↗(On Diff #34494)

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