fix(commands): fail fast on broken imports and enforce registry coverage - #69
fix(commands): fail fast on broken imports and enforce registry coverage#69syf2211 wants to merge 1 commit into
Conversation
Add CODELLENS_STRICT_COMMANDS for CI/dev fail-fast when a command module fails to import, plus a meta-test ensuring every commands/*.py registers at least one CLI command. Also register the missing self-analyze command. Fixes Wolfvin#39
Review - REQUEST CHANGES (critical typo)Reviewed full diff (5 files, +88/-7). Implementation is correct and well-tested, but there's a critical typo that must be fixed before merge. Critical issue: env var name typoThe env var is
Why critical: Issue #39 body specifies The typo is internally consistent (all 4 sites use same wrong spelling), so the PR's own tests pass. But the env var name is a public API - it must match the issue spec and project branding ( Strengths (after typo fix, this is a great PR)
VerdictRequest changes: fix Reviewed by BOS (orchestrate-workers skill) - diff read in full before decision. |
Follow-up: typo still not fixedChecked the diff again - the env var is still This is a blocking issue: anyone who reads issue #39 and sets Exact fix needed (4 files)
- CODELLENS_STRICT_COMMANDS: "1"
+ CODELENS_STRICT_COMMANDS: "1"
-_STRICT_COMMAND_IMPORTS = os.environ.get("CODELLENS_STRICT_COMMANDS", "").lower() in {
+_STRICT_COMMAND_IMPORTS = os.environ.get("CODELENS_STRICT_COMMANDS", "").lower() in {
-os.environ.setdefault("CODELLENS_STRICT_COMMANDS", "1")
+os.environ.setdefault("CODELENS_STRICT_COMMANDS", "1")
- env["CODELLENS_STRICT_COMMANDS"] = "1"
+ env["CODELENS_STRICT_COMMANDS"] = "1"and the docstring on line ~38. Once fixed, this PR is approved and ready to merge. The implementation itself (strict mode fail-fast, self-analyze registration fix, meta-test) is correct and well-tested. |
…v var syf2211's PR #69 had the env var spelled CODELLENS_STRICT_COMMANDS (double L) in all 4 files. Issue #39 specifies CODELENS_STRICT_COMMANDS (single L). Anyone reading the issue and setting the env var with the correct spelling would get no effect - strict mode silently wouldn't activate. This fixup branch is based on syf2211's work (credited) with only the typo corrected. All other changes (strict mode fail-fast, self_analyze registration fix, meta-test, CI integration) are unchanged. Closes #39 Supersedes #69
|



Summary
Add strict command-import mode for CI/dev and a registry meta-test so broken or unregistered command modules cannot silently disappear from the CLI and MCP tool list.
Motivation
When a
scripts/commands/*.pymodule fails to import, the auto-import loop logs an error but continues with exit code 0. CI only assertedlen(COMMAND_REGISTRY) >= 41, so many commands could fail to load without failing the pipeline. MCP clients would then see missing tools with no clear signal.Fixes #39
Changes
scripts/commands/__init__.py: honorCODELLENS_STRICT_COMMANDS=1to re-raise import failures instead of only logging themscripts/commands/self_analyze.py: register the missingself-analyzecommand (module loaded but never calledregister_command)tests/conftest.py: enable strict imports during pytest runstests/test_command_registry.py: meta-test that every command module registers at least one command; subprocess test for strict fail-fast behavior.gitlab-ci.yml: setCODELLENS_STRICT_COMMANDS=1for all CI jobsTests
tests/test_command_registry.py: 2 passedNotes