[#86778] Unreconciled order_detail sorting

This is to address the sorting/grouping issues seen on stage, though I can't say for sure if this will resolve it because I haven't been able to reproduce it locally (both with MySQL and Oracle). That change is in c52330e133749d60a2086f8bfc958effafb856a8.

The rest of the commits refactor and add tests.
You could probably build this into the `double` initializer. I believe you could do

```ruby
5.times.map { |n| double OrderDetail, cost_estimated?: true, estimated_total: n + 1 }
```