Skip to content

fix(catalogs): 'priority: .inf' yields a clean validation error instead of crashing#3525

Open
jawwad-ali wants to merge 1 commit into
github:mainfrom
jawwad-ali:fix/catalogs-priority-inf-bool-guard
Open

fix(catalogs): 'priority: .inf' yields a clean validation error instead of crashing#3525
jawwad-ali wants to merge 1 commit into
github:mainfrom
jawwad-ali:fix/catalogs-priority-inf-bool-guard

Conversation

@jawwad-ali

Copy link
Copy Markdown
Contributor

What

A catalog config with priority: .inf crashes with an uncaught traceback:

OverflowError: cannot convert float infinity to integer

CatalogStackBase._load_catalog_config coerces the priority with int() inside except (TypeError, ValueError):

try:
    priority = int(raw_priority)
except (TypeError, ValueError):
    raise self._validation_error(... "expected integer, got {raw_priority!r}")

int(float("inf")) raises OverflowError, 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. (The bool-is-int case is already handled just above.)

Fix

Add OverflowError to the except tuple so .inf produces the same actionable Invalid priority … expected integer error. 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_priority with priority: .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.

…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>
@jawwad-ali jawwad-ali requested a review from mnriem as a code owner July 14, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant