Skip to content

fix(cli): fzd and fz design passed args core fzd() rejects#65

Merged
yannrichet-asnr merged 1 commit into
mainfrom
fix/fzd-cli-results-dir
Jun 14, 2026
Merged

fix(cli): fzd and fz design passed args core fzd() rejects#65
yannrichet-asnr merged 1 commit into
mainfrom
fix/fzd-cli-results-dir

Conversation

@yannrichet-asnr

Copy link
Copy Markdown
Member

Problem

The fzd command and the fz design subcommand were unusable — every invocation failed immediately:

TypeError: fzd() got an unexpected keyword argument 'results_dir'

Both call sites in fz/cli.py passed results_dir= and spread the parsed algorithm options as **kwargs, but core fzd() accepts analysis_dir and algorithm_options (not results_dir, no **kwargs).

It shipped because fzd CLI execution had zero test coveragetests/test_fzd.py exercised only the Python API (fz.fzd(...)), which has always worked.

Fix

Map both call sites to the real parameters:

  • results_dir=args.results_diranalysis_dir=args.results_dir
  • **algo_optionsalgorithm_options=algo_options

Tests

Added two regression tests in tests/test_fzd.py covering both entry points (the standalone fzd command via fzd_main, and fz design via python -m fz.cli design), each running a real randomsampling design with --results_dir and --options.

Verified they fail without the fix (reproducing the exact TypeError) and pass with it. Full test_fzd.py + test_cli_commands.py suite 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

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>

Copilot AI 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.

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.py to pass analysis_dir=args.results_dir and algorithm_options=... instead of results_dir=... and **kwargs.
  • Add regression tests in tests/test_fzd.py covering both fzd_main() and python -m fz.cli design execution.
  • 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 thread fz/cli.py
Comment on lines 856 to +858
calculators=calculators,
**algo_options
algorithm_options=algo_options,
analysis_dir=args.results_dir,
Comment thread tests/test_fzd.py
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).
@yannrichet-asnr yannrichet-asnr merged commit 752b5cb into main Jun 14, 2026
37 checks passed
@yannrichet-asnr yannrichet-asnr deleted the fix/fzd-cli-results-dir branch June 14, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants