When both projects lack timestamps and have no threads, getProjectSortTimestamp returns NEGATIVE_INFINITY for both. Subtracting NEGATIVE_INFINITY - NEGATIVE_INFINITY yields NaN, and since NaN !== 0 is true, the comparator returned NaN instead of falling through to the name/id tiebreaker. Add Number.isNaN guard to the condition.