- All playbooks
- Make unordered results deterministic before comparing
Make unordered results deterministic before comparing
Sort values whose order was never guaranteed, so an equivalent result passes on the first run.
Company examples
How Uber used this technique
Read what Uber changed and follow the original sources.
Make unordered results deterministic before comparing
Cadence sorted the active-cluster list before formatting a domain error. A test expected [A B] while an equivalent result arrived as [B A]. OPT48 is adapted to one order-dependent test, and the change sorts the production error output.
The PR shows the expected and actual output from the flaky run and a two-line sort. Source
- Use it when
- A test compares ordering the producer never guaranteed, and deterministic ordering suits the public output.
- Before applying it
- Decide first whether ordering is part of the output contract. Sorting in place mutates the caller's slice, so sort a copy where callers share it, and keep membership and error-field assertions.
Company Playbooks
- Read Anthropic’s playbookRun only affected tests
- Read DoorDash’s playbookRun build and test in parallel, sharded across CI agents
- Read Linear’s playbookBenchmark the same job on faster hardware
- Read Mastra’s playbookStarSling runners for the slowest test workflow
- Read OpenAI’s playbookRank CI fixes by the minutes they save
- Read Ramp’s playbookMove a CPU-bound test suite to a faster CPU
- Read Shopify’s playbookLet an agent iterate against one CI metric
- Read Spotify’s playbookBuild arm64 on native arm64 runners
- Read Stripe’s playbookRun only the tests a change can reach
- Read Uber’s playbookBuild the merge-queue speculations most likely to be needed