Skip to content

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

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

feat(extensions,presets): add priority-based resolution ordering#1855
mbachorik wants to merge 12 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

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.

@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
@mnriem mnriem requested a review from Copilot March 16, 2026 13:00
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 precedence for extension and preset resolution (lower number = higher precedence) to make template selection deterministic across installs, and exposes priority management via new/updated CLI commands.

Changes:

  • Introduces priority metadata for extensions and presets, with list_by_priority() sorting (priority, then ID) and defaults for legacy entries.
  • Adds CLI support to set priority (extension set-priority, preset set-priority) and display priority in list/info.
  • Updates resolver logic/tests/docs to use priority ordering and ensure backwards compatibility behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/specify_cli/extensions.py Adds ExtensionRegistry.list_by_priority(), persists/validates priority during install, and includes priority in installed listing.
src/specify_cli/presets.py Adds PresetRegistry.update(), makes preset ordering deterministic with deep-copied metadata, and uses extension registry priority ordering during template resolution.
src/specify_cli/__init__.py Adds CLI validation and new set-priority commands; displays priority in extension list/info and preset info.
tests/test_extensions.py Adds unit/CLI/back-compat coverage for extension priority behavior.
tests/test_presets.py Updates resolver tests to register extensions in the registry; adds preset set-priority + back-compat tests.
extensions/RFC-EXTENSION-SYSTEM.md Documents the new priority field, CLI options, and expected output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@mnriem mnriem left a comment

Choose a reason for hiding this comment

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

Please address Copilot feedback. BTW you rock!

@mbachorik
Copy link
Contributor Author

Please address Copilot feedback. BTW you rock!

will check them tonight or tomorrow evening .

Copilot AI review requested due to automatic review settings March 16, 2026 19:16
@mbachorik mbachorik marked this pull request as draft March 16, 2026 19:20
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 so overrides are deterministic when multiple sources provide the same templates/commands, while remaining backwards compatible via a default priority of 10 (lower number = higher precedence).

Changes:

  • Introduces priority to extension/preset registries plus list_by_priority() for deterministic ordering (with tie-break by ID).
  • Adds CLI support to set priority at install time and adjust it later (extension add --priority, extension set-priority, preset set-priority) and displays priority in info/list.
  • Updates PresetResolver to resolve extension-provided templates using registry priority ordering (with a directory-scan fallback if registry is missing/corrupt) and adds/updates tests + RFC docs.

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 list_by_priority() and persists/validates priority through installs; includes priority in list_installed().
src/specify_cli/presets.py Adds PresetRegistry.update(), deep-copied deterministic list_by_priority(), validates preset priority on install, and resolves extension templates by extension priority.
src/specify_cli/__init__.py Adds CLI flags/commands for setting priority and prints priority in extension list/info and preset info; preserves priority on extension update.
tests/test_extensions.py Adds coverage for extension priority ordering, CLI integration, and backwards compatibility defaults.
tests/test_presets.py Updates resolver source attribution expectations and adds tests for preset set-priority + legacy priority defaults.
extensions/RFC-EXTENSION-SYSTEM.md Documents the priority field and updates CLI usage/output examples accordingly.

💡 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.

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, deterministic resolution order for installed extensions and presets, enabling predictable overrides when multiple providers supply the same templates (lower priority = higher precedence; default 10), while maintaining backward compatibility for legacy registry entries.

Changes:

  • Introduces priority metadata support and list_by_priority() ordering for extensions (and tightens deterministic ordering via tie-break by ID).
  • Updates preset template resolution to prefer extensions in priority order (with a fallback to directory scanning when the extension registry is missing/empty).
  • Adds CLI support and tests for setting/viewing priority for both extensions and presets, plus backward-compat tests.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_presets.py Registers extensions in the extension registry during resolver tests; adds preset set-priority and legacy-priority compatibility tests.
tests/test_extensions.py Adds comprehensive unit/CLI/back-compat tests for extension priority behavior.
src/specify_cli/presets.py Adds PresetRegistry.update(), makes list_by_priority() deterministic/deep-copied, and resolves extension templates using extension priority ordering with fallback behavior.
src/specify_cli/extensions.py Adds ExtensionRegistry.list_by_priority() and persists/validates priority through extension installs and listing.
src/specify_cli/__init__.py Adds CLI validation/output for priority, plus extension set-priority and preset set-priority commands.
extensions/RFC-EXTENSION-SYSTEM.md Documents the new priority field and updates CLI examples (but see doc/CLI option mismatch comment).

