HomePhabricator
Diffusion Comm e40290b7161c

[lib] Fix `threadPermissionsFromBitmaskHex` invariant

Description

[lib] Fix threadPermissionsFromBitmaskHex invariant

Summary:
Really shouldn't have made this mistake...

After moving things around to resolve circular dependency issue, I accidentally started using the tHexEncodedRolePermission check in threadPermissionsFromBitmaskHex instead of the tHexEncodedPermissionsBitmask check...

This required that we have >=3 hex characters, when there's no such minimum for thread permissions.

Caught this during native testing thanks to thread where permissions for some user were "3", which should have been valid.

I read through minimally-encoded-thread-permissions again very carefully to see if there were any other mistakes I could find. I think part of the reason for the error may have been the similar-ish naming of all the utilities/etc. I'll see if I can update those to be more clear.

Also went ahead and included unit test that would've caught the issue earlier.


Depends on D10295

Test Plan: Unit test, careful re-reading of threadPermissionsFromBitmaskHex.

Reviewers: ashoat, ginsu, tomek, rohan

Reviewed By: ashoat

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

Details

Provenance
atulAuthored on Dec 13 2023, 1:02 PM
Reviewer
ashoat
Differential Revision
D10296: [lib] Fix `threadPermissionsFromBitmaskHex` invariant
Parents
rCOMM347740333ec0: [lib] Update `threads-state-sync-spec` to use more general `RawThreadInfo[s]`
Branches
Unknown
Tags
Unknown