Skip to content

fix(cli): fail loudly on unrecognized --solvers names - #181

Open
HarshRajSinghania wants to merge 1 commit into
pasteurlabs:mainfrom
HarshRajSinghania:fix/unknown-solver-cli-fail-loud
Open

HarshRajSinghania wants to merge 1 commit into
pasteurlabs:mainfrom
HarshRajSinghania:fix/unknown-solver-cli-fail-loud

Conversation

@HarshRajSinghania

Copy link
Copy Markdown

Fixes #178.

Summary

--solvers names 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=fenics printed unknown solver(s): fenics — skipping and then no matching solvers after filtering — running all. The registered name is fenics_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

  • Added _fail_unknown_solvers() so the unknown-name path is shared.
  • Flat --solvers CSV still uses _validate_solver_csv() and now calls that helper (same red error + available list + typer.Exit(1)).
  • Per-problem maps (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.
  • A problem with a flat CSV that simply does not include any of this problem's solvers still skips that problem only. That is unchanged and is not a typo.

Testing

Commands actually run:

  • python3 -m py_compile mosaic/benchmarks/cli/_helpers.py tests/test_cli_helpers.py — passed
  • AST parse of both files — passed

The full mosaic package import requires jax and the rest of the solver stack, which is not available in this environment, so pytest tests/test_cli_helpers.py was not executed here. New tests added:

  • per-problem unknown name raises SystemExit
  • _fail_unknown_solvers prints available names and a suggestion
  • _validate_solver_csv('fenics') exits when only fenics_structural is registered
  • _validate_solver_csv('fenics_structural') succeeds

Print available solver names and abort instead of warning and running every solver when a requested name is a typo.

Fixes pasteurlabs#178
@PasteurBot

Copy link
Copy Markdown
Contributor

CLA signatures required

Thank 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.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@dionhaefner

Copy link
Copy Markdown
Contributor

@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 :)

This branch has not been deployed

No deployments
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.

Unhelpful error/fallback behavior when a solver name is not recognized via CLI

3 participants