fix(workflows,extensions): tolerate non-list catalog tags in search/info display - #3770
Merged
mnriem merged 1 commit intoJul 28, 2026
Conversation
…nfo display
`workflow search`, `workflow info`, `extension search` and `extension info`
crashed with `TypeError: 'int' object is not iterable` when a catalog entry
carried a scalar `tags:` value (e.g. `tags: 5`). Catalog payloads are
user-editable YAML/JSON, so this shape reaches the display unvalidated.
Both backends already guard their tag *filter* with
`isinstance(raw_tags, list)` — `WorkflowCatalog.search` and
`ExtensionCatalog.search` skip a non-list `tags` cleanly. Only the display
paths were unguarded: they tested truthiness (`if info.get("tags"):`) and
then iterated. A scalar is truthy but not iterable, so `--tag` filtering
survived while plain `search`/`info` rendering blew up.
Note this is distinct from the non-string *element* handling added in
github#3746/github#3747: coercing elements with `str(t) for t in ...` does not help when
`tags` is not a sequence at all. The fix is the guard the sibling
integration commands already use — `integrations/_query_commands.py:332,402`
gate on `isinstance(tags, list) and tags`. This aligns workflows and
extensions with that reference pattern, leaving all four tag-join display
sites in these modules consistent.
Regression tests drive the full CLI via CliRunner and cover search + info in
one case per module; both fail before the fix with the exact TypeError.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Prevents workflow and extension search/info commands from crashing when catalog tags is not a list.
Changes:
- Guard tag rendering with
isinstance(tags, list). - Add CLI regression coverage for search and info paths.
Show a summary per file
| File | Description |
|---|---|
src/specify_cli/workflows/_commands.py |
Safely renders workflow tags. |
src/specify_cli/extensions/_commands.py |
Safely renders extension tags. |
tests/test_workflows.py |
Tests scalar workflow tags. |
tests/test_extensions.py |
Tests scalar extension tags. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Medium
Collaborator
|
Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
workflow search,workflow info,extension searchandextension infocrash with a raw traceback when a catalog entry carries a scalartags:value:Catalog payloads are user-editable YAML/JSON, so this shape reaches the display unvalidated.
Interestingly, both backends already handle this correctly.
WorkflowCatalog.searchandExtensionCatalog.searchgate their tag filter onisinstance(raw_tags, list), so--tag ciskips the malformed entry cleanly. Only the display paths were unguarded — they tested truthiness and then iterated:So filtering worked while plain rendering crashed.
Why the existing
str(t)coercion doesn't cover thisThis is a distinct failure mode from the non-string element handling added in #3746 / #3747. Coercing elements with
str(t) for t in ...does nothing whentagsisn't a sequence at all — the iteration itself is what fails.Fix
Use the guard the sibling integration commands already use.
integrations/_query_commands.py:332,402gate onisinstance(tags, list) and tags; this applies the same pattern to workflows and extensions rather than introducing a new idiom.A repo-wide audit of every
", ".join(str(t) for t in ...)tag-display site confirms the four sites in these two modules were the only unguarded ones outside presets (which are covered separately in #3769):extensions/_commands.pysearchextensions/_commands.py_print_extension_infoworkflows/_commands.pyworkflow_searchworkflows/_commands.pyworkflow_infointegrations/_query_commands.py×2Tests
One regression test per module, each covering
searchandinfo, driving the full CLI viaCliRunner:TestWorkflowCliAlignment::test_search_and_info_tolerate_non_list_tagsTestExtensionCatalog::test_search_and_info_tolerate_non_list_tagsBoth fail before the fix with the exact target exception, verified by stashing the source changes:
tests/test_workflows.py tests/test_extensions.pyafter the fix: 982 passed, 17 failed, 113 errors. Cleanmaingives 980 passed with an identical 17 failed / 113 errors — those are pre-existing Windows-local issues (symlink cases needing elevation, and a locked pytest temp root). Net effect is +2 passing, no new failures.🤖 Generated with Claude Code