mirror of
https://github.com/safishamsi/graphify.git
synced 2026-10-13 07:29:33 +00:00
Add regression tests for the guard hook timeouts
One per hook, matching the existing matcher tests, checking the
timeout key is present and stays within a small bounded range rather
than pinning the exact value.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017qfdzgbA5KedGEjD1AayNh
(cherry picked from commit 59535b3e01)
This commit is contained in:
1 parent
575f829f46
commit
fc33e2ccbd
2 files changed
+20
No files matched your search
@@ -43,6 +43,16 @@ def test_matcher_targets_read_and_glob():
|
||||
assert _read_matcher()["matcher"] == "Read|Glob"
|
||||
|
||||
|
||||
def test_read_hook_has_a_timeout():
|
||||
# #3314: an unset command hook defaults to Claude Code's 600s timeout, so a
|
||||
# single wedged guard stalls a Read/Glob call -- the highest-frequency
|
||||
# tools an agent uses -- for ten minutes. Guard measures ~170ms warm; a
|
||||
# generous but bounded timeout must be present.
|
||||
entry = _read_matcher()["hooks"][0]
|
||||
assert isinstance(entry.get("timeout"), (int, float))
|
||||
assert 0 < entry["timeout"] <= 30
|
||||
|
||||
|
||||
def test_command_has_no_shell_syntax():
|
||||
# #522: the command must be a plain exe invocation, not POSIX bash.
|
||||
cmd = _read_matcher()["hooks"][0]["command"]
|
||||
|
||||
@@ -53,6 +53,16 @@ def test_matcher_targets_bash_and_grep():
|
||||
assert _search_matcher()["matcher"] == "Bash|Grep"
|
||||
|
||||
|
||||
def test_search_hook_has_a_timeout():
|
||||
# #3314: an unset command hook defaults to Claude Code's 600s timeout, so a
|
||||
# single wedged guard stalls a Bash/Grep call -- the highest-frequency
|
||||
# tools an agent uses -- for ten minutes. Guard measures ~170ms warm; a
|
||||
# generous but bounded timeout must be present.
|
||||
entry = _search_matcher()["hooks"][0]
|
||||
assert isinstance(entry.get("timeout"), (int, float))
|
||||
assert 0 < entry["timeout"] <= 30
|
||||
|
||||
|
||||
def test_hook_command_has_no_backslashes(monkeypatch):
|
||||
# On Windows the resolved exe is a backslash path; Claude Code runs command
|
||||
# hooks through Git Bash by default, which treats an unquoted backslash as an
|
||||
|
||||
Reference in new issue
Block a user