From 94fa1d4f1c629ea2390c63df68b6a429f829fe27 Mon Sep 17 00:00:00 2001 From: "Aaron K. Clark (CryptoJones)" Date: Sat, 15 Aug 2026 14:28:53 -0500 Subject: [PATCH 1/2] test: pin the POSIX hook form in the seven platform-naive guard tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The #259 change made native Windows register direct omind hook commands, so the windows-latest CI runners started exercising the Windows path in tests that assert omi-guard.sh wiring — both Windows jobs failed on PR #263 and the merge went through anyway (my watch/merge chain was not gated; the release code itself is correct and guest-verified). A posix_form fixture pins _windows() False for those seven tests; the new Windows-path tests already pin True, so both forms stay covered on every runner. Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01QwU16vtyhZwcHf1BevWGSw --- tests/test_provision.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tests/test_provision.py b/tests/test_provision.py index aadf533..69ba27f 100644 --- a/tests/test_provision.py +++ b/tests/test_provision.py @@ -75,6 +75,14 @@ def isolate_claude_skill(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> Pat return skill_dir +@pytest.fixture +def posix_form(monkeypatch: pytest.MonkeyPatch) -> None: + """Pin the POSIX .sh hook form: these tests assert omi-guard.sh wiring, + which native Windows deliberately no longer uses (#259) — without this + pin they fail on the windows-latest CI runners.""" + monkeypatch.setattr(provision, "_windows", lambda: False) + + def _config(tmp_path: Path, **kw: object) -> SetupConfig: return SetupConfig(vault=tmp_path / "vault", **kw) # type: ignore[arg-type] @@ -654,7 +662,7 @@ def test_secret_output_guard_dry_run_writes_nothing( assert not (tmp_path / ".claude" / "hooks" / "secret-output-guard.sh").exists() -def test_setup_writes_omi_guard_scripts(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None: +def test_setup_writes_omi_guard_scripts(monkeypatch: pytest.MonkeyPatch, tmp_path: Path, posix_form: None) -> None: monkeypatch.setattr(provision.Path, "home", classmethod(lambda cls: tmp_path)) Provisioner(_config(tmp_path), log=_quiet)._write_omi_guard_scripts() hooks = tmp_path / ".claude" / "hooks" @@ -668,7 +676,7 @@ def test_setup_writes_omi_guard_scripts(monkeypatch: pytest.MonkeyPatch, tmp_pat assert "__OMIND_BIN__" not in body -def test_omi_guard_installed_idempotently(tmp_path: Path, isolate_settings: Path) -> None: +def test_omi_guard_installed_idempotently(tmp_path: Path, isolate_settings: Path, posix_form: None) -> None: config = _config(tmp_path) Provisioner(config, log=_quiet).ensure_omi_guard_installed() before = isolate_settings.read_text(encoding="utf-8") @@ -685,7 +693,7 @@ def test_omi_guard_installed_idempotently(tmp_path: Path, isolate_settings: Path assert "mcp__omi__help" in data["permissions"]["allow"] -def test_omi_guard_preserves_user_hooks(tmp_path: Path, isolate_settings: Path) -> None: +def test_omi_guard_preserves_user_hooks(tmp_path: Path, isolate_settings: Path, posix_form: None) -> None: user_pre = {"matcher": "Bash", "hooks": [{"type": "command", "command": "/x/mine.sh"}]} isolate_settings.write_text(json.dumps({"hooks": {"PreToolUse": [user_pre]}})) Provisioner(_config(tmp_path), log=_quiet).ensure_omi_guard_installed() @@ -877,7 +885,7 @@ def test_provision_manifest_roundtrip_and_drift( def test_autoheal_installs_guard_when_drifted( tmp_path: Path, fake_tools: None, monkeypatch: pytest.MonkeyPatch -) -> None: +, posix_form: None) -> None: monkeypatch.setattr(provision.Path, "home", classmethod(lambda cls: tmp_path)) monkeypatch.delenv("OMIND_NO_AUTOHEAL", raising=False) config = _config(tmp_path) @@ -904,7 +912,7 @@ def test_autoheal_respects_opt_out( def test_provision_migrates_legacy_guard( tmp_path: Path, fake_tools: None, isolate_settings: Path, monkeypatch: pytest.MonkeyPatch -) -> None: +, posix_form: None) -> None: monkeypatch.setattr(provision.Path, "home", classmethod(lambda cls: tmp_path)) hooks_dir = tmp_path / ".claude" / "hooks" hooks_dir.mkdir(parents=True) @@ -1183,7 +1191,7 @@ def _guard_entry() -> dict[str, object]: def test_guard_hook_install_is_idempotent_when_our_entry_is_first( tmp_path: Path, monkeypatch: pytest.MonkeyPatch -) -> None: +, posix_form: None) -> None: """Setup must want NO write when the wiring already matches, whatever the order. It rebuilt the list as `kept + [desired]`, appending our entry, so with it first in the file — the shipped layout — the equality check failed @@ -1227,7 +1235,7 @@ def test_guard_hook_install_is_idempotent_when_our_entry_is_first( def test_guard_hook_install_keeps_our_entry_in_place( tmp_path: Path, monkeypatch: pytest.MonkeyPatch -) -> None: +, posix_form: None) -> None: """A stale entry is refreshed where it sits, not moved to the end, and the user's own PreToolUse hooks keep their positions.""" stale = _guard_entry() From 4e77ddf49c5bc47ebe74fca8c7fa0d816aa1bc82 Mon Sep 17 00:00:00 2001 From: "Aaron K. Clark (CryptoJones)" Date: Sat, 15 Aug 2026 14:32:35 -0500 Subject: [PATCH 2/2] style: wrap the three signatures E501 flagged on the posix_form additions Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01QwU16vtyhZwcHf1BevWGSw --- tests/test_provision.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/test_provision.py b/tests/test_provision.py index 69ba27f..9f16a34 100644 --- a/tests/test_provision.py +++ b/tests/test_provision.py @@ -662,7 +662,11 @@ def test_secret_output_guard_dry_run_writes_nothing( assert not (tmp_path / ".claude" / "hooks" / "secret-output-guard.sh").exists() -def test_setup_writes_omi_guard_scripts(monkeypatch: pytest.MonkeyPatch, tmp_path: Path, posix_form: None) -> None: +def test_setup_writes_omi_guard_scripts( + monkeypatch: pytest.MonkeyPatch, + tmp_path: Path, + posix_form: None, +) -> None: monkeypatch.setattr(provision.Path, "home", classmethod(lambda cls: tmp_path)) Provisioner(_config(tmp_path), log=_quiet)._write_omi_guard_scripts() hooks = tmp_path / ".claude" / "hooks" @@ -676,7 +680,9 @@ def test_setup_writes_omi_guard_scripts(monkeypatch: pytest.MonkeyPatch, tmp_pat assert "__OMIND_BIN__" not in body -def test_omi_guard_installed_idempotently(tmp_path: Path, isolate_settings: Path, posix_form: None) -> None: +def test_omi_guard_installed_idempotently( + tmp_path: Path, isolate_settings: Path, posix_form: None +) -> None: config = _config(tmp_path) Provisioner(config, log=_quiet).ensure_omi_guard_installed() before = isolate_settings.read_text(encoding="utf-8") @@ -693,7 +699,9 @@ def test_omi_guard_installed_idempotently(tmp_path: Path, isolate_settings: Path assert "mcp__omi__help" in data["permissions"]["allow"] -def test_omi_guard_preserves_user_hooks(tmp_path: Path, isolate_settings: Path, posix_form: None) -> None: +def test_omi_guard_preserves_user_hooks( + tmp_path: Path, isolate_settings: Path, posix_form: None +) -> None: user_pre = {"matcher": "Bash", "hooks": [{"type": "command", "command": "/x/mine.sh"}]} isolate_settings.write_text(json.dumps({"hooks": {"PreToolUse": [user_pre]}})) Provisioner(_config(tmp_path), log=_quiet).ensure_omi_guard_installed()