Our offline UR5e tracker gives attempt two the result from attempt one when I delay the first completion. Random sleeps hide it half the time. How should I make that test repeatable?
We stopped using wall-clock delays for this sort of test and delivered queued messages at named steps instead. Hold the old completion, establish the new attempt, then deliver the old one. Check the stored state right there, before anything else can tidy it up.
I can do that with our test loader. Both completions contain an attempt reference; our helper only compares the coupon label. That looks like the mistake.
Useful. Now you can show the fault without telling someone to run it until they're lucky. Include the current completion after that failed step when testing the fix, so rejecting everything won't count as success.
Updated matcher uses the attempt reference as well as the coupon. Old result no longer closes the new attempt, and the current result still works. Thanks for the queued ordering.
Found another bug there. It increments the total twice even though the attempt stays completed. Adding that duplicate to the test before changing the count handling.
Good catch. Keep the old-result and duplicate-current-result cases separate in the output, because you've found two different mistakes and a future maintainer needs to see which one returns.