Sorting within a tuple

I have a list like so:

[[id:test1], test1_replicate1.entropy.full]
[[id:test1], test1_replicate2.entropy.full]
[[id:test2], test2_replicate1.entropy.full]
[[id:test2], test2_replicate2.entropy.full]

and I now want to group by id and sort it so that replicate1 goes before replicate2. I am doing this:

         by: [0],
         sort: { e1, e2 -> e1[1] <=> e2[1] }

but it’s not sorting correctly:

[[id:test2], [test2_replicate2.entropy.full, test2_replicate1.entropy.full]]
[[id:test1], [test1_replicate1.entropy.full, test1_replicate2.entropy.full]]

why not?

I think just using

         by: [0],
         sort: { e1, e2 -> e1 <=> e2 }

should work unless they’re files in which case, use <=> I think the sort is called on the list now directly rather than on the grouped tuple.