Skip to content

fix: handle positional model before CLI options - #406

Open
Bortlesboat wants to merge 3 commits into
p-e-w:masterfrom
Bortlesboat:agent/fix-positional-model-args
Open

fix: handle positional model before CLI options#406
Bortlesboat wants to merge 3 commits into
p-e-w:masterfrom
Bortlesboat:agent/fix-positional-model-args

Conversation

@Bortlesboat

Copy link
Copy Markdown
Contributor

Summary

heretic MODEL --n-trials 10 now keeps MODEL as the model argument instead of rewriting the option value 10 into --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 --reproduce and --collect-reproducibles modes.

Validation

  • PYTHONPATH=src python -m unittest discover -s tests -p test_cli.py
  • uv run ruff format --check src/heretic/cli.py src/heretic/main.py tests/test_cli.py
  • uv run ruff check --extend-select I src/heretic/cli.py src/heretic/main.py tests/test_cli.py
  • uv run ty check src/heretic/cli.py src/heretic/main.py tests/test_cli.py

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/heretic/cli.py Outdated
Comment thread src/heretic/cli.py Outdated
Comment thread src/heretic/cli.py Outdated
Comment thread src/heretic/cli.py Outdated
Comment thread tests/test_cli.py Outdated
Comment thread tests/test_cli.py Outdated
Comment thread tests/test_cli.py Outdated
Comment thread tests/test_cli.py Outdated
Comment thread tests/test_cli.py Outdated
Comment thread tests/test_cli.py Outdated
@Bortlesboat

Copy link
Copy Markdown
Contributor Author

All automated review findings are addressed in 598b149: -- terminator handling now preserves dash-prefixed positional models, option arity comes from the real Pydantic argparse actions (covering nullable booleans without annotation-shape guessing), and the tests are fully annotated. Focused CLI tests, Ruff, and type checks pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant