Skip to content

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

Open
jawwad-ali wants to merge 2 commits 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 2 commits into
github:mainfrom
jawwad-ali:fix/catalogs-priority-inf-bool-guard

Conversation

@jawwad-ali

@jawwad-ali jawwad-ali commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

What

A catalog config with priority: .inf crashed with an uncaught OverflowError: cannot convert float infinity to integer, because the priority parsers coerce with int() inside except (TypeError, ValueError) — and int(float("inf")) raises OverflowError, which isn't in that tuple. (The bool-is-int case was already guarded.)

Fix

Add OverflowError to the except tuple in the affected priority loaders:

  • catalogs.pyCatalogStackBase._load_catalog_config, which backs the extensions and integrations catalogs.
  • presets/__init__.pyPresetCatalog._load_catalog_config (the preset catalog has its own loader, not the base one), which was the remaining gap.

Scope note: the workflow / step catalog loaders live in workflows/catalog.py and are handled in a separate PR (#3526). This PR covers the base loader (extensions + integrations) and the preset loader.

Test

Each affected loader gets a priority: .inf regression test mirroring the existing rejects_boolean_priority — fails before (OverflowError), passes after (clean …ValidationError).


🤖 Written with the assistance of Claude Code (AI). Bug self-found; fix/tests verified locally (fail-before / pass-after), ruff clean.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds clean validation for infinite priorities in shared extension/integration catalog loading.

Changes:

  • Catches OverflowError during priority conversion.
  • Adds an extension-catalog regression test for .inf.
Show a summary per file
File Description
src/specify_cli/catalogs.py Handles infinite priority conversion errors.
tests/test_extensions.py Tests .inf priority validation.

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: 1
  • Review effort level: Medium

Comment thread src/specify_cli/catalogs.py
jawwad-ali and others added 2 commits July 17, 2026 15:33
…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>
…n error

The PresetCatalog._load_catalog_config priority parser has its own loader
(separate from CatalogStackBase) that caught only TypeError/ValueError, so a
YAML 'priority: .inf' escaped as an uncaught OverflowError from int(float('inf')).
Add OverflowError to the except tuple (the bool-is-int case is already guarded
just above), matching catalogs.py.

Test mirrors rejects_boolean_priority with priority: .inf (fails before:
OverflowError; passes after: PresetValidationError).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

3 participants