Page MenuHomePhabricator

[keyserver] Improve Flow types in update-creator
ClosedPublic

Authored by tomek on Aug 9 2023, 6:10 AM.
Tags
None
Referenced Files
F2078622: D8768.id.diff
Sat, Jun 22, 5:19 PM
Unknown Object (File)
Fri, Jun 21, 9:57 AM
Unknown Object (File)
Fri, Jun 21, 9:57 AM
Unknown Object (File)
Fri, Jun 21, 9:57 AM
Unknown Object (File)
Thu, Jun 20, 1:15 PM
Unknown Object (File)
Wed, Jun 19, 2:51 AM
Unknown Object (File)
Mon, Jun 17, 9:01 PM
Unknown Object (File)
Tue, Jun 11, 3:38 PM
Subscribers

Details

Summary

We had a type error and Flow was unable to detect that. This diff makes it so the type error would be reported and replaces false with null to satisfy type system. In fetchMessageInfos and parseMessageSelectionCriteria we're using threadCursors[threadID] in if conditions so it is safe to do that replacement.

https://linear.app/comm/issue/ENG-4592/improve-flow-types-in-update-creator

Test Plan

Console log messageInfoResult before and after change and check if the result remains correct.

Diff Detail

Repository
rCOMM Comm
Branch
state-sync
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

tomek requested review of this revision.Aug 9 2023, 6:28 AM
kamil added inline comments.
keyserver/src/creators/update-creator.js
461

Not sure if this will work, but if yes it seems safer

This revision is now accepted and ready to land.Aug 16 2023, 1:57 AM
keyserver/src/creators/update-creator.js
461

It definitely would be safer but isn't possible because all the props of ThreadCursors are read-only.