test_using_the_index_keeps_the_hook_silent¶
Tests › tests/test_hook.py
What this test is for
Why it exists
THE WHOLE POINT OF THE CREDIT. A model reaching for the index regularly must never hear from this — both to keep one plugin out of the context window, and because a model pushed hard enough reaches for the index where `grep` is genuinely right, which degrades the agent and corrupts any later measurement of whether the index helps.
Verifies REQ-DDB-WIKI-054
Given
env = {**os.environ, "TMPDIR": str(tmp_path), "CLAUDE_CODE_SESSION_ID": "credit-probe"}env["CLAUDE_CODE_SESSION_ID"] = "credit-session"
2 more
def call(used: bool) -> bool: argv = [sys.executable, "-m", "clew_hook"] + ([hook.USED_FLAG] if used else []) out = subprocess.run( argv, input=HOSTILE_EVENT, capture_output=True, text=True, env=env ).stdout return bool(out.strip())spoke = [call(used=(i % 3 == 2)) for i in range(18)]
When
- —
Then
- ✓ any(spoke) is false
tests/test_hook.py:456 · its file's page
What it checks (1)
assert not any(spoke), ( f"the hook spoke to a session that is using the index, at calls " f"{[i for i, s in enumerate(spoke) if s]}" )not attributed
What it reaches
Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.
Requirements it verifies (1)
| requirement | linked by | implementers exercised |
|---|---|---|
| REQ-DDB-WIKI-054 | catalog | unknown |