feat(extensions,presets): add priority-based resolution ordering#1855
feat(extensions,presets): add priority-based resolution ordering#1855mbachorik wants to merge 2 commits intogithub:mainfrom
Conversation
Add priority field to extension and preset registries for deterministic template resolution when multiple sources provide the same template. Extensions: - Add `list_by_priority()` method to ExtensionRegistry - Add `--priority` option to `extension add` command - Add `extension set-priority` command - Show priority in `extension list` and `extension info` - Preserve priority during `extension update` - Update RFC documentation Presets: - Add `preset set-priority` command - Show priority in `preset info` output - Use priority ordering in PresetResolver for extensions Both systems: - Lower priority number = higher precedence (default: 10) - Backwards compatible with legacy entries (missing priority defaults to 10) - Comprehensive test coverage including backwards compatibility Closes github#1845 Closes github#1854 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a priority field to extensions (and extends preset support) so resolution can be ordered deterministically, with lower numbers taking precedence, and exposes this via CLI commands and outputs.
Changes:
- Add priority-aware ordering to
ExtensionRegistryand use it in preset template resolution for extensions. - Add CLI support for setting priority (
extension add --priority,extension set-priority,preset set-priority) and display priority in list/info. - Add tests for priority behavior and backwards compatibility defaults (priority=10).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
src/specify_cli/extensions.py |
Adds priority persistence and ExtensionRegistry.list_by_priority() for ordering. |
src/specify_cli/presets.py |
Uses extension registry priority ordering during extension template resolution; adds preset registry update helper. |
src/specify_cli/__init__.py |
Adds CLI options/commands to set/display priority for extensions and presets; preserves priority on extension update. |
tests/test_extensions.py |
Adds unit + CLI tests for extension priority ordering, persistence, and legacy defaults. |
tests/test_presets.py |
Updates resolution tests to register extensions in registry; adds preset set-priority + legacy priority tests. |
extensions/RFC-EXTENSION-SYSTEM.md |
Documents the new priority field and CLI behaviors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
d8ec7d3 to
0f94361
Compare
0f94361 to
598f39b
Compare
There was a problem hiding this comment.
Pull request overview
Adds a priority-based ordering model (lower number = higher precedence, default 10) across extensions and presets to make template/command resolution deterministic, with CLI support to view and modify priority and tests/docs updates.
Changes:
- Introduces
prioritymetadata andlist_by_priority()for extensions (and enhances preset sorting determinism/back-compat). - Adds CLI support for setting/displaying priority (
extension add --priority,extension set-priority,preset set-priority, priority shown in info/list). - Updates preset template resolution to iterate extensions by registry priority rather than directory name order; expands tests and RFC docs accordingly.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/specify_cli/extensions.py |
Adds extension list_by_priority() and persists priority during install/listing. |
src/specify_cli/presets.py |
Adds preset registry update(), strengthens list_by_priority() ordering, and resolves extension templates by extension priority. |
src/specify_cli/__init__.py |
Adds/updates CLI commands and output to set/show priority; preserves priority on extension update. |
tests/test_extensions.py |
Adds coverage for extension priority ordering, CLI integration, and legacy/back-compat behavior. |
tests/test_presets.py |
Updates resolver tests for new extension source attribution and adds tests for preset set-priority + legacy priority behavior. |
extensions/RFC-EXTENSION-SYSTEM.md |
Documents the new priority field, CLI flags/commands, and updated list output examples. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
- list_by_priority(): add secondary sort by ID for deterministic ordering, return deep copies to prevent mutation - install_from_directory/zip: validate priority >= 1 early - extension add CLI: validate --priority >= 1 before install - PresetRegistry.update(): preserve installed_at timestamp - Test assertions: use exact source string instead of substring match Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
598f39b to
13a78ae
Compare
There was a problem hiding this comment.
Pull request overview
Adds priority-based ordering to extension and preset resolution to make overrides deterministic across installs, aligning extension behavior with the existing preset priority model and exposing priority controls via the CLI.
Changes:
- Introduces
prioritysupport for extensions (registry sorting + install/add/update preservation + CLI display/commands). - Extends preset tooling with
preset set-priority, priority display inpreset info, and backwards-compatibility handling for legacy entries. - Updates template resolution to iterate extensions/presets by priority (lower number = higher precedence) and updates RFC docs/tests accordingly.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/specify_cli/extensions.py |
Adds priority-aware sorting (list_by_priority) and persists/returns priority during installs and listing. |
src/specify_cli/presets.py |
Adds registry update helper, makes preset ordering deterministic, validates priority on install, and resolves extension templates via registry priority order. |
src/specify_cli/__init__.py |
Adds/validates --priority for extension add, adds extension set-priority and preset set-priority, and displays priority in list/info outputs. |
tests/test_extensions.py |
Adds coverage for extension priority ordering, CLI integration, and legacy/compat behavior. |
tests/test_presets.py |
Updates resolver tests to register extensions in the registry and adds tests for preset set-priority + legacy preset behavior. |
extensions/RFC-EXTENSION-SYSTEM.md |
Documents the new priority field and CLI options/commands. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Summary
Changes
Extensions
list_by_priority()method to ExtensionRegistry--priorityoption toextension addcommandextension set-prioritycommandextension listandextension infoextension updatePresets
preset set-prioritycommandpreset infooutputTest plan
Closes #1845
Closes #1854
🤖 Generated with Claude Code