HomePhabricator
Diffusion Comm 0bdd01b5fe49

[keyserver][lib] Make updates code aware that ids are strings, not numbers

Description

[keyserver][lib] Make updates code aware that ids are strings, not numbers

Summary:
issue: https://linear.app/comm/issue/ENG-6822/creating-db-fails-when-using-identity-ids
sortIDs has two branches, because the old code would sotr ids by converting them to numbers, comparing like numbers, and converting back to ids. Now that ids can be strings, other than stringified numbers, we need to compare them as strings. But this means that when the old logic would sort 99 before 100, the new logic would do the opposite.
And we need the old logic and the new logic to return the same order, because based on this order key of update is created, and based on the key we decide which updates eliminate each other.

Test Plan:
Tested that sortIDs doesn't turn uuids into NaNs anymore, but correctly sorts them with other ids.
Tested that a newly created db has the key column of the updates table be a varchar(255)
Tested migrating from a db that had the key column bigint(20) - all ids got correctly translated, no errors showed up.

Reviewers: tomek, michal

Reviewed By: tomek

Subscribers: ashoat

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

Details

Provenance
inkaAuthored on Feb 19 2024, 4:45 AM
Reviewer
tomek
Differential Revision
D11104: [keyserver][lib] Make updates code aware that ids are strings, not numbers
Parents
rCOMM467af97c2dd5: [scripts] Remove flow annotation
Branches
Unknown
Tags
Unknown