test: CLI smoke + cross-package seam tests; 3 latent bug fixes#1002
Merged
Conversation
…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>
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 #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.pylazily importing openadapt-ml entry points inside command bodies) was structurally invisible to CI.New tests
test_every_command_help--help; any wiring error in any command fails CItest_train_start_calls_real_entry_pointscripts.train.mainwith kwargs it doesn't accepttest_serve_calls_cmd_serve_with_expected_namespace+test_serve_honors_output_directory--outputrepointing,--no-openpassthroughtest_cmd_serve_reads_only_provided_argscmd_servegrowing a newargs.<attr>that cli.py doesn't provide (AST-parses the installed package)test_import_error_messages_not_maskedtest_import_integrity.pyopenadaptand the installedopenadapt_ml, including lazy imports inside function bodiesLatent bugs the new tests caught against openadapt-ml 0.16.0 (fixed here)
serveNamespace was missingopen—cmd_servereadsargs.openat the end of its body, so serving worked but then crashed with AttributeError. cli.py's redundant browser-timer hack is replaced by passingopenthrough, since cmd_serve handles browser-opening natively.openadapt/__init__.pylazy__getattr__: importedQwenVLAdapterfrom the openadapt_ml package root (which exports nothing) instead ofmodels.qwen_vl— soopenadapt.QwenVLAdapteralways raised.Trainerthat doesn't exist anywhere in openadapt-ml, andopenadapt.trainreturnedNoneinstead of raising AttributeError. Both phantom names removed (they never worked).CI changes
main.yml: installs openadapt-ml and runspytest tests/on every PR — the seam from openadapt-ml 0.14.1: multiple broken internal imports prevent serve, train, and demo commands #999 is now exercised in 6 matrix combinationsrelease-and-publish.yml: files (or appends to) a GitHub issue on release-workflow failure, so PyPI can't silently go stale again (openadapt-ml's releases failed silently Mar–Jun 2026)Verification
pip install -e ".[dev]" openadapt-ml==0.16.0Companion 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