Skip to content

test(roadmap): refine failure tests use the shared fake clock - #4744

Merged
dan-petty merged 2 commits into
mainfrom
fix/4459-refine-failure-fake-clock
Nov 11, 2026
Merged

dan-petty merged 2 commits into
mainfrom
fix/4459-refine-failure-fake-clock

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The refine failure-class tests wait for real on the retry backoff of the model client: about 60 s for three tests. The test module defined its own fixture clock. It shadowed the shared clock fixture (ClockFake), so time.sleep and the clock seam were not replaced.

The module now builds on the shared fixture. An autouse fixture moves it to START, and the tests use the type ClockFake. The recorded failure time includes the retry waits that the fake clock answers, so the tests add them. The timeout test asserts that clock.waits is not empty, so a new shadow fails that test. No production code, setting or timeout changes.

Closes #4459

Change: openspec/changes/archive/2026-11-11-4459-refine-failure-tests-wait-60-s/

The module fixture clock shadowed the shared ClockFake, so the retry
backoff of the model client ran for real: 60 s for three tests. The module
now builds on the shared fixture and the timeout test asserts the waits.

Refs #4459
@dan-petty dan-petty added type/test Type test: a new or changed test scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them labels Nov 11, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Measurements (same host, 4 CPUs busy with other agents, uv run pytest tests/roadmap/refine/test_roadmap_refine_failure_class.py -n0 --durations=3):

Test Before After
test_the_next_round_skips_the_item_until_the_time_passes_and_takes_the_others 31.7 s 0.96 s
test_a_timeout_records_class_step_and_time_and_does_not_mark_the_item_as_at_fault 21.0 s 2.4 s (first test of the run, holds the import cost)
test_a_success_clears_the_three_keys 15.7 s 0.55 s
Whole file, 26 tests 74.8 s 6.1 s

devops ci fail-to-pass --base origin/main does not apply: the defect is in the test fixture, and the shared ClockFake is test code. All 26 tests pass on base, only slowly. This is why the title type is test, not fix. The guard is the assertion clock.waits in the timeout test: with the old module fixture the test has no waits and fails.

@dan-petty
dan-petty marked this pull request as ready for review November 11, 2026 18:36
@dan-petty
dan-petty merged commit fe5bb4a into main Nov 11, 2026
31 checks passed
@dan-petty
dan-petty deleted the fix/4459-refine-failure-fake-clock branch November 11, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them type/test Type test: a new or changed test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(test): refine failure tests wait 60 s on real retries

1 participant