test: import-integrity and packaging guards + 8 latent bug fixes#64
Merged
Conversation
…ey found Follow-up to OpenAdaptAI/OpenAdapt#999: green CI shipped a fully broken CLI because no test exercised lazy imports, internal call seams, or the built wheel. This adds three guards and fixes everything they caught on current main: New tests (dependency-free, <3s total): - tests/test_import_integrity.py::test_no_phantom_imports — AST-walks every `from openadapt_ml.x import y` (including inside function bodies) and verifies y exists in x - tests/test_import_integrity.py::test_no_phantom_kwargs — verifies keyword args passed to internal functions exist in their signatures - tests/test_packaging.py — builds the wheel and asserts bundled configs, core modules, and version match Latent bugs the new tests caught on main, fixed here: - cloud/local.py: cmd_serve called regenerate_local_dashboard with a keep_polling kwarg that no longer exists (dashboard regeneration failed on every serve, downgraded to a warning) - scripts/compare.py + experiments/demo_prompt/run_experiment.py: capture_to_episode(goal=) — same kwarg bug as #999 bug 3, two more call sites - ingest/__init__.py: re-exported capture_to_session and load_captures_as_sessions, which don't exist; the except ImportError guard meant capture_to_episode was silently never exported either - evals/grounding.py: TYPE_CHECKING import from missing module openadapt_ml.data.types (Episode lives in openadapt_ml.schema) - cloud/azure_inference.py: imported QwenVLAdapter from missing module openadapt_ml.adapters.qwen (lives in models.qwen_vl) and constructed it with a non-existent model_name kwarg (needs from_pretrained); imported generate_comparison which was refactored away — restored as a thin wrapper over generate_comparison_data/_html in compare.py Also: - release.yml: file/append a GitHub issue when the release workflow fails. Releases failed silently Mar-Jun 2026 while PyPI went stale, which is what forced #999's reporter onto git installs - pyproject: add build to the dev extra for the packaging tests Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Follow-up to OpenAdaptAI/OpenAdapt#999: every CLI entry point was broken for months while CI stayed green, because nothing tested lazy imports, internal call seams, or the built wheel. This PR adds those guards — and the guards immediately caught 8 more live bugs on main, all fixed here.
New tests (dependency-free, <3s)
test_no_phantom_importsfrom openadapt_ml.x import y— including imports inside function bodies, which plain import tests never execute — and verifiesyexists inxtest_no_phantom_kwargsgoal=vsinstruction=class)test_packaging.py(3 tests)Latent bugs found by the new tests on current main (all fixed here)
cmd_serve→regenerate_local_dashboard(keep_polling=True): kwarg no longer exists, so dashboard regeneration failed on everyserve(silently, via a broadexcept Exception)scripts/compare.py:807:capture_to_episode(goal=)— #999 bug 3 in another call siteexperiments/demo_prompt/run_experiment.py:426: sameingest/__init__.py: re-exportedcapture_to_session/load_captures_as_sessions, which don't exist — and because that raised ImportError inside the try/except guard,capture_to_episodewas silently never exported fromopenadapt_ml.ingesteitherevals/grounding.py: TYPE_CHECKING import from missing moduleopenadapt_ml.data.types(Episode lives inopenadapt_ml.schema)cloud/azure_inference.py:427: importedQwenVLAdapterfrom missing moduleopenadapt_ml.adapters.qwen(lives inmodels.qwen_vl)cloud/azure_inference.py:430: constructedQwenVLAdapter(model_name=...)— no such parameter; needsfrom_pretrained(found by manual review while fixing 6; class-constructor checking is a noted future enhancement for the kwarg test)cloud/azure_inference.py:336: importedgenerate_comparison, refactored away long ago — restored as a thin wrapper overgenerate_comparison_data/_htmlRelease alerting
release.ymlnow files (or appends to) a GitHub issue whenever the release workflow fails. Releases failed silently from March to June 2026 while PyPI went stale — which is what forced #999's reporter onto git installs in the first place.Verification
--all-extras)Part of the broader testing strategy in response to #999; companion OpenAdapt-side PR adds CLI smoke + cross-package seam tests.
🤖 Generated with Claude Code