You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(extensions): normalize names before adding catalogs - #5630
specify extension catalog add previously persisted the raw --name value without stripping whitespace or rejecting blank names:
Passing --name " " wrote a blank name into .specify/extension-catalogs.yml, which the catalog loader later displayed as catalog-1, making the entry unremovable by its displayed name.
Passing --name " team " wrote a padded name that bypassed duplicate checks against "team" and did not match the stripped name shown by catalog list.
Changes
Strip --name and exit with an error when blank before creating or modifying .specify/extension-catalogs.yml.
Normalize existing catalog names with .strip() during duplicate detection so legacy padded entries are matched consistently.
Add CLI regression tests in tests/specify_cli/extensions/catalog/test_command_add.py.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Active moderate findings remain because legacy catalog names are compared inconsistently, allowing duplicate entries and preventing removal by the displayed name.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
An active documentation issue remains because the docstring points to nonexistent BaseCatalog._load_catalog_config instead of the actual shared loader on CatalogStackBase.
8206085d: shared displayed_catalog_names() helper used by both catalog add and catalog remove so legacy whitespace-padded and blank (catalog-{n}) entries match consistently (with unit tests).
b62fef67: updated the displayed_catalog_names() docstring in src/specify_cli/extensions/catalog/_helpers.py to reference CatalogStackBase._load_catalog_config.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
An active moderate issue causes catalogs with blank URLs to be treated as duplicate names during replacement even though they are not listed, blocking valid catalog additions.
Entries with blank/whitespace-only URLs are skipped by CatalogStackBase._load_catalog_config, so catalog list does not display their names. Returning stripped here makes catalog add --name team treat a skipped legacy entry such as {name: ' team ', url: ' '} as an active duplicate and reject a valid replacement catalog, even though no team catalog is listed. Do not return a matchable display name for entries without a usable URL (while retaining the existing exact-name removal behavior if that is needed for cleanup).
@mnriem Addressed in cdd211cf. The last Copilot finding was valid: catalog add treated a legacy entry with a blank URL as an existing duplicate, even though the loader skips it and catalog list never shows it.
Backwards compatibility:
catalog add now ignores entries without a usable URL when checking for duplicates (new regression test).
catalog remove still matches those entries by their exact stored name, or by the stripped name, so existing configs can still be cleaned up.
No config migration is needed. Existing extension-catalogs.yml files keep working unchanged, and nothing is rewritten unless the user runs add or remove.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
A critical bug remains in catalog removal: leaving a blank-URL legacy entry causes the command to preserve an unusable configuration that makes subsequent catalog listing fail.
@mnriem Addressed the follow-up review finding in cd0d2a70:
When catalog remove deletes the last usable catalog and only blank-URL legacy entries remain, it now prunes .specify/extension-catalogs.yml instead of leaving an unusable file behind so catalog list continues to fall back cleanly to user/default catalogs.
Added a regression test covering removal of the last usable entry alongside a blank-URL legacy entry (tests/specify_cli/extensions/catalog/: 45 passed).
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human validation is needed to confirm compatibility across malformed or legacy catalog entries, duplicate display names, blank URLs, and priority-based fallback behavior.
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
triage-can-waitVerdict: valid and in-scope but deprioritized; held behind the evidence gate
3 participants
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
specify extension catalog addpreviously persisted the raw--namevalue without stripping whitespace or rejecting blank names:--name " "wrote a blank name into.specify/extension-catalogs.yml, which the catalog loader later displayed ascatalog-1, making the entry unremovable by its displayed name.--name " team "wrote a padded name that bypassed duplicate checks against"team"and did not match the stripped name shown bycatalog list.Changes
--nameand exit with an error when blank before creating or modifying.specify/extension-catalogs.yml..strip()during duplicate detection so legacy padded entries are matched consistently.tests/specify_cli/extensions/catalog/test_command_add.py.Verification
pytest -q tests/specify_cli/extensions/catalog/: 41 passed.