Skip to content

docs: clarify hook priority validation semantics#3594

Open
WOLIKIMCHENG wants to merge 1 commit into
github:mainfrom
WOLIKIMCHENG:docs/clarify-hook-priority-semantics
Open

docs: clarify hook priority validation semantics#3594
WOLIKIMCHENG wants to merge 1 commit 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

| `condition` | Optional expression evaluated by `HookExecutor` (using `config.<path>` or `env.<VAR>` with `is set`, `==`, or `!=`). Current command templates do not evaluate conditions and skip hooks with a non-empty condition. |
Hook event names identify when a hook is invoked. They generally use `before_<command>` or `after_<command>`, such as `before_implement`, `after_implement`, `before_tasks`, and `after_tasks`.

Extension manifests reject invalid hook priorities during installation. If an existing `.specify/extensions.yml` file contains a missing or corrupted `priority` value, `HookExecutor.get_hooks_for_event()` treats that entry as priority `10` when sorting.

@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

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