fix(workflows): reject bool / .inf catalog priority in workflow & step catalog loaders#3526
Open
jawwad-ali wants to merge 1 commit into
Open
fix(workflows): reject bool / .inf catalog priority in workflow & step catalog loaders#3526jawwad-ali wants to merge 1 commit into
jawwad-ali wants to merge 1 commit into
Conversation
…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>
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:This misses two guards the base
CatalogStackBase._load_catalog_configalready has:intsubclass →priority: truewas silently coerced to1instead of rejected.int(float("inf"))raisesOverflowError(not in the tuple) →priority: .infcrashed with an uncaught traceback instead of the cleanexpected integererror.The two
_coerce_priorityhelpers used bycatalog add(to compute the next priority) had the sameOverflowErrorgap.Fix
Add the explicit
boolcheck andOverflowErrorto both loaders (mirroring the base loader), andOverflowErrorto both_coerce_priorityhelpers (they return0for an uncoercible existing priority rather than crashingcatalog add).Test
Parametrized
test_config_priority_bool_or_inf_rejectedon bothTestWorkflowCatalogandTestStepCatalogrejectspriority: true/false/.inf— fails before (bool coerced to 1 / infOverflowError), passes after.🤖 Written with the assistance of Claude Code (AI). Bug self-found; fix/tests verified locally (fail-before / pass-after), ruff clean.