fix(catalogs): 'priority: .inf' yields a clean validation error instead of crashing#3525
Open
jawwad-ali wants to merge 1 commit into
Open
fix(catalogs): 'priority: .inf' yields a clean validation error instead of crashing#3525jawwad-ali wants to merge 1 commit into
jawwad-ali wants to merge 1 commit into
Conversation
…erflowError
_load_catalog_config coerces a catalog entry's priority with int() inside
except (TypeError, ValueError). int(float('inf')) raises OverflowError, which is
not in that tuple, so a YAML 'priority: .inf' escaped as an uncaught traceback
instead of the intended 'expected integer' validation error (the bool-is-int
case is already guarded just above). Add OverflowError to the except tuple.
Test mirrors the existing rejects_boolean_priority test with priority: .inf
(fails before: OverflowError; passes after: ValidationError naming the config).
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
A catalog config with
priority: .infcrashes with an uncaught traceback:CatalogStackBase._load_catalog_configcoerces the priority withint()insideexcept (TypeError, ValueError):int(float("inf"))raisesOverflowError, which isn't in that tuple — so.inf(a valid YAML float) escapes the guard as a raw traceback instead of the intended clean validation error. (Thebool-is-int case is already handled just above.)Fix
Add
OverflowErrorto the except tuple so.infproduces the same actionableInvalid priority … expected integererror. This base loader backs all four catalog systems (bundles/extensions/presets/workflows), so the fix covers them all. Matches the sibling numeric-coercion guards in this codebase (e.g._coerce_input).Test
Mirrors the existing
test_load_catalog_config_rejects_boolean_prioritywithpriority: .inf— fails before (OverflowError), passes after (ValidationError naming the config file).🤖 Written with the assistance of Claude Code (AI). Bug self-found; fix/tests verified locally (fail-before / pass-after), ruff clean.