💡 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 16, 2026 19:35
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 (lower number = higher precedence, default 10) across extension/preset metadata and CLI, and updates template resolution to respect extension priority (with back-compat defaults).

Changes:

  • Add priority support to extension installs/registry, plus ExtensionRegistry.list_by_priority() and CLI surfaces (--priority, set-priority, list/info output).
  • Add preset set-priority command and show priority in preset info; add preset registry update support.
  • Update PresetResolver to resolve extension templates using registry priority ordering with a directory-scan fallback.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_presets.py Updates resolver source attribution expectations and adds coverage for preset set-priority + legacy priority defaults.
tests/test_extensions.py Adds coverage for extension priority ordering, CLI integration, and legacy entries defaulting to priority 10.
src/specify_cli/presets.py Adds PresetRegistry.update(), enhances list_by_priority() determinism, and updates extension template resolution to use priority ordering.
src/specify_cli/extensions.py Adds ExtensionRegistry.list_by_priority() and persists/validates priority during installs and listing.
src/specify_cli/init.py Wires priority into CLI (extension add --priority, extension set-priority, preset set-priority) and displays priority in list/info commands.
extensions/RFC-EXTENSION-SYSTEM.md Documents the new priority field, CLI flags/commands, and updated list output format.

💡 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 16, 2026 19:44
@mbachorik
Copy link
Contributor Author

@mnriem sorry, mis-clicked on you (to re-request review). still playing cat-mouse with copilot ...

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 deterministic, priority-based resolution ordering across extensions and presets, aligning template resolution behavior and exposing priority controls via CLI and docs.

Changes:

  • Introduces priority handling and deterministic list_by_priority() ordering (default 10; lower wins; ties alphabetical) for extensions and presets.
  • Updates PresetResolver to resolve extension-provided templates using priority ordering and improved source attribution.
  • Adds CLI support for setting/viewing priorities (--priority on add; set-priority commands) and updates RFC + tests.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/test_presets.py Adds coverage for preset priority behavior, extension-template resolution ordering, and new preset set-priority command.
tests/test_extensions.py Adds unit tests for normalize_priority, extension registry priority ordering, CLI integration, and backwards-compat cases.
src/specify_cli/presets.py Adds preset registry update semantics, priority-sorted listing with normalization, and priority-aware extension template resolution.
src/specify_cli/extensions.py Adds normalize_priority, ExtensionRegistry.list_by_priority(), and persists/returns priority in install & listing flows.
src/specify_cli/init.py Adds/updates CLI commands/options to set/display priority for presets/extensions and preserves priority during extension update.
extensions/RFC-EXTENSION-SYSTEM.md Documents the new priority field, updated extension list/add output/options, and set-priority usage.

💡 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.

Add defensive checks throughout CLI commands and manager methods
to handle cases where registry entries may be corrupted (non-dict
values). This prevents AttributeError when calling .get() on
non-dict metadata.

Locations fixed:
- __init__.py: preset/extension info, set-priority, enable/disable,
  upgrade commands
- extensions.py: list_installed()
- presets.py: list_installed()

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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 so template conflicts resolve deterministically (lower number = higher precedence, default 10), with CLI support to set/view priorities and tests/docs updates to match.

Changes:

  • Implement priority normalization + deterministic ordering (priority, then ID) for extensions/presets, and apply it to template resolution (including unregistered extension dirs).
  • Add CLI support for setting and displaying priorities (--priority, extension set-priority, preset set-priority, info/list output updates).
  • Expand test coverage for priority ordering, invalid/corrupted registry data, and backward compatibility defaults.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/specify_cli/extensions.py Adds normalize_priority(), priority persistence/validation on install, and ExtensionRegistry.list_by_priority() support.
src/specify_cli/presets.py Adds PresetRegistry.update(), makes preset ordering deterministic, and updates resolver to use extension priority ordering + fallback scanning.
src/specify_cli/__init__.py Adds/updates CLI commands and output to set/show priority for presets/extensions; validates priority inputs.
tests/test_extensions.py Adds unit/integration tests for priority normalization, registry ordering, CLI behavior, and back-compat.
tests/test_presets.py Adds tests for preset ordering robustness and extension priority behavior in preset template resolution.
extensions/RFC-EXTENSION-SYSTEM.md Documents the new priority field and updated CLI examples/options.

