Skip to content

test: CLI smoke + cross-package seam tests; 3 latent bug fixes#1002

Merged
abrichr merged 1 commit into
mainfrom
test/cli-seams
Jun 12, 2026
Merged

test: CLI smoke + cross-package seam tests; 3 latent bug fixes#1002
abrichr merged 1 commit into
mainfrom
test/cli-seams

Conversation

@abrichr

@abrichr abrichr commented Jun 12, 2026

Copy link
Copy Markdown
Member

Why

Follow-up to #999. This repo's CI ran zero pytest — only ruff and two one-line import checks — and never installed openadapt-ml, so the exact seam that broke (cli.py lazily importing openadapt-ml entry points inside command bodies) was structurally invisible to CI.

New tests

Test Guards against
test_every_command_help Walks the whole Click tree rendering --help; any wiring error in any command fails CI
test_train_start_calls_real_entry_point cli.py calling scripts.train.main with kwargs it doesn't accept
test_serve_calls_cmd_serve_with_expected_namespace + test_serve_honors_output_directory The serve seam: Namespace shape, --output repointing, --no-open passthrough
test_cmd_serve_reads_only_provided_args The reverse drift: openadapt-ml's cmd_serve growing a new args.<attr> that cli.py doesn't provide (AST-parses the installed package)
test_import_error_messages_not_masked The "openadapt-ml not installed" masking that made #999 so hard to diagnose
test_import_integrity.py Phantom imports and phantom kwargs across both openadapt and the installed openadapt_ml, including lazy imports inside function bodies

Latent bugs the new tests caught against openadapt-ml 0.16.0 (fixed here)

  1. serve Namespace was missing opencmd_serve reads args.open at the end of its body, so serving worked but then crashed with AttributeError. cli.py's redundant browser-timer hack is replaced by passing open through, since cmd_serve handles browser-opening natively.
  2. openadapt/__init__.py lazy __getattr__: imported QwenVLAdapter from the openadapt_ml package root (which exports nothing) instead of models.qwen_vl — so openadapt.QwenVLAdapter always raised.
  3. Same block: imported a Trainer that doesn't exist anywhere in openadapt-ml, and openadapt.train returned None instead of raising AttributeError. Both phantom names removed (they never worked).

CI changes

Verification

  • All 10 tests pass in a clean venv with pip install -e ".[dev]" openadapt-ml==0.16.0
  • Both new tests fail against the pre-fix code (caught all 3 bugs)
  • ruff check/format clean; workflow YAML validated

Companion to OpenAdaptAI/openadapt-ml#64 (same guards package-internally, which caught 8 more latent bugs there). Strategy doc: testing prioritized by the 7 failure classes from #999.

🤖 Generated with Claude Code

…y found

Follow-up to #999. CI previously ran zero pytest (ruff plus two import
one-liners), never installed openadapt-ml, and could not see lazy
imports inside command bodies. This adds the missing layers and fixes
what they immediately caught:

New tests:
- test_cli_smoke.py: renders --help across the whole Click tree;
  contract tests that monkeypatch openadapt-ml entry points and verify
  cli.py calls them with kwargs that exist; an AST check that every
  args.<attr> cmd_serve reads is provided by cli.py's Namespace; and a
  regression test that internal ImportErrors surface the real error
  instead of "openadapt-ml not installed"
- test_import_integrity.py: AST-walks every `from openadapt... import`
  and `from openadapt_ml... import` (including inside function bodies)
  and verifies the names exist; also checks kwargs against internal
  function signatures

Latent bugs the new tests caught against openadapt-ml 0.16.0, fixed:
- cli.py serve omitted `open` from the Namespace, but cmd_serve reads
  args.open at the end of its body (AttributeError after serving).
  cli.py's own browser-opening timer is replaced by passing open
  through, since cmd_serve handles it natively
- openadapt/__init__.py lazy __getattr__ imported QwenVLAdapter from
  the openadapt_ml package root (exports nothing) instead of
  models.qwen_vl, and imported a Trainer that does not exist anywhere;
  `openadapt.train` returned None instead of raising AttributeError

CI:
- main.yml now installs openadapt-ml and runs pytest, so the seam that
  broke in #999 is exercised on every PR
- release-and-publish.yml files a GitHub issue if the release workflow
  fails, so PyPI cannot silently go stale again

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