Repository navigation
fix(cli): fail loudly on unrecognized --solvers names - #181
HarshRajSinghania wants to merge 1 commit into
Conversation
Print available solver names and abort instead of warning and running every solver when a requested name is a typo. Fixes pasteurlabs#178
CLA signatures requiredThank you for your PR, we really appreciate it! Like many open-source projects, we ask that all contributors sign our Contributor License Agreement before we can accept your contribution. This only needs to be done once per contributor. You can do so by commenting the following on this pull request: @PasteurBot I have read the CLA Document and I hereby sign the CLA Harsh Raj Singhania seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. |
|
@HarshRajSinghania Thanks for the contribution! Please make sure to commit using one of your registered e-mail addresses, so our CLA bot can pick up your identity. Happy to give this a review as soon as the CLA is done :) |
Fixes #178.
Summary
--solversnames that do not match a registered solver now abort the CLI with the unknown name, a close-match suggestion when one exists, and the list of available solver names.Motivation
#178 reports that
--solvers=fenicsprintedunknown solver(s): fenics — skippingand thenno matching solvers after filtering — running all. The registered name isfenics_structural. Running every solver after a typo is the wrong fallback.Maintainer request on the issue: print available solvers, and treat this as a loud failure rather than a silent run-all.
Implementation
_fail_unknown_solvers()so the unknown-name path is shared.--solversCSV still uses_validate_solver_csv()and now calls that helper (same red error + available list +typer.Exit(1)).problem=name) no longer warn-and-skip on an unknown name for that problem; they fail the same way against that problem's solver list.Testing
Commands actually run:
python3 -m py_compile mosaic/benchmarks/cli/_helpers.py tests/test_cli_helpers.py— passedThe full
mosaicpackage import requiresjaxand the rest of the solver stack, which is not available in this environment, sopytest tests/test_cli_helpers.pywas not executed here. New tests added:SystemExit_fail_unknown_solversprints available names and a suggestion_validate_solver_csv('fenics')exits when onlyfenics_structuralis registered_validate_solver_csv('fenics_structural')succeeds