In the comparison output if two resources have the same name they currently get treated as a single resource. They should be treated as two separate resources.
Typical example would be multiple editions of a book which have same title but would be different title instances with different edition info, but could happen in any situation where resources just happen to have the same title string.
We do use name. And we can't use IDs because they don't naturally sort. If we swap to use IDs it will break. We would have to read ALL results into memory to do anything else and we'd soon have OOM errors.
We need to know whether a result from comparison B is less or greater than the one we currently have in order to group on the way out. We can't do that with IDs. All we know is that they are different, not whether the one from B should be the current or not.
We can... Tack the ID onto the end of the title. That would keep things in working order: