Repository navigation
Show CLI help before importing delivery backends - #1523
Conversation
Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero primary review by claude on fecc36dba803e7ccf3b0f95bf852a975e851ac23, 46.2s: request_changes (0 critical, 1 important, 3 suggestion)
Settings per native call (launch configuration and CLI claims, not backend attestation):
- Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)
Native Claude output is retained in the restricted local review receipt.
|
|
||
| # Module execution parses help and version before loading delivery code. | ||
| if __name__ == "__main__": | ||
| _module_args = parse_args(build_parser(), None) |
There was a problem hiding this comment.
suggestion: python -m loopzero.cli parses argv twice; _module_args is never used
Under -m, line 9 parses argv into _module_args, and nothing reads it. The if __name__ == "__main__": sys.exit(main()) block at line 1773 then calls main(), which runs build_parser() and parse_args() again, including the stdout reconfigure and the validation. Output stays the same, but this is a dead variable plus duplicated parsing, and the two entry paths can drift apart. Smallest fix: make the bottom block sys.exit(_run(_module_args)), which removes the second parse and gives the early parse a reader.
| try: | ||
| with _proc.unwind_on_sigterm(): | ||
| return args.func(args) | ||
| handler = getattr(args, "func", None) or globals()[f"cmd_{args.command}"] |
There was a problem hiding this comment.
suggestion: args.func fallback is kept only for one test
The parser no longer sets func, so getattr(args, "func", None) or ... only serves test_progress_output_precedes_the_stderr_verdict_in_one_file. That test injects a parser with func=wait. Production code now dispatches two ways. A simpler option is to dispatch only through globals()[f"cmd_{args.command}"] and have the test monkeypatch cli.cmd_merge (or cli._run) instead.
| out = capsys.readouterr().out | ||
| assert stop.value.code == 0 and re.fullmatch(r"loopzero \S+ .+\n", out), out | ||
| @pytest.mark.parametrize("flag, pattern", [("--version", r"loopzero \S+ .+\n\Z"), ("--help", r"usage: loopzero ")]) | ||
| def test_cli_info_leaves_delivery_backends_unloaded(flag, pattern): |
There was a problem hiding this comment.
suggestion: Nothing tests the console-script entry point (loopzero._cli_entry:main)
Acceptance requires the console script's help and version output to stay the same and help to load no backends. The rewritten test only runs -m loopzero.cli. _cli_entry.main is the actual [project.scripts] target, and no test imports or calls it, so a regression there (for example, importing loopzero.cli at module level) would go unnoticed. You can cover it without adding test lines by having one parametrized case run -c 'import sys; from loopzero._cli_entry import main; sys.exit(main())' instead of -m loopzero.cli.
Architecture-Review: unchanged; the documented CLI layout stands and the automated parser watch follows its new file Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
loopzero delta review by claude on 0816ccf8fc809d76661cd5dd59acbb7a2b1e1641, 20.8s: approve (0 critical, 0 important, 0 suggestion)
Settings per native call (launch configuration and CLI claims, not backend attestation):
- Call 1: requested model claude-opus-5-5 (effort medium); CLI-reported model claude-opus-5-5 (effort unknown); configured model claude-opus-5-5 (effort medium)
Native Claude output is retained in the restricted local review receipt.
|
@Mergifyio queue |
✅ Merged into
|
|
No description provided. |
Show CLI help before importing delivery backends
Context and goal
Closes #1489
Acceptance
Validation evidence
31 interleaved fresh processes measured module help at 84.81 ms before and 33.75 ms after. Console help was 81.60 ms before and 35.13 ms after. Top-level and subcommand help, version, and the missing-command error matched byte-for-byte. Focused CLI tests, lint and dependency checks passed. Test lines are net zero.
Base
Base: a68ef3b
Validation
Recorded for
0816ccf8fc80uv run --group dev ruff check src tests: exit 0uv run --group dev tach check: exit 0uv run --python 3.14 python scripts/check_architecture_docs.py: exit 0scripts/size_budget.sh: exit 0uv run --group dev pytest -q: exit 0Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.Review