Page MenuHomePhabricator

[native] Update `updateRolesAndPermissions` to only handle `LegacyRawThreadInfos`
ClosedPublic

Authored by atul on Dec 10 2023, 4:11 PM.
Tags
None
Referenced Files
F3351398: D10284.diff
Sat, Nov 23, 1:23 AM
Unknown Object (File)
Wed, Nov 6, 1:54 PM
Unknown Object (File)
Tue, Nov 5, 9:43 PM
Unknown Object (File)
Tue, Nov 5, 9:33 PM
Unknown Object (File)
Wed, Oct 30, 3:39 AM
Unknown Object (File)
Oct 15 2024, 10:25 PM
Unknown Object (File)
Oct 15 2024, 10:25 PM
Unknown Object (File)
Oct 15 2024, 10:25 PM
Subscribers
None

Details

Summary

Similar to what we did in D10283, we're "lying" to flow and saying that updatedRolesAndPermissions (which we also rename legacyUpdateRolesAndPermissions) accepts RawThreadInfos instead of just LegacyRawThreadInfos. However, we call assertAllThreadInfosAreLegacy right at the start of legacyUpdateRolesAndPermissions to ensure that only LegacyRawThreadInfos are passed to this function.

It could be argued that this is worse than D10283, because it's unlikely that we'd want to run the convertThreadStoreThreadInfosToNewIDSchema migration again, whereas it's VERY likely that we'll want to run updateRolesAndPermissions in the future. I will introduce a new version of updateRolesAndPermissions that'll handle MinimallyEncodedRawThreadInfos (by going through and converting all to LegacyRawThreadInfos which is what the logic in this migration requires since that's what eg getRolePermissionBlobs and makePermissionsBlob deal with. I'll put that up as a followup diff in this stack (probably before landing anything).

However, as of this diff we're now at 0 flow issues in native/web/keyserver/lib.


Depends on D10283

Test Plan

CI, flow, etc. I think in the future it would be nice to have unit tests for migrations.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul edited the summary of this revision. (Show Details)
atul published this revision for review.Dec 10 2023, 4:22 PM
atul added inline comments.
lib/shared/thread-utils.js
1761 ↗(On Diff #34464)

Actually this is bad, instead I will update legacyUpdateRolesAndPermissions to create a "writeable" copy.

lib/shared/thread-utils.js
1761 ↗(On Diff #34464)

This isn't bad if you accept my change in D10281, is it?

This revision is now accepted and ready to land.Dec 11 2023, 11:17 AM
This revision was landed with ongoing or failed builds.Dec 14 2023, 12:49 PM
This revision was automatically updated to reflect the committed changes.