From 8fd93a2e08bb10aa8d9943e0043e1a6f03439958 Mon Sep 17 00:00:00 2001 From: Martin Vogel Date: Tue, 27 Oct 2026 19:32:04 +0100 Subject: [PATCH] test(smoke): pin the Claude PostToolUse matcher that covers the graph tools Smoke check 8d required Claude's PostToolUse matcher to be exactly Read. The drift note widens it on purpose to Read|mcp__.*codebase-memory-mcp__.*, so a graph tool call can reset the search count, and the macOS PR smoke failed on it. 8d now requires exactly the new matcher, and besides a Search matcher it also refuses a catch-all ("*" or empty) matcher, as its comment promised. Checked against real installs: the previous binary's Read-only settings fail 8d, the new install passes, and the new install plus a catch-all PostToolUse entry fails. Refs #509 Signed-off-by: Martin Vogel --- scripts/smoke-test.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/smoke-test.sh b/scripts/smoke-test.sh index c1a3f3ec7..2a894ca55 100755 --- a/scripts/smoke-test.sh +++ b/scripts/smoke-test.sh @@ -1697,7 +1697,8 @@ echo "OK 8c-i: Claude exact-tool graph subagent" # 8d: Claude Code hooks keep search augmentation and read-coverage reporting # separate: PreToolUse matches exactly Grep|Glob|Bash, while PostToolUse matches -# exactly Read. Neither hook may grow a Search or catch-all matcher. +# exactly Read plus the graph tools, whose calls reset the drift note. Neither +# hook may grow a Search or catch-all matcher. if ! cat "$FAKE_HOME/.claude/settings.json" 2>/dev/null | python3 -c " import json, sys d = json.load(sys.stdin) @@ -1705,14 +1706,15 @@ all_hooks = d.get('hooks', {}) pre = all_hooks.get('PreToolUse', []) post = all_hooks.get('PostToolUse', []) ok = (any(h.get('matcher') == 'Grep|Glob|Bash' for h in pre) and - any(h.get('matcher') == 'Read' for h in post)) -bad = any('Search' in str(h.get('matcher', '')) for h in pre + post) + any(h.get('matcher') == 'Read|mcp__.*codebase-memory-mcp__.*' for h in post)) +bad = any('Search' in str(h.get('matcher', '')) or h.get('matcher', '') in ('', '*') + for h in pre + post) sys.exit(0 if (ok and not bad) else 1) " 2>/dev/null; then echo "FAIL 8d: Claude search/read hook matchers are not exact" exit 1 fi -echo "OK 8d: Claude Code PreToolUse Grep|Glob|Bash + PostToolUse Read" +echo "OK 8d: Claude Code PreToolUse Grep|Glob|Bash + PostToolUse Read and graph tools" # 8e: Claude Code shim script — must be non-blocking augmenter, not a gate. # #929: Windows installs a .cmd script (extensionless bash shims triggered the