From 7d598e22cf5af0e17fa9b7231793ac6fbede7987 Mon Sep 17 00:00:00 2001 From: AIOSAI Date: Thu, 7 May 2026 15:41:14 -0700 Subject: [PATCH] =?UTF-8?q?feat(system):=20fix(tests):=20update=20test=5Fb?= =?UTF-8?q?ootstrap.py=20assertions=20to=20match=20PR=20#522=20bootstrap?= =?UTF-8?q?=20changes=20=E2=80=94=20PreToolUse,=20PostToolUse,=20Stop=20re?= =?UTF-8?q?moved=20from=20project=20settings=20(provider-only),=20tests=20?= =?UTF-8?q?now=20assert=20their=20absence?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: @devpulse --- src/aipass/aipass/tests/test_bootstrap.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/aipass/aipass/tests/test_bootstrap.py b/src/aipass/aipass/tests/test_bootstrap.py index 35352c87..6d518526 100644 --- a/src/aipass/aipass/tests/test_bootstrap.py +++ b/src/aipass/aipass/tests/test_bootstrap.py @@ -292,7 +292,7 @@ def test_init_project_claude_settings_content(tmp_path): def test_init_project_settings_has_all_hooks(tmp_path): - """.claude/settings.json wires all hook event types.""" + """.claude/settings.json wires project-compatible hook event types.""" target = tmp_path / "proj" target.mkdir() @@ -308,19 +308,15 @@ def test_init_project_settings_has_all_hooks(tmp_path): assert "aipass_local_prompt.md" in ups_hooks[1]["hooks"][0]["command"] assert "branch_prompt_loader.py" in ups_hooks[2]["hooks"][0]["command"] - # Enforcement hooks wired to their event types - assert len(data["hooks"]["PostToolUse"]) == 1 - assert "auto_fix_diagnostics.py" in data["hooks"]["PostToolUse"][0]["hooks"][0]["command"] - - assert len(data["hooks"]["PreToolUse"]) == 1 - assert "pre_edit_gate.py" in data["hooks"]["PreToolUse"][0]["hooks"][0]["command"] - - assert len(data["hooks"]["Stop"]) == 1 - assert "subagent_stop_gate.py" in data["hooks"]["Stop"][0]["hooks"][0]["command"] - + # PreCompact fires from project level assert len(data["hooks"]["PreCompact"]) == 1 assert "pre_compact.py" in data["hooks"]["PreCompact"][0]["hooks"][0]["command"] + # PreToolUse, PostToolUse, Stop are provider-only — NOT in project settings + assert "PreToolUse" not in data["hooks"] + assert "PostToolUse" not in data["hooks"] + assert "Stop" not in data["hooks"] + def test_init_project_global_prompt_content(tmp_path): """Global prompt contains project name and AIPass terminology.""" @@ -893,14 +889,14 @@ def test_init_project_hooks_idempotent_on_rerun(tmp_path): def test_init_project_settings_has_all_event_types(tmp_path): - """settings.json contains all 5 hook event types.""" + """settings.json contains only project-compatible hook event types.""" target = tmp_path / "proj" target.mkdir() init_project(target, project_name="events") settings = json.loads((target / ".claude" / "settings.json").read_text(encoding="utf-8")) - expected_events = {"UserPromptSubmit", "PostToolUse", "PreToolUse", "Stop", "PreCompact"} + expected_events = {"UserPromptSubmit", "PreCompact"} assert set(settings["hooks"].keys()) == expected_events