💡 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.

Use normalize_priority() for all priority display in CLI commands
to ensure displayed values match actual resolution behavior when
registry data is corrupted/hand-edited.

Locations fixed:
- extensions.py: list_installed()
- presets.py: list_installed(), PresetResolver
- __init__.py: preset info, extension info, set-priority commands

Also added GraphQL query for unresolved PR comments to CLAUDE.md.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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

This PR introduces priority-based ordering for extension and preset resolution so that conflicts (e.g., multiple providers for the same template) resolve deterministically, with lower numeric priority taking precedence (default 10). It also adds CLI support to set priorities post-install and surfaces priority in info/list output.

Changes:

  • Add priority normalization + priority-sorted registry listing for extensions and presets, and use it in template resolution.
  • Add CLI support for extension set-priority / preset set-priority and --priority during install; display priority in list/info.
  • Add/extend tests for normalization, ordering, backwards compatibility, and resolver attribution.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/specify_cli/extensions.py Adds normalize_priority(), priority support in installs, and ExtensionRegistry.list_by_priority() for deterministic resolution.
src/specify_cli/presets.py Adds priority-safe PresetRegistry.list_by_priority(), preserves timestamps on update, and updates PresetResolver to prioritize extensions deterministically (including unregistered dirs).
src/specify_cli/__init__.py Wires priority into CLI (--priority, set-priority commands) and displays priority in extension list/info and preset info.
tests/test_extensions.py Adds unit/integration coverage for priority normalization, registry ordering, CLI behavior, and backwards compatibility.
tests/test_presets.py Adds coverage for preset priority edge cases and extension priority interaction in template resolution + attribution.
extensions/RFC-EXTENSION-SYSTEM.md Updates RFC docs to document priority field and CLI output/options/commands.
CLAUDE.md Adds repository guidance for Claude Code (but includes versioning guidance that conflicts with the documented release process).

💡 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.

Changed set-priority commands to check if the raw stored value is
already a valid int equal to the requested priority before skipping.
This ensures corrupted values (e.g., "high") get repaired even when
setting to the default priority (10).

Also removed CLAUDE.md that was accidentally added to the repo.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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 deterministic, priority-based resolution ordering across extensions and presets so users can control precedence when multiple packs provide overlapping templates/commands, while preserving backward compatibility via a default priority of 10.

Changes:

  • Introduces priority normalization + list_by_priority() ordering for extensions/presets (lower number wins; ties by ID).
  • Extends CLI to set/view priorities (extension add --priority, extension set-priority, preset set-priority, plus priority display in info/list).
  • Updates template resolution to use extension priority ordering (including unregistered extension directories) and expands test coverage for legacy/corrupted registry scenarios.

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 normalize_priority(), priority persistence on install, and ExtensionRegistry.list_by_priority() ordering behavior.
src/specify_cli/presets.py Adds PresetRegistry.update(), hardens/normalizes priority ordering, and applies extension priority ordering in PresetResolver.
src/specify_cli/__init__.py CLI wiring for priority options/commands and priority display; preserves priority across extension updates.
tests/test_extensions.py Adds unit + CLI tests for priority normalization, ordering, and backwards compatibility.
tests/test_presets.py Adds preset priority compatibility tests and extension-priority resolution tests within PresetResolver.
extensions/RFC-EXTENSION-SYSTEM.md Documents the new priority field, updated list output, and the new set-priority command.

💡 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.

- Normalize priority when restoring during extension update to prevent
  propagating corrupted values (e.g., "high", 0, negative)
- Add isinstance(dict) checks in ExtensionRegistry.update() and
  PresetRegistry.update() to handle corrupted entries (string/list)
  that would cause TypeError on merge

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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 deterministic priority-based ordering to extension and preset resolution so that lower priority values take precedence (default 10), aligning behavior across registries, CLI commands, and template resolution.

