Skip to content

Share One Registration-Check Loop Between the Installer's Hooks - #3520

Merged
ptr727 merged 1 commit into
developfrom
share-registration-check-skeleton
Oct 27, 2026
Merged

ptr727 merged 1 commit into
developfrom
share-registration-check-skeleton

Conversation

@ptr727

@ptr727 ptr727 commented Oct 27, 2026

Copy link
Copy Markdown
Owner

registration_problems in host-setup/agent-safety/claude/install.py walked an event's groups for a hook's entries in two copies, check_pre_tool_hook and the SessionEnd sweep loop, so each fix to the walk had to land twice.

  • One check_hook now owns the walk. It picks out each entry names_hook matches, 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.
  • Each caller passes a 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.
  • Every message, its order, and its report or out.append choice are unchanged. A randomized differential run of the old and new function over 20000 generated settings files gave identical output.
  • A new test pins that a sweep under a narrowed matcher still counts toward the duplicate line.

The comments label 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 frontier tier, no findings.

Closes #3519

🤖 Generated with Claude Code

`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
Copilot AI lite review requested due to automatic review settings October 27, 2026 17:58
@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Oct 27, 2026
@coderabbitai

coderabbitai Bot commented Oct 27, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ptr727

ptr727 commented Oct 27, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head e38f852e5a730685f0f360d623aa9c6dcda6644b, the content this pull request carries at that commit against develop, and it recorded 0 findings.

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.

🟢 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_hook traversal 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

codecov Bot commented Oct 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@e713a5f). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #3520   +/-   ##
==========================================
  Coverage           ?   81.53%           
==========================================
  Files              ?       26           
  Lines              ?     8964           
  Branches           ?        0           
==========================================
  Hits               ?     7309           
  Misses             ?     1655           
  Partials           ?        0           
Flag Coverage Δ
python-3.13 81.53% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ptr727
ptr727 merged commit 487ed74 into develop Oct 27, 2026
14 checks passed
@ptr727
ptr727 deleted the share-registration-check-skeleton branch October 27, 2026 18:07
ptr727 added a commit that referenced this pull request Oct 27, 2026
…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants