fix(extensions): reject duplicate provides.templates/scripts names - #4016
Merged
mnriem merged 1 commit intoAug 10, 2026
Merged
Conversation
The resolver returns the first entry matching a declared name, so a later duplicate within provides.templates or provides.scripts was silently unreachable while still counted by ExtensionManifest properties. Reject duplicates at manifest-validation time instead. Also clarify EXTENSION-DEVELOPMENT-GUIDE.md's provides section: hooks and events are top-level manifest fields, not provides sub-fields, so the "at least one of ..." wording doesn't imply they can be nested under provides.
2 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
Adds validation to reject duplicate template/script names and clarifies extension manifest documentation.
Changes:
- Rejects duplicate names within
provides.templatesandprovides.scripts. - Adds regression coverage for both sections.
- Clarifies that
hooksandeventsare top-level fields.
Show a summary per file
| File | Description |
|---|---|
src/specify_cli/extensions/__init__.py |
Validates artifact-name uniqueness. |
tests/test_extensions.py |
Tests duplicate-name rejection. |
extensions/EXTENSION-DEVELOPMENT-GUIDE.md |
Corrects manifest field hierarchy. |
Review details
Tip
Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Balanced
Collaborator
|
Thank you! |
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
Follow-up to #4012 (#4010), which merged before the last round of Copilot review feedback could be addressed. This carries forward the two outstanding items that are still valid against
main:provides.templates/provides.scriptsentries with a duplicatenamewithin the same section are now rejected with aValidationError. The resolver (PresetResolver._extension_manifest_declared_template) returns the first entry matching a name, so a later duplicate was silently unreachable while still being exposed byExtensionManifest.templates/.scripts— this closes that gap at manifest-validation time instead. Added parametrized regression tests for bothtemplatesandscripts.extensions/EXTENSION-DEVELOPMENT-GUIDE.md'sprovidessection now distinguishes its own sub-fields (commands/templates/scripts) fromhooks/events, which are top-level manifest fields read from the manifest root, not nested underprovides— the prior wording could lead an author to indent them underprovides, where they wouldn't satisfy validation.The other two items from that last review round were doc-only / description-only and don't apply here: #4012's PR description has already been corrected in place, and the AGENTS.md acceptance-criterion item was intentionally left alone since that file documents only the AI-agent integration subsystem, not the extension system (which has its own docs, already updated).
Testing
New parametrized test
test_provides_entry_duplicate_name_rejectedintests/test_extensions.py::TestExtensionManifestTemplatesAndScriptscovers bothtemplatesandscripts. Confirmed it fails withDID NOT RAISE ValidationErroragainst the pre-fix source (git checkout HEAD~1 -- src/specify_cli/extensions/__init__.py), then passes after restoring the fix.AI Disclosure
Implemented autonomously by Claude Code (model: Claude Sonnet 5) under human direction, in response to outstanding automated review feedback on #4012 that had not been incorporated before that PR merged.