spec-kit icon indicating copy to clipboard operation
spec-kit copied to clipboard

fix(integrations): exit cleanly on unbalanced quote in --integration-options (#3457)

Open Noor-ul-ain001 opened this issue 4 months ago • 0 comments

Summary

Closes #3457. _parse_integration_options in src/specify_cli/integrations/_helpers.py called shlex.split(raw_options) unguarded. An unbalanced quote in the flag value made shlex raise ValueError: No closing quotation, so a raw traceback escaped instead of the clean typer.Exit(1) error every other bad-input path in this function produces (unknown option, missing value, unexpected value all print a message and exit 1).

Reachable from specify init --integration-options=... and every specify integration install/switch/upgrade/migrate --integration-options=....

Before:

$ specify integration install generic --integration-options='--commands-dir "foo'
ValueError: No closing quotation   # raw traceback

After:

$ specify integration install generic --integration-options='--commands-dir "foo'
Error: Could not parse integration options: No closing quotation.
# exit 1

Changes

  • Wrap shlex.split(raw_options) in try/except ValueError, printing a one-line error and raising typer.Exit(1) — matching the loud-fail UX of the sibling bad-input branches in the same function.

Testing

  • Added test_unbalanced_quote_exits_cleanly under TestParseIntegrationOptionsEqualsForm: asserts the unbalanced-quote input raises typer.Exit with exit code 1.
  • Test-the-test: confirmed the new test fails without the source change (raw ValueError propagates).
  • End-to-end via CliRunner on the full integration install ... --integration-options path: exit code 1, clean message, no traceback.
  • pytest tests/integrations/test_integration_subcommand.py → 108 passed, 7 skipped.

🤖 Generated with Claude Code

Noor-ul-ain001 avatar Jul 11 '26 05:07 Noor-ul-ain001