fix(claude): accept async rewake metadata

This commit is contained in:
ZacharyZhang-NY committed 2026-07-20 09:02:38 -04:00
1 parent 653e644e4f
commit ae04b0cbb4
4 files changed
+44 -3

No files matched your search

+13 -1
View File
@@ -3,6 +3,7 @@ from __future__ import annotations
import os
from pathlib import Path
import subprocess # nosec B404
import sys
import pytest
@@ -19,7 +20,18 @@ CLAUDE_BINARY = os.environ.get("ELYDORA_CLAUDE_BINARY")
def test_official_claude_code_accepts_installed_settings(
monkeypatch: pytest.MonkeyPatch, tmp_path: Path
) -> None:
fixture = prepare_fixture(monkeypatch, tmp_path)
fixture = prepare_fixture(
monkeypatch,
tmp_path,
existing_settings={"hooks": {"Stop": [{"hooks": [{
"type": "command",
"command": sys.executable,
"args": ["--version"],
"asyncRewake": True,
"rewakeMessage": "Background validation failed",
"rewakeSummary": "Validation feedback",
}]}]}},
)
fixture.install()
environment = {
**os.environ,
+20
View File
@@ -75,6 +75,13 @@ def test_install_preserves_settings_and_writes_one_exact_triple(
"timeout": 5,
}],
}],
"Stop": [{"hooks": [{
"type": "command",
"command": "background-check",
"asyncRewake": True,
"rewakeMessage": "Background validation failed",
"rewakeSummary": "Validation feedback",
}]}],
},
}
fixture = prepare_fixture(
@@ -88,6 +95,7 @@ def test_install_preserves_settings_and_writes_one_exact_triple(
assert installed["model"] == "sonnet"
assert installed["hooks"]["Notification"] == existing["hooks"]["Notification"]
assert installed["hooks"]["PreToolUse"][0] == existing["hooks"]["PreToolUse"][0]
assert installed["hooks"]["Stop"] == existing["hooks"]["Stop"]
assert_managed_triple(installed, fixture)
first_source = fixture.config_path.read_text(encoding="utf-8")
@@ -240,6 +248,18 @@ INVALID_SETTINGS = [
}]}]}}),
"positive finite number",
),
(
json.dumps({"hooks": {"Stop": [{"hooks": [{
"type": "command", "command": "x", "rewakeMessage": "",
}]}]}}),
"rewakeMessage.*non-empty string",
),
(
json.dumps({"hooks": {"Stop": [{"hooks": [{
"type": "command", "command": "x", "rewakeSummary": "",
}]}]}}),
"rewakeSummary.*non-empty string",
),
(
json.dumps({"hooks": {"PreToolUse": [{"hooks": [{
"type": "http", "url": "https://example.test", "headers": {"A": 1},