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:

.groupTuple(
         by: [0],
         sort: { e1, e2 -> e1[1] <=> e2[1] }
    ).view()

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

.groupTuple(
         by: [0],
         sort: { e1, e2 -> e1 <=> e2 }
    ).view()

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