fix(cli): fzd and fz design passed args core fzd() rejects#65
Merged
Conversation
fzd_main() and the `fz design` subcommand called core fzd() with
`results_dir=` and the algorithm options spread as `**kwargs`, but fzd()
accepts `analysis_dir` and `algorithm_options`. Every CLI invocation therefore
failed immediately with:
TypeError: fzd() got an unexpected keyword argument 'results_dir'
Map both call sites to the correct parameters (results_dir -> analysis_dir,
options dict -> algorithm_options=).
The break shipped because fzd CLI execution had no test coverage — test_fzd.py
exercised only the Python API. Add two regression tests (the standalone `fzd`
entry point and the `fz design` subcommand) that run a real design with
--results_dir and --options; verified they fail without the fix with the exact
TypeError above.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the fzd CLI entry points (fzd and fz design) so they correctly call core fz.core.fzd() using its actual parameter names (analysis_dir and algorithm_options), and adds regression tests to ensure both CLI paths execute successfully.
Changes:
- Update
fz/cli.pyto passanalysis_dir=args.results_dirandalgorithm_options=...instead ofresults_dir=...and**kwargs. - Add regression tests in
tests/test_fzd.pycovering bothfzd_main()andpython -m fz.cli designexecution. - Document the fix in
NEWS.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
fz/cli.py |
Fixes the parameter mapping for core fzd() from both CLI entry points. |
tests/test_fzd.py |
Adds regression coverage to ensure both CLI entry points actually run a design. |
NEWS.md |
Notes the CLI breakage and the fix + new regression tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
856
to
+858
| calculators=calculators, | ||
| **algo_options | ||
| algorithm_options=algo_options, | ||
| analysis_dir=args.results_dir, |
Comment on lines
+156
to
+160
| fzd_main() called core fzd() with results_dir=/**options, but fzd() | ||
| accepts analysis_dir/algorithm_options — so every invocation raised | ||
| TypeError ('unexpected keyword argument results_dir'). No fzd CLI | ||
| execution test existed, so the break shipped. This covers entry point 1 | ||
| (the standalone `fzd` command, fz.cli:fzd_main). |
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.
Problem
The
fzdcommand and thefz designsubcommand were unusable — every invocation failed immediately:Both call sites in
fz/cli.pypassedresults_dir=and spread the parsed algorithm options as**kwargs, but corefzd()acceptsanalysis_dirandalgorithm_options(notresults_dir, no**kwargs).It shipped because
fzdCLI execution had zero test coverage —tests/test_fzd.pyexercised only the Python API (fz.fzd(...)), which has always worked.Fix
Map both call sites to the real parameters:
results_dir=args.results_dir→analysis_dir=args.results_dir**algo_options→algorithm_options=algo_optionsTests
Added two regression tests in
tests/test_fzd.pycovering both entry points (the standalonefzdcommand viafzd_main, andfz designviapython -m fz.cli design), each running a realrandomsamplingdesign with--results_dirand--options.Verified they fail without the fix (reproducing the exact
TypeError) and pass with it. Fulltest_fzd.py+test_cli_commands.pysuite green.How it was found
While validating a new Modelica-calibration skill example end-to-end (separate PR), a
fzd/brent calibration recovered the correct coefficient via the Python API but the documented CLI form crashed — leading here.🤖 Generated with Claude Code