Finding
autobot-backend/utils/file_locking_test.py:413 test_different_files_can_write_concurrently asserts a 0.04s wall-clock budget.
Measured on unmodified Dev_new_gui: failed 2 of 13 runs.
A wall-clock assertion that tight is not testing concurrency — it is testing whether the machine was briefly busy. It appears in the standing flapper set alongside system_benchmarks, performance_benchmarks and pii_pipeline p99, all of which share the same shape.
Why it is getting worse
PR #13356 converts two source-grep tests in this same file into genuine 20-thread race tests (for the #513 and #481 locks). That is the right conversion — but it adds real thread contention to the file, so this timing assertion will fire more often.
Fix
Assert the property, not the duration. The test wants to show that two writers to different files do not serialise against each other. Options:
- have each writer signal a
threading.Event on entry and assert both are set before either exits — proves overlap directly, with no clock
- or assert a ratio against a measured serial baseline in the same run, rather than an absolute constant
Either survives a slow or loaded runner, which an 0.04s constant cannot.
Worth applying the same treatment to the other wall-clock flappers while in the area: they cost real signal, because a suite with known-flaky tests trains everyone to re-run rather than investigate.
Discovered during
Review of PR #13356, measured on unmodified HEAD across 13 runs.
Related
Finding
autobot-backend/utils/file_locking_test.py:413test_different_files_can_write_concurrentlyasserts a 0.04s wall-clock budget.Measured on unmodified
Dev_new_gui: failed 2 of 13 runs.A wall-clock assertion that tight is not testing concurrency — it is testing whether the machine was briefly busy. It appears in the standing flapper set alongside
system_benchmarks,performance_benchmarksandpii_pipeline p99, all of which share the same shape.Why it is getting worse
PR #13356 converts two source-grep tests in this same file into genuine 20-thread race tests (for the
#513and#481locks). That is the right conversion — but it adds real thread contention to the file, so this timing assertion will fire more often.Fix
Assert the property, not the duration. The test wants to show that two writers to different files do not serialise against each other. Options:
threading.Eventon entry and assert both are set before either exits — proves overlap directly, with no clockEither survives a slow or loaded runner, which an 0.04s constant cannot.
Worth applying the same treatment to the other wall-clock flappers while in the area: they cost real signal, because a suite with known-flaky tests trains everyone to re-run rather than investigate.
Discovered during
Review of PR #13356, measured on unmodified HEAD across 13 runs.
Related