Page MenuHomePhabricator

[lib] Update `convertClientDBThreadInfoToRawThreadInfo` to validate `ThreadCurrentUserInfo`
ClosedPublic

Authored by atul on Dec 12 2023, 12:30 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 13 2024, 11:28 PM
Unknown Object (File)
Sep 9 2024, 9:13 PM
Subscribers
None

Details

Summary

Similar to D10313 and D10298, this diff addresses what we learned when testing D10297 that it's important that we validate the stringified JSON that we retrieve from ClientDBThreadInfo. Specifically, it's possible for ClientDBThreadInfo to have either stringified MinimallyEncodedThreadCurrentInfo or ThreadCurrentInfo (yes, we didn't end up renaming this to LegacyThreadCurrentInfo because we didn't end up needing a union type, but I will change the name for symmetry) stored in the currentUser field, and we should A. validate that the data is correctly formed and B. determine what format the data is in.


Depends on D10313

Test Plan

Will be tested along with changes in D10297 and D10298 and D10313.

Diff Detail

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

Event Timeline

atul published this revision for review.Dec 12 2023, 12:32 PM
atul added inline comments.
lib/utils/thread-ops-utils.js
54 ↗(On Diff #34538)

Shortened so could keep the rawCurrentUser invariant message line under 80 characters and updated these as well to maintain symmetry.

When I'm rebasing I'll probably just make the comment changes in place for cleaner diffs.

fix (possible) minimal encoding of rawCurrentUser if not already minimally encoded.... just spent last 1.5 hours trying to figure out what was wrong, definitely going to add some invariants that would've broke "loudly" instead of erroneously encoding silently

This revision is now accepted and ready to land.Dec 12 2023, 4:52 PM
This revision was landed with ongoing or failed builds.Dec 13 2023, 1:34 PM
This revision was automatically updated to reflect the committed changes.