[lib] Simplify sorting local ids
Summary:
issue: ENG-7651
Since local ids are now uuids, not consecutive numbers, we don't want to sort them like number. But we do care that they are always sorted in the same order. So we want to sort them lexicographically (within one time - we first sort all ids by time). We walso want the local ids to be after any realised ids (again, withing one time).
Test Plan: ran the provided tests
Reviewers: michal, tomek
Reviewed By: michal
Subscribers: ashoat
Differential Revision: https://phab.comm.dev/D11565