fix(test_wait_tool_early_end): scope the wait-tool fake clock to the wait loop thread - #2460
Conversation
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 4.8 Review — ✅ no blocking findingsReviewed Review detailsThis is a test-only change. The No correctness, security, or resource concerns on the changed lines. No findings. [OPUS-REVIEWED] ebd232b Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
Design Review (Fable 5) — ✅ PASSAdvisory design-level review of Design-Verdict: PASS Root-cause fix at the right layer: the fake clock now engages only on the wait-loop's own thread, with a regression test that pins the leak. [DESIGN-REVIEWED] ebd232b |
…wait loop thread (kirodotdev#2460) Co-authored-by: Thomas Lobinger <23685+tlobinger@users.noreply.github.com>
Summary
This PR combines 1 related change:
Changes and rationale
Scope the wait-tool fake clock to the wait loop thread
Problem: test/test_wait_tool_early_end.py fabricates a fake monotonic clock by patching the GLOBAL time module (
patch.object(_time, "monotonic", ...)+patch.object(_time, "sleep", ...)in _run_wait, ~lines 62-67). The patch is process-wide, so any background thread alive in the pytest worker that calls time.sleep() advances the fake clock too. The tests then assert EXACT equality (clock.t == float(MIN_WAIT)i.e. == 60.0), so a single leaked 1ms sleep from an unrelated thread fails the test.Why it matters: Every full-suite run on a busy host can fail on this module, burning local gate attempts and CI reruns for unrelated PRs. It already burned one ship attempt of a pr-maintenance loop (zero signal against that loop's change).
Tests: Regression pinning the leak: while a wait runs under _run_wait, a helper thread calls time.sleep(0.001) repeatedly; clock.t still ends at exactly float(MIN_WAIT). Fails on the current code, passes after. Full existing test_wait_tool_early_end.py suite green: .venv/bin/python -m pytest test/test_wait_tool_early_end.py -o addopts="" -p no:cacheprovider
Review focus: backend
Review map
test/test_wait_tool_early_end.pyCommits
ebd232bfix(test_wait_tool_early_end): scope the wait-tool fake clock to the …Validation
Local build, static-analysis, and test gates completed before publication. Upstream CI and review checks on the current PR revision remain the authoritative merge signal.
Changed files (1 files, +51/-9)
test/test_wait_tool_early_end.py(+51/-9)