Changes:

  • Add priority normalization + priority-sorted listing (list_by_priority()) for extensions and presets, including deterministic tie-breaking by ID.
  • Extend CLI to support priority configuration (extension add --priority, extension set-priority, preset set-priority) and display priority in info/list outputs.
  • Update PresetResolver to resolve extension templates using priority ordering while retaining fallback behavior for unregistered/on-disk extension directories.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/specify_cli/extensions.py Adds normalize_priority(), persists/validates priority on install, and provides ExtensionRegistry.list_by_priority() for deterministic ordering.
src/specify_cli/presets.py Adds PresetRegistry.update(), hardens priority sorting, and updates PresetResolver to use extension priority ordering (including unregistered dirs).
src/specify_cli/__init__.py Wires priority into CLI (--priority, set-priority) and displays priority in relevant outputs.
tests/test_extensions.py Adds unit + CLI tests for priority normalization, ordering, backwards compatibility, and update preservation.
tests/test_presets.py Adds tests for preset priority robustness, extension priority resolution in PresetResolver, and new preset set-priority command.
extensions/RFC-EXTENSION-SYSTEM.md Updates RFC examples/docs to reflect stored priority, CLI output, and new commands/options.

💡 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.

When registry entry is corrupted (non-dict), metadata becomes {} after
the isinstance check. Use metadata.get("version", manifest.version)
instead of metadata["version"] to avoid KeyError.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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

Implements deterministic, priority-based resolution ordering across extensions and presets (lower number = higher precedence, default 10), including CLI support to set/update priority and resolver changes so template selection is stable and overrideable.

Changes:

  • Add priority normalization + list_by_priority() ordering for extension/preset registries, including corruption/legacy handling.
  • Add CLI support to set and display priority (extension add --priority, extension set-priority, preset set-priority, plus list/info output updates).
  • Update PresetResolver to resolve extension templates using unified priority ordering across registered + unregistered extension directories.

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
tests/test_presets.py Adds coverage for preset priority defaults/legacy entries and extension-priority template resolution behavior.
tests/test_extensions.py Adds unit tests for normalize_priority, registry ordering, CLI priority flows, and legacy/corruption cases.
src/specify_cli/presets.py Adds preset registry update(), priority-sorted listing, priority validation on install, and priority-aware extension resolution in PresetResolver.
src/specify_cli/extensions.py Introduces normalize_priority, priority-sorted registry listing, priority validation on install, and includes priority in installed metadata.
src/specify_cli/init.py Wires priority validation/options into CLI commands; adds preset set-priority and extension set-priority; displays priority in list/info.
extensions/RFC-EXTENSION-SYSTEM.md Updates RFC docs/examples to include priority field and new/updated CLI behaviors/output.

💡 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 17, 2026 11:21
@mbachorik
Copy link
Contributor Author

Ready for review finally

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 deterministic, priority-based ordering for extension and preset resolution, ensuring predictable precedence when multiple sources provide the same templates and giving users CLI controls to inspect/change priority.

Changes:

  • Introduces priority (default 10, lower wins; ties alphabetical) to extensions and wires it into template resolution ordering (including unregistered extension directories).
  • Adds CLI support to set/display priority for extensions and presets (--priority on install; set-priority commands; show in list/info).
  • Expands test coverage for normalization, ordering, attribution strings, legacy/back-compat, and corrupted-registry scenarios; updates the extension-system RFC.

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
tests/test_presets.py Adds tests for preset ordering edge cases, extension attribution/version formatting, and extension-priority behavior in PresetResolver; adds preset set-priority CLI tests and legacy/back-compat tests.
tests/test_extensions.py Adds unit tests for normalize_priority, registry ordering, CLI integration (--priority, set-priority), update preservation, and legacy/back-compat behavior.
src/specify_cli/presets.py Adds/updates preset registry update semantics, deep-copied priority-sorted listing, priority validation, and priority-aware extension template resolution (including unregistered dirs).
src/specify_cli/extensions.py Adds normalize_priority, priority validation on install paths, priority inclusion in list_installed, and ExtensionRegistry.list_by_priority() with deterministic ordering.
src/specify_cli/init.py Adds CLI validation + plumbing for priority, adds preset set-priority and extension set-priority, and displays priority in extension list/info and preset info.
extensions/RFC-EXTENSION-SYSTEM.md Documents the new priority registry field, updated extension list output, --priority flag, and extension set-priority command.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

3 participants