refactor: migrate ExtensionCatalog to shared catalog stack base#2576
Open
WOLIKIMCHENG wants to merge 1 commit into
Open
refactor: migrate ExtensionCatalog to shared catalog stack base#2576WOLIKIMCHENG wants to merge 1 commit into
WOLIKIMCHENG wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Migrates ExtensionCatalog to inherit from the shared CatalogStackBase, dropping its private duplicates of catalog URL validation and YAML config parsing. CatalogEntry becomes a thin subclass of the shared BaseCatalogEntry to preserve public import compatibility, and built-in/SPECKIT_CATALOG_URL/project/user catalog paths now go through self._entry() and self.CONFIG_FILENAME. Test suite gains focused coverage for malformed extension catalog configs (non-mapping roots, boolean priorities, blank/null names, invalid URLs with context) and applies a couple of unrelated lint cleanups.
Changes:
ExtensionCatalognow subclassesCatalogStackBase, declaringCONFIG_FILENAME/ENTRY_CLASS/ERROR_TYPE/VALIDATION_ERROR_TYPE, and removes its in-class_validate_catalog_urland_load_catalog_config.CatalogEntryis redefined asclass CatalogEntry(BaseCatalogEntry)to keep the existing public symbol while inheriting fields from the shared dataclass.- New parametrized tests cover non-mapping YAML roots, boolean priorities, blank/null name normalization, and URL error context for the extension catalog config; plus minor lint fixes (unused variable, split combined import).
Show a summary per file
| File | Description |
|---|---|
| src/specify_cli/extensions.py | Reparent ExtensionCatalog on CatalogStackBase, switch entry construction to self._entry, drop duplicated URL/config helpers. |
| tests/test_extensions.py | Add hardening tests for malformed extension-catalog configs; small lint-only cleanups. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
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.
Summary
ExtensionCatalogto inheritCatalogStackBaseCatalogEntryimport compatibilityBehavior Notes
Valid extension catalog configs should behave the same. Malformed configs now align with shared base behavior:
ValidationErrorcatalog-NTests
uv run --with ruff ruff check src/specify_cli/extensions.py tests/test_extensions.pyCloses #2437