fix(workflows): reject bool / .inf catalog priority in workflow & step catalog loaders#3526
Open
jawwad-ali wants to merge 2 commits into
Open
fix(workflows): reject bool / .inf catalog priority in workflow & step catalog loaders#3526jawwad-ali wants to merge 2 commits into
jawwad-ali wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Rejects boolean and infinite priorities in workflow and step catalog loaders while preventing catalog add from crashing on infinite existing priorities.
Changes:
- Adds explicit boolean validation and
OverflowErrorhandling. - Adds regression tests for loader validation.
Show a summary per file
| File | Description |
|---|---|
src/specify_cli/workflows/catalog.py |
Hardens priority parsing and add-catalog coercion. |
tests/test_workflows.py |
Tests invalid boolean and infinite priorities. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 3
- Review effort level: Medium
…catalog loaders
The WorkflowRegistry and StepRegistry catalog-config loaders coerced priority
with int() inside except (TypeError, ValueError), missing two guards the base
CatalogStackBase loader already has:
- bool is an int subclass, so 'priority: true' was silently coerced to 1;
- int(float('inf')) raises OverflowError (not caught), so 'priority: .inf'
crashed with an uncaught traceback.
Add the explicit bool check and OverflowError to both loaders, and add
OverflowError to the two _coerce_priority helpers used by 'catalog add' (they
return 0 on an uncoercible existing priority instead of crashing).
Parametrized tests on both TestWorkflowCatalog and TestStepCatalog reject
priority true/false/.inf (fail before: bool coerced to 1 / inf OverflowError).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ing priority: .inf The workflow/step catalog priority guards added OverflowError to _coerce_priority (the 'catalog add' fallback), but the tests only exercised get_active_catalogs(). Add tests that prewrite an existing 'priority: .inf' entry and call add_catalog() for both WorkflowCatalog and StepCatalog, asserting the command succeeds and the new entry gets a valid priority (inf coerced to 0, +1). Fails before: int(inf) OverflowError crashed add_catalog. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jawwad-ali
force-pushed
the
fix/workflow-catalog-priority-guard
branch
from
July 17, 2026 10:41
ab203d3 to
7c2c673
Compare
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.
What
The
WorkflowRegistryandStepRegistrycatalog-config loaders parsedprioritywith:missing two guards:
boolis anintsubclass (sopriority: truewas silently coerced to1), andint(float("inf"))raisesOverflowError(sopriority: .infcrashed). The two_coerce_priorityhelpers used bycatalog addhad the sameOverflowErrorgap.Fix
Add the explicit
boolcheck andOverflowErrorto both loaders, andOverflowErrorto both_coerce_priorityhelpers (they return0for an uncoercible existing priority rather than crashingcatalog add).Test
test_config_priority_bool_or_inf_rejectedon bothTestWorkflowCatalog/TestStepCatalogrejectspriority: true/false/.inf.test_add_catalog_with_existing_inf_priorityon both prewrites an existing.infentry and callsadd_catalog(), asserting success + the expected new priority (fails before:add_catalogcrashed withOverflowError).🤖 Written with the assistance of Claude Code (AI). Bug self-found; fix/tests verified locally (fail-before / pass-after), ruff clean.