Repository navigation
Share One Registration-Check Loop Between the Installer's Hooks - #3520
Conversation
`registration_problems` walked an event's groups for a hook's entries twice, once in `check_pre_tool_hook` and once for the SessionEnd sweep, so every fix to the walk, the named-versus-registered count, or the count lines had to land in both. One `check_hook` now owns that walk and takes a per-entry judgment from its caller. The PreToolUse judgment excludes a group whose matcher misses a tool, and the SessionEnd one excludes a too-short timeout and notes a narrowed matcher while still counting the entry. Every message, its order, and its report-or-append choice are unchanged. A new test pins that a sweep under a narrowed matcher still counts toward the duplicate line. Closes #3519
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
|
A recorded local strict-review pass covers head |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified, and the changes preserve existing validation and counting behavior with regression coverage for narrowed SessionEnd matchers.
No open issues 🎉
What changed in this PR
This pull request consolidates duplicated hook-registration checks in the installer while preserving existing diagnostics and counting behavior for PreToolUse and SessionEnd hooks.
Changes:
- Adds a shared
check_hooktraversal for registration validation. - Moves event-specific matcher and timeout checks into dedicated judgment functions.
- Adds regression coverage for narrowed SessionEnd matchers counting toward duplicate detection.
| File | Description |
|---|---|
host-setup/agent-safety/claude/test_install.py |
Verifies that narrowed SessionEnd matchers still contribute to duplicate-registration detection. |
host-setup/agent-safety/claude/install.py |
Shares registration scanning while preserving event-specific validation, diagnostics, and counting behavior. |
Review effort: Lite
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3520 +/- ##
==========================================
Coverage ? 81.53%
==========================================
Files ? 26
Lines ? 8964
Branches ? 0
==========================================
Hits ? 7309
Misses ? 1655
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…ain (#3521) ## Summary This promotes three changes to `main`: - [#3516](#3516) maps model tiers in one config, `spec/model-tiers.json`, carries the "Model Tiers" rule into the skills that dispatch, and adds a guard that refuses a highest-tier dispatch the maintainer did not allow. - [#3518](#3518) has the agent-safety installer's hooks share one registration helper. - [#3520](#3520) has those hooks share one registration-check loop. It also carries the fixes for this promotion's own review findings, each landed on `develop` first: - [#3522](#3522) requires a non-empty model name per tier and names both edits a model release makes. - [#3523](#3523) states what the highest-tier allowance covers and where the guard stops. - [#3524](#3524) rejects a tier sharing the maintainer-only model and states the allowance as conduct. - [#3525](#3525) matches the guard's alias boundaries regardless of case. - [#3526](#3526) mirrors the guard's CI self-tests in the local runbook. - [#3527](#3527) rejects a repeated tier name and names every hook the installer registers. Closes #3517 Closes #3519 🤖 Generated with [Claude Code](https://claude.com/claude-code)
registration_problemsinhost-setup/agent-safety/claude/install.pywalked an event's groups for a hook's entries in two copies,check_pre_tool_hookand the SessionEnd sweep loop, so each fix to the walk had to land twice.check_hooknow owns the walk. It picks out each entrynames_hookmatches, reports one that does not run the deployed file, counts named entries apart from sound ones, and closes with the "not registered" and "registered N times" lines.judge(group, hook)that reports the event's own notes and returns whether the entry counts. For PreToolUse a blind matcher excludes the entry. For SessionEnd a too-short timeout excludes it, and a narrowed matcher is noted while still counting.reportorout.appendchoice are unchanged. A randomized differential run of the old and new function over 20000 generated settings files gave identical output.The
commentslabel is on this PR because moving the existing comments into the judge functions re-indents them, which the prose gate reads as added lines. No comment text is new.Local strict review: one pass at the
frontiertier, no findings.Closes #3519
🤖 Generated with Claude Code