Skip to content

Commit 78022da

Browse files
test(cli): track widened augment matcher in claude_config hook tests (#782)
The augment PostToolUse matcher gained the mcp__.*[Rr]epowise.*__.* pattern and the old value was demoted to a legacy matcher that migration widens. The hook install/migrate tests still pinned the pre-widening literal, so every run on main failed. Assert against claude_config._AUGMENT_MATCHER so the expected-output rows can't drift from the source again, and set the noop test's already-current input to the same constant.
1 parent 9375291 commit 78022da

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

tests/unit/cli/test_mcp_config.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ def test_install_claude_code_hooks_creates_missing_file(
414414
saved = json.loads(settings_path.read_text(encoding="utf-8"))
415415
assert "PreToolUse" not in saved["hooks"]
416416
assert _post_repowise_entries(saved) == [
417-
("Bash|PowerShell|Grep|Glob|Read|Edit|Write", "repowise-augment")
417+
(claude_config._AUGMENT_MATCHER, "repowise-augment")
418418
]
419419
assert _session_start_repowise_entries(saved) == [("startup|resume|clear", "repowise-augment")]
420420

@@ -452,7 +452,7 @@ def test_install_claude_code_hooks_preserves_user_pretool_hooks(
452452
assert saved["hooks"]["PreToolUse"][0]["hooks"][0]["command"] == "echo read"
453453
# PostToolUse now has the repowise hook.
454454
assert _post_repowise_entries(saved) == [
455-
("Bash|PowerShell|Grep|Glob|Read|Edit|Write", "repowise-augment")
455+
(claude_config._AUGMENT_MATCHER, "repowise-augment")
456456
]
457457

458458

@@ -498,7 +498,7 @@ def test_install_claude_code_hooks_migrates_pre_0_6_1_command(
498498
saved = json.loads(settings_path.read_text(encoding="utf-8"))
499499
assert "PreToolUse" not in saved["hooks"]
500500
assert _post_repowise_entries(saved) == [
501-
("Bash|PowerShell|Grep|Glob|Read|Edit|Write", "repowise-augment")
501+
(claude_config._AUGMENT_MATCHER, "repowise-augment")
502502
]
503503

504504

@@ -538,7 +538,7 @@ def test_install_claude_code_hooks_migrates_pre_0_6_2_matcher(
538538
saved = json.loads(settings_path.read_text(encoding="utf-8"))
539539
assert "PreToolUse" not in saved["hooks"]
540540
assert _post_repowise_entries(saved) == [
541-
("Bash|PowerShell|Grep|Glob|Read|Edit|Write", "repowise-augment")
541+
(claude_config._AUGMENT_MATCHER, "repowise-augment")
542542
]
543543

544544

@@ -594,7 +594,7 @@ def test_migrate_claude_code_hooks_handles_full_legacy_payload(
594594
saved = json.loads(settings_path.read_text(encoding="utf-8"))
595595
assert "PreToolUse" not in saved["hooks"]
596596
assert _post_repowise_entries(saved) == [
597-
("Bash|PowerShell|Grep|Glob|Read|Edit|Write", "repowise-augment")
597+
(claude_config._AUGMENT_MATCHER, "repowise-augment")
598598
]
599599

600600
# Idempotent: a second run finds nothing to do.
@@ -632,7 +632,7 @@ def test_migrate_claude_code_hooks_widens_legacy_matchers(
632632
assert claude_config.migrate_claude_code_hooks() is True
633633
saved = json.loads(settings_path.read_text(encoding="utf-8"))
634634
assert _post_repowise_entries(saved) == [
635-
("Bash|PowerShell|Grep|Glob|Read|Edit|Write", "repowise-augment")
635+
(claude_config._AUGMENT_MATCHER, "repowise-augment")
636636
]
637637

638638

@@ -720,7 +720,7 @@ def test_migrate_claude_code_hooks_noop_when_already_current(
720720
"hooks": {
721721
"PostToolUse": [
722722
{
723-
"matcher": "Bash|PowerShell|Grep|Glob|Read|Edit|Write",
723+
"matcher": claude_config._AUGMENT_MATCHER,
724724
"hooks": [{"type": "command", "command": "repowise-augment"}],
725725
}
726726
],

0 commit comments

Comments
 (0)