Skip to content

Boost test coverage: enable pyoptex in CI and close measured gaps#436

Open
kgdunn wants to merge 11 commits into
mainfrom
claude/test-coverage-pyoptex-bxbv98
Open

Boost test coverage: enable pyoptex in CI and close measured gaps#436
kgdunn wants to merge 11 commits into
mainfrom
claude/test-coverage-pyoptex-bxbv98

Conversation

@kgdunn

@kgdunn kgdunn commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Enable the pyoptex optimal-design backend in the dev/CI environment: pyoptex>=1.2.1 added to the dev dependency group, with [tool.uv] override-dependencies = ["plotly>=6.5.2", "numba>=0.63.1"] to relax pyoptex's over-strict pins. The plotly relaxation is already merged upstream (mborn1/pyoptex) but not yet released on PyPI; the numba pin is still strict upstream. The overrides match this project's own floors, so nothing else changes. pyoptex stays out of the published extras because pip cannot apply uv overrides, so wheel metadata advertising it would make [expt]+[plotting] unresolvable for pip users.
  • The 8 previously always-skipped pyoptex tests (D/I/A-optimal, split-plot) now run, and a new tests/test_designs_optimal_pyoptex.py covers the adapter layer directly (factor conversion, RandomEffect whole-plot grouping and padding, model types, all three criteria, run-order preservation). designs_optimal.py: 47% to 100% branch coverage. The fallback and ImportError paths in test_designs_screening_optimal.py are now forced via a no_pyoptex monkeypatch fixture instead of skip-when-installed markers, so both branches run in every environment; new tests cover the SEC-19 candidate-set cap and budget clamp.
  • Closed the other measured coverage gaps: 78 new tests for the DOE visualization plot builders (plots package 86% to 99%; the two remaining branches are structurally unreachable), plus edge-path tests for bivariate/_elbow_peak.py (100%) and monitoring/control_charts.py (100%). Full-suite coverage rose from ~89 to 93.81%, and the --cov-fail-under gate is raised 89 to 92.

Note for the maintainer: this session does not commit uv.lock per repo policy; please refresh the lock manually after merge (uv lock). CI relocks on the fly in the interim. Once upstream ships a pyoptex release with the relaxed plotly pin, the plotly override can be dropped; the numba override stays until numba~=0.61 is relaxed upstream too.

Test plan

  • uv sync --dev --all-extras resolves with pyoptex 1.2.1, plotly 6.8.0, numba 0.66.0 via the uv overrides
  • pyoptex-gated tests run (not skipped) and pass: 8 pre-existing + 14 new adapter tests
  • Fallback and ImportError branches covered via monkeypatched _PYOPTEX_AVAILABLE (13 tests)
  • Full suite locally: 1958 passed, 2 pre-existing skips, 93.81% total branch coverage
  • ruff check . and mypy src/process_improve clean locally
  • CI green across the OS/Python matrix (first run is the real installability test for pyoptex's kaleido chain on Windows/macOS)

Checklist

  • Version bumped in pyproject.toml (PATCH: 1.51.0 -> 1.51.1, CITATION.cff synced)
  • Tests added or updated where relevant
  • ruff check . passes
  • CHANGELOG.md updated

🤖 Generated with Claude Code

https://claude.ai/code/session_012KfWQwqC9Fm3K4eqQ5fzGt

claude added 11 commits July 2, 2026 22:00
Empty commit to open the tracking PR. Upcoming commits add pyoptex to the
dev dependency group (with uv override-dependencies to relax its plotly and
numba pins), rework the optimal-design fallback tests, add pyoptex-path
tests, and close measured coverage gaps in the experiments visualization
builders, bivariate elbow/peak, and monitoring control charts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KfWQwqC9Fm3K4eqQ5fzGt
pyoptex 1.2.1 pins plotly~=5.24 and numba~=0.61, conflicting with the
plotting and fast extras. The plotly relaxation is merged upstream but
unreleased; numba remains strict upstream. uv override-dependencies
matching this project's own floors resolves the conflict for the uv-managed
dev environment; the package stays out of published extras so pip metadata
remains resolvable.

Activates the 8 previously-skipped pyoptex tests (verified passing).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KfWQwqC9Fm3K4eqQ5fzGt
The fallback and ImportError tests previously ran only when pyoptex was
absent, so installing pyoptex in CI would have silently skipped them.
A no_pyoptex fixture patches designs_optimal._PYOPTEX_AVAILABLE so both
branches run in every environment. Also adds tests for the SEC-19
candidate-set cap and the k+1 budget clamp in the point-exchange fallback.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KfWQwqC9Fm3K4eqQ5fzGt
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KfWQwqC9Fm3K4eqQ5fzGt
Covers _convert_factors_to_pyoptex (continuous/categorical mapping,
RandomEffect whole-plot grouping and padding), _run_pyoptex model types,
metric criteria and metadata, dispatch default budgets, mixed factor
types, and the generate_design branch that preserves pyoptex run order.
Marks the two import-time no-pyoptex paths with the same pragma style
already used for the pyDOE3 guard. designs_optimal.py: 47% -> 100%
branch coverage in the pyoptex-enabled environment.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KfWQwqC9Fm3K4eqQ5fzGt
Adds a partial_branches section so availability-guard branches whose
false side only fires without the optional dependency are not counted
as partial. designs_optimal.py now reports 100% branch coverage.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KfWQwqC9Fm3K4eqQ5fzGt
Adds tests for mismatched vector lengths, the more-than-10-values
requirement after NaN removal, parallel lines returning (nan, nan),
and a known intersection point. _elbow_peak.py: 100% branch coverage.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KfWQwqC9Fm3K4eqQ5fzGt
Adds tests for the non-positive s guard, variants and styles that leave
the limits unestimated, the zero-MAD-but-nonconstant warm-up fallback to
the standard deviation, and rho/psi boundary behavior.
control_charts.py: 100% branch coverage.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KfWQwqC9Fm3K4eqQ5fzGt
Adds 78 tests across 16 test classes for the empty-input placeholders,
single-factor guards, constraint annotations, deterministic ridge-trace
singularity, steepest-ascent edge paths, box-cox validation, prediction
variance hold values, vertex fallbacks in cube/square plots, and factor
name inference in the registry. Plots package: 86% -> 99% branch
coverage; the two remaining branches are structurally unreachable.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KfWQwqC9Fm3K4eqQ5fzGt
Records the pyoptex dev-environment enablement and the expanded coverage
tests. CITATION.cff kept in sync with the version and release date.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KfWQwqC9Fm3K4eqQ5fzGt
Full suite now measures 93.81% branch coverage with the pyoptex paths
active and the new visualization, bivariate, and monitoring tests; 92
keeps roughly a one-point buffer against platform variation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012KfWQwqC9Fm3K4eqQ5fzGt
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

2 participants