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 <martin.vogel.tech@gmail.com>
This commit is contained in:
Martin Vogel committed 2026-10-27 19:32:04 +01:00
1 parent 402617555c
commit 8fd93a2e08
1 file changed
+6 -4
+6 -4
View File
@@ -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