---
title: "Best-of-5 p95 rounds in test_units_store after the nightly flake fixes"
canonical: https://dxdev.com/blog/best-of-five-hid-a-slowdown/
datePublished: 2026-10-23
---
A `test_units_store` p95 check with a 20 ms budget passed on the best of up to five rounds, so an intermittent slowdown passed it too.

## Best-of-5 went in with the other flake fixes

The change to the units_store p95 test was one item in a commit about nightly flakes, which the log counts as "3 test bugs and 1 real gap". The other items:

- `test_compact_stages` and `test_refresh_lock_masking` computed time at import, so they now compute it per test.
- `test_signin_hold` got a wait of 120s.
- `commit_scope_guard` got a git timeout of 600s.
- The units_store p95 test moved to best-of-5 rounds, with the 20 ms budget unchanged.
- The real gap was in `hook_block_pretransition_edit`. Its git probe timed out at 3s and fell open under load. It now waits 15s and fails closed, with 3 new tests.

## The review at 4:55 pm

A review of that commit came back at 4:55 pm with a medium finding on line 59 of the test file. The finding was about taking the minimum p95 across up to five rounds. That turns a p95 performance budget into a different check, because one fast round is enough to pass.

## The median of five fixed rounds

A separate commit asserts on the median of 5 fixed rounds instead of best-of-5, with the 20 ms budget unchanged. The old assertion took the minimum p95 across up to five rounds. The new one always runs five and holds the middle one to 20 ms, so an intermittent slowdown no longer passes.
