Skip to content

docs: clarify hook priority validation semantics#3594

Merged
mnriem merged 2 commits into
github:mainfrom
WOLIKIMCHENG:docs/clarify-hook-priority-semantics
Jul 22, 2026
Merged

docs: clarify hook priority validation semantics#3594
mnriem merged 2 commits into
github:mainfrom
WOLIKIMCHENG:docs/clarify-hook-priority-semantics

Conversation

@WOLIKIMCHENG

Copy link
Copy Markdown
Contributor

Description

Clarifies the hook priority docs so they distinguish two separate paths:

  • extension manifests reject invalid hook priorities during installation
  • existing .specify/extensions.yml hook entries with missing or corrupted priority values are treated as priority 10 when HookExecutor.get_hooks_for_event() sorts them

Testing

  • .venv/bin/python -m pytest tests/test_extensions.py::TestExtensionManifest::test_hook_priority_field_validation tests/test_extensions.py::TestHookExecutorRegistration::test_register_hooks_single_mapping_back_compat tests/test_extensions.py::TestHookExecutorRegistration::test_get_hooks_for_event_treats_missing_priority_as_default -q
  • git diff --check -- docs/reference/extensions.md

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Clarifies hook priority validation and fallback behavior.

Changes:

  • Distinguishes manifest validation from stored-hook sorting.
  • Documents the default priority of 10.
Show a summary per file
File Description
docs/reference/extensions.md Updates hook priority semantics; fallback wording needs correction.

Review details

Tip

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

  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment thread docs/reference/extensions.md Outdated

@mnriem mnriem left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please address Copilot feedback. If not applicable, please explain why

@WOLIKIMCHENG

Copy link
Copy Markdown
Contributor Author

Updated the hook-priority reference text to describe the current normalize_priority() behavior precisely. Stored missing, boolean, non-numeric, and non-positive values fall back to 10; numeric strings and finite floats are coerced with int(); non-finite floats are not guaranteed to fall back. This keeps the fix docs-only and aligned with the current implementation.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review details

  • Files reviewed: 1/1 changed files
  • Comments generated: 0 new
  • Review effort level: Medium

@mnriem
mnriem self-requested a review July 22, 2026 10:27
@mnriem
mnriem merged commit b6b3ec4 into github:main Jul 22, 2026
12 checks passed
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.

3 participants