fix: handle positional model before CLI options - #406
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the CLI argument normalization logic by moving it into a dedicated cli.py module and introduces a comprehensive suite of unit tests in test_cli.py. The feedback identifies critical issues with the handling of the -- separator, which can cause argparse to fail by treating options as positional arguments. Additionally, the reviewer suggests supporting typing.Union when identifying boolean annotations and points out several style guide violations due to missing return type annotations on the new test methods.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
All automated review findings are addressed in |
Summary
heretic MODEL --n-trials 10now keepsMODELas the model argument instead of rewriting the option value10into--model 10.The positional shorthand now skips values that belong to known CLI options, supports both leading and trailing positional model forms, and still preserves the placeholder model used by
--reproduceand--collect-reproduciblesmodes.Validation
PYTHONPATH=src python -m unittest discover -s tests -p test_cli.pyuv run ruff format --check src/heretic/cli.py src/heretic/main.py tests/test_cli.pyuv run ruff check --extend-select I src/heretic/cli.py src/heretic/main.py tests/test_cli.pyuv run ty check src/heretic/cli.py src/heretic/main.py tests/test_cli.py