Skip to content

Inject the timings the discretization chooser ranks on - #308

Merged
sbryngelson merged 1 commit into
masterfrom
ci/discretization-test-injects-timings
Oct 29, 2026
Merged

sbryngelson merged 1 commit into
masterfrom
ci/discretization-test-injects-timings

Conversation

@sbryngelson

Copy link
Copy Markdown
Owner

test_choose_discretization_returns_the_faster_candidate failed in scheduled run 40870355232 (Python 3.12): the test's own timing picked spectral, _choose_discretization's second timing picked fd. The two solves cost about the same, so runner noise reorders them between measurements. Same class of flake as #307.

The test now monkeypatches _timed to run the real solve but return fixed seconds, parametrized so each discretization is the faster one once. Adequacy (_smallest_adequate) still runs for real. No library code changes.

Checked locally: 30/30 in tests/test_resolution.py pass, ruff clean. Negative control: replacing the chooser's seconds < best[0] comparison with best is None (always keep the first candidate) fails the fd case.

The test timed both candidates itself and compared against a second set of
timings taken inside _choose_discretization. The two solves cost about the same,
so a shared runner reorders them between measurements (scheduled run 40870355232,
Python 3.12: test picked spectral, chooser picked fd). Inject the times instead and
run each candidate as the winner once, so a chooser ignoring time still fails.
@sbryngelson
sbryngelson merged commit 1ffc3a7 into master Oct 29, 2026
3 checks passed
@sbryngelson
sbryngelson deleted the ci/discretization-test-injects-timings branch October 29, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant