Skip to content

Require single-handler legacy Claude hook entries - #72

Merged
TerminallyLazy merged 1 commit into
mainfrom
codex/strict-legacy-hook-entry
Sep 15, 2026
Merged

TerminallyLazy merged 1 commit into
mainfrom
codex/strict-legacy-hook-entry

Conversation

@TerminallyLazy

@TerminallyLazy TerminallyLazy commented Sep 15, 2026 •

Copy link
Copy Markdown
Owner

Legacy Claude upgrade preparation accepted an expected Tree Ring handler inside a user-expanded hooks array. Require the original single-handler entry shape and reject mixed arrays without changing the caller's JSON. The regression covers an unrelated custom sibling and verifies that the whole settings object is preserved on rejection.

Public activation behavior remains unchanged: create-only publication already prevents replacing an existing bridge file. This is source hardening after the v0.15.13 tag, with no version bump or replacement release.

Validation: the mixed-handler regression failed before the guard and passed after it; all 597 workspace tests passed with cargo +stable test --workspace --locked; formatting and diff checks passed. The activation DOX contract now explicitly names the single-handler shape; parent contracts remain accurate.

High-level PR Summary

This PR adds stricter validation for legacy Claude handler entries during upgrade preparation. The changes ensure that only single-handler hook arrays in the exact original format are accepted for replacement, preventing mixed arrays that contain both the expected Tree Ring handler and unrelated custom handlers. The validation now explicitly checks that hook arrays contain exactly one handler, and a new regression test case verifies that mixed-handler scenarios are properly rejected while preserving the user's original settings.

⏱️ Estimated Review Time: 5-15 minutes

💡 Review Order Suggestion
Order File Path
1 crates/tree-ring-memory-cli/src/activation/AGENTS.md
2 crates/tree-ring-memory-cli/src/activation/bridge.rs

Need help? Join our Discord

@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 46 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: f9046d5d-23c8-4860-bb9a-40323e225161

📥 Commits

Reviewing files that changed from the base of the PR and between f719c34 and 03efb67.

📒 Files selected for processing (2)
  • crates/tree-ring-memory-cli/src/activation/AGENTS.md
  • crates/tree-ring-memory-cli/src/activation/bridge.rs

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.

@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Enforce single-handler shape for legacy Claude hook upgrades

🐞 Bug fix 🧪 Tests 📝 Documentation 🕐 Less than 10 minutes

Grey Divider

AI Description

• Reject legacy Claude entries that combine Tree Ring and custom handlers.
• Preserve the complete settings object when legacy bundle recognition fails.
• Document and test the required single-handler legacy entry shape.
Diagram

graph TD
  A["Claude settings"] --> B["Legacy scanner"] --> C{"Expected handler?"} -->|Yes| E{"Single handler?"} -->|Yes| F["Replace bundle"]
  C -->|No| D["Preserve settings"]
  E -->|No| D
Loading
High-Level Assessment

The focused shape check is the appropriate approach because it closes the mixed-handler ownership gap while preserving existing replacement semantics and clone-before-mutation safety. Reworking recognition around full wrapper equality would be broader without providing a meaningful behavioral advantage.

Files changed (2) +17 / -3

Bug fix (1) +16 / -2
bridge.rsReject mixed legacy Claude handler entries +16/-2

Reject mixed legacy Claude handler entries

• Requires any entry containing an expected legacy handler to have exactly one handler before replacement. Extends the mutation-safety regression to cover an unrelated custom sibling and confirm the entire settings object remains unchanged on rejection.

crates/tree-ring-memory-cli/src/activation/bridge.rs

Documentation (1) +1 / -1
AGENTS.mdClarify the legacy Claude single-handler contract +1/-1

Clarify the legacy Claude single-handler contract

• Specifies that earlier Claude bundles are recognized only when each generated entry has the recorded single-handler shape.

crates/tree-ring-memory-cli/src/activation/AGENTS.md

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can reply 'qodo' on any finding to push back, ask questions, or dig deeper

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@TerminallyLazy
TerminallyLazy merged commit 00591d4 into main Sep 15, 2026
2 of 3 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.

1 participant