Repository navigation
fix(catalogs): name a scheme-less catalog URL instead of reporting "got ://" - #5251
Conversation
…ot ://" Extension, integration, preset, workflow and step catalog URL validation built the HTTPS error from parsed.scheme, so a value without a scheme such as example.com/catalog.json was reported as "(got ://)". Show the value itself when there is no scheme.
There was a problem hiding this comment.
🟢 Approval recommended
The recorded review state reports no active issues for the catalog URL error-message update.
No open issues 🎉
What changed in this PR
This pull request improves catalog URL validation errors by displaying the original value for scheme-less URLs instead of the misleading got ://, while preserving existing behavior for URLs with schemes.
Changes:
- Updated shared, preset, workflow, and workflow-step validators to use the scheme-less URL value in errors.
- Added regression tests for integration, preset, workflow, and workflow-step catalog validation.
- Left bundle catalog path handling unchanged.
- Rich-rendered error output must be escaped at the integration, workflow, and workflow-step command boundaries to prevent user-controlled markup from altering or breaking error output.
This pull request requires changes.
| File | Summary |
|---|---|
tests/test_workflows.py |
Adds regression coverage for workflow and workflow-step catalog validation messages. |
tests/specify_cli/presets/test_catalog.py |
Adds regression coverage for scheme-less preset catalog URLs. |
tests/specify_cli/integrations/test_catalog.py |
Adds regression coverage for the shared integration catalog validator. |
src/specify_cli/workflows/step/catalog/_domain.py |
Updates workflow-step catalog URL error formatting; the resulting error must be rendered as literal text. |
src/specify_cli/workflows/catalog/_domain.py |
Updates workflow catalog URL error formatting; the resulting error must be rendered as literal text. |
src/specify_cli/presets/_catalog.py |
Updates preset catalog URL error formatting. |
src/specify_cli/catalogs.py |
Updates shared extension/integration catalog URL error formatting; the resulting error must be rendered as literal text. |
Review effort: Lite (auto)
…h output Review: integration, workflow and step catalog commands print validation errors as Rich markup, so echoing the user value let input such as "[/red]x" raise MarkupError. Say "a URL with no scheme" instead.
|
Addressed the Copilot note in 1fe145d. It was a real problem: echoing the value meant |
|
Thank you! |
Description
Adding a catalog URL without a scheme reports a confusing scheme in the error. The value isn't a valid catalog URL, but the message doesn't say what was wrong with it:
The same text comes from
extension catalog add,preset catalog add,workflow catalog addandworkflow step catalog add. All four_validate_catalog_urlcopies (the sharedCatalogStackBaseused by extensions and integrations, presets, workflows and steps) format the error withparsed.scheme, which is empty here.This change keeps the message and, when there is no scheme, says so:
The value itself is deliberately not echoed. The integration, workflow and step commands render these errors as Rich markup, so input such as
[/red]xwould otherwise raiseMarkupError(caught in review).URLs that do have a scheme are reported exactly as before (
got http://,got ftp://). Bundle catalogs are not changed: they accept local paths, so a scheme-less value never reaches their HTTPS check.Testing
Tested locally with
uv run specify --helpRan existing tests with
uv sync && uv run pytestTested with a sample project (if applicable)
New tests for the integration (shared base), preset, workflow and step catalog validators assert the scheme-less wording; all 3 test functions fail on
main(got ://) and pass here.Full suite: 13,916 passed, 442 skipped.
uvx ruff@0.15.0 check src tests: all checks passed.Ran the five
catalog addcommands above in a project fromspecify init --integration claude; each now prints the scheme-less wording, and[/red]x/[/x]print the same message instead of aMarkupError.AI Disclosure
AI disclosure: Claude Code (model: Claude Opus 5.5, autonomous agent mode) opened this PR on behalf of @yxshee. It found the message while probing every
specifycommand with invalid input, wrote the fix and tests, ran the new tests againstmainand the branch, ran the full suite and ruff, and checked the real CLI output. No human reviewed the change line by line before it was opened.