fix(workflows): expose workflow/step catalog add metadata options#3388
fix(workflows): expose workflow/step catalog add metadata options#3388WOLIKIMCHENG wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aligns the workflow and step catalog “add” commands with the capabilities already supported by the underlying catalog config by exposing metadata fields (priority, install_allowed, description) through both the CLI and the Python catalog APIs.
Changes:
- Added
--priority,--install-allowed/--no-install-allowed, and--descriptionoptions toworkflow catalog addandworkflow step catalog add. - Extended
WorkflowCatalog.add_catalog()andStepCatalog.add_catalog()to accept optional metadata overrides while preserving existing defaults when omitted. - Expanded workflow/step catalog tests to cover defaults, Python API overrides, and CLI option wiring.
Show a summary per file
| File | Description |
|---|---|
tests/test_workflows.py |
Adds assertions and new tests covering default metadata, override behavior, and CLI option handling for both workflow and step catalogs. |
src/specify_cli/workflows/catalog.py |
Extends both catalog add_catalog() methods to accept optional priority, install_allowed, and description overrides. |
src/specify_cli/workflows/_commands.py |
Adds new Typer options to the two CLI “catalog add” commands and passes them through to the catalog layer. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Low
| ): | ||
| """Add a workflow catalog source.""" | ||
| from .catalog import WorkflowCatalog, WorkflowValidationError | ||
|
|
||
| project_root = _require_specify_project() | ||
| catalog = WorkflowCatalog(project_root) | ||
| try: | ||
| catalog.add_catalog(url, name) | ||
| catalog.add_catalog(url, name, priority, install_allowed, description) | ||
| except WorkflowValidationError as exc: |
There was a problem hiding this comment.
Updated this call to pass priority, install_allowed, and description by keyword.
| @@ -1669,7 +1683,7 @@ def workflow_step_catalog_add( | |||
|
|
|||
| catalog = StepCatalog(project_root) | |||
| try: | |||
| catalog.add_catalog(url, name) | |||
| catalog.add_catalog(url, name, priority, install_allowed, description) | |||
| except StepValidationError as exc: | |||
There was a problem hiding this comment.
Updated this call to pass priority, install_allowed, and description by keyword.
| def add_catalog( | ||
| self, | ||
| url: str, | ||
| name: str | None = None, | ||
| priority: int | None = None, | ||
| install_allowed: bool = True, | ||
| description: str = "", | ||
| ) -> None: |
| def add_catalog( | ||
| self, | ||
| url: str, | ||
| name: str | None = None, | ||
| priority: int | None = None, | ||
| install_allowed: bool = True, | ||
| description: str = "", | ||
| ) -> None: |
|
Addressed the priority validation feedback in the latest commit. Workflow and step catalog priority overrides are now normalized before persistence, and I added regression coverage for both add and load paths. |
| self, | ||
| url: str, | ||
| name: str | None = None, | ||
| priority: int | None = None, |
| self, | ||
| url: str, | ||
| name: str | None = None, | ||
| priority: int | None = None, |
mnriem
left a comment
There was a problem hiding this comment.
Please address Copilot feedback
Widen workflow and step catalog add_catalog priority annotations to accept numeric strings, matching the existing normalization behavior and tests.
|
Addressed the remaining Copilot feedback by widening |
Description
workflow catalog addandworkflow step catalog addonly exposedurland optional--name, even though the underlying workflow/step catalog config already supportspriority,install_allowed, anddescription, and the sibling preset/extension catalog commands already expose those knobs.This change keeps the fix narrow:
--priority,--install-allowed/--no-install-allowed, and--descriptionto both workflow catalog add commandsWorkflowCatalog.add_catalog()andStepCatalog.add_catalog()with backward-compatible optional overridesmax + 1install_allowedstill defaults totruedescriptionstill defaults to an empty stringTesting
uv run specify --help.venv/bin/python -m pytest tests/test_workflows.py -k "WorkflowCatalog or StepCatalog" -v— 37 passed.venv/bin/specify workflow catalog add --help.venv/bin/specify workflow step catalog add --help