SIGN IN SIGN UP

fix(profile): the cache tests raced on one process-global counter

`invalidate_forces_refresh` failed intermittently at
`assert!(CACHE_STATS.misses() > miss_before)`. `CACHE_STATS` is a single
process-global and cargo runs these tests as threads in one process, so
`cold_call_misses_warm_call_hits`'s `reset()` could land between the read of
`miss_before` and the assertion, taking the count backwards. The behaviour was
never wrong; the test was asserting on thread scheduling.

It passes single-threaded and passes three times in a row in isolation, and
only fails under the full 825-test parallel load -- which is what made it read
as noise rather than as a defect.

All three tests in the module now take a guard. `snapshot_all_populates_all_subsystems`
takes it too: it asserts nothing about the counters but increments the same
ones the others assert on, so exempting it would leave a narrower version of
the same race.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A
Adam Erickson committed
2e6f9e964b0a94fc37c0e5b749b48f28dc114f2b
Parent: 9452a01