Skip to content

test: import-integrity and packaging guards + 8 latent bug fixes#64

Merged
abrichr merged 1 commit into
mainfrom
test/import-integrity
Jun 12, 2026
Merged

test: import-integrity and packaging guards + 8 latent bug fixes#64
abrichr merged 1 commit into
mainfrom
test/import-integrity

Conversation

@abrichr

@abrichr abrichr commented Jun 12, 2026

Copy link
Copy Markdown
Member

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 Failure class guarded
test_no_phantom_imports AST-walks every from openadapt_ml.x import y — including imports inside function bodies, which plain import tests never execute — and verifies y exists in x
test_no_phantom_kwargs Verifies kwargs passed to internal functions exist in their signatures (the goal= vs instruction= class)
test_packaging.py (3 tests) Builds the wheel; asserts bundled configs present, core modules present, version matches pyproject

Latent bugs found by the new tests on current main (all fixed here)

  1. cmd_serveregenerate_local_dashboard(keep_polling=True): kwarg no longer exists, so dashboard regeneration failed on every serve (silently, via a broad except Exception)
  2. scripts/compare.py:807: capture_to_episode(goal=) — #999 bug 3 in another call site
  3. experiments/demo_prompt/run_experiment.py:426: same
  4. ingest/__init__.py: re-exported capture_to_session / load_captures_as_sessions, which don't exist — and because that raised ImportError inside the try/except guard, capture_to_episode was silently never exported from openadapt_ml.ingest either
  5. evals/grounding.py: TYPE_CHECKING import from missing module openadapt_ml.data.types (Episode lives in openadapt_ml.schema)
  6. cloud/azure_inference.py:427: imported QwenVLAdapter from missing module openadapt_ml.adapters.qwen (lives in models.qwen_vl)
  7. cloud/azure_inference.py:430: constructed QwenVLAdapter(model_name=...) — no such parameter; needs from_pretrained (found by manual review while fixing 6; class-constructor checking is a noted future enhancement for the kwarg test)
  8. cloud/azure_inference.py:336: imported generate_comparison, refactored away long ago — restored as a thin wrapper over generate_comparison_data/_html

Release alerting

release.yml now 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

  • New tests fail against pre-fix main (caught all 8), pass after fixes
  • Full local suite: 438 passed (4 failures are torch-missing in the local env only; CI installs --all-extras)
  • ruff check/format clean on changed files; release.yml YAML-validated

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

…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>
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