Skip to content

feat(extensions,presets): add priority-based resolution ordering#1855

Open
mbachorik wants to merge 2 commits intogithub:mainfrom
mbachorik:feature/extension-priority-resolution
Open

feat(extensions,presets): add priority-based resolution ordering#1855
mbachorik wants to merge 2 commits intogithub:mainfrom
mbachorik:feature/extension-priority-resolution

Conversation

@mbachorik
Copy link
Contributor

Summary

  • Add priority-based resolution ordering for extensions and presets
  • Lower priority number = higher precedence (default: 10)
  • Backwards compatible with existing installations

Changes

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

Test plan

  • 325 tests passing
  • Linter clean
  • Manual testing with real extensions (jira, linear, reverse-eng)
  • Manual testing with presets (priority resolution verified)
  • Backwards compatibility verified (legacy entries default to priority 10)

Closes #1845
Closes #1854

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings March 14, 2026 16:54
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ExtensionRegistry and 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.

Copilot AI review requested due to automatic review settings March 14, 2026 17:08
@mbachorik mbachorik force-pushed the feature/extension-priority-resolution branch from d8ec7d3 to 0f94361 Compare March 14, 2026 17:08
@mbachorik mbachorik force-pushed the feature/extension-priority-resolution branch from 0f94361 to 598f39b Compare March 14, 2026 17:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 priority metadata and list_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>
@mbachorik mbachorik force-pushed the feature/extension-priority-resolution branch from 598f39b to 13a78ae Compare March 14, 2026 17:26
@mbachorik mbachorik requested a review from Copilot March 14, 2026 17:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 priority support for extensions (registry sorting + install/add/update preservation + CLI display/commands).
  • Extends preset tooling with preset set-priority, priority display in preset 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.

@mbachorik mbachorik marked this pull request as ready for review March 14, 2026 18:01
@mbachorik mbachorik requested a review from mnriem as a code owner March 14, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preset system: Add set-priority command and info display Extension system: Add priority-based resolution ordering

2 participants