fix(catalogs): 'priority: .inf' yields a clean validation error instead of crashing#3525
Open
jawwad-ali wants to merge 2 commits into
Open
fix(catalogs): 'priority: .inf' yields a clean validation error instead of crashing#3525jawwad-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
Adds clean validation for infinite priorities in shared extension/integration catalog loading.
Changes:
- Catches
OverflowErrorduring 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
…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>
jawwad-ali
force-pushed
the
fix/catalogs-priority-inf-bool-guard
branch
from
July 17, 2026 10:36
dea5d14 to
ded1421
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
A catalog config with
priority: .infcrashed with an uncaughtOverflowError: cannot convert float infinity to integer, because the priority parsers coerce withint()insideexcept (TypeError, ValueError)— andint(float("inf"))raisesOverflowError, which isn't in that tuple. (Thebool-is-int case was already guarded.)Fix
Add
OverflowErrorto the except tuple in the affected priority loaders:catalogs.py—CatalogStackBase._load_catalog_config, which backs the extensions and integrations catalogs.presets/__init__.py—PresetCatalog._load_catalog_config(the preset catalog has its own loader, not the base one), which was the remaining gap.Test
Each affected loader gets a
priority: .infregression test mirroring the existingrejects_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.