test_reads_outside_the_repository_are_not_counted¶
Tests › tests/test_hook.py
What this test is for
Why it exists
gh#44. THE NOTE COUNTED INSPECTIONS ANYWHERE ON DISK AND CALLED THEM "in this repository". A session auditing markdown under `~/.claude/projects/<id>/memory/` — outside the tree entirely — accumulated pressure from those reads and was told that 45 file-inspection calls in this repository had gone without an index call. Every one of the calls that incremented that counter was outside it, and none had a definition or callers to find.
Verifies REQ-DDB-WIKI-054
Given
repo = tmp_path / "repo"repo.mkdir()
5 more
state = tmp_path / "state"state.mkdir()outside = json.dumps( { "hook_event_name": "PostToolUse", "tool_name": "Read", "tool_input": {"file_path": "/etc/hosts"}, "tool_response": "127.0.0.1 localhost", } )env = {"CLAUDE_CODE_SESSION_ID": "outside-session", "CLAUDE_PROJECT_DIR": str(repo)}spoke = [bool(_run(outside, state, env).stdout.strip()) for _ in range(hook._LOUD_AT + 4)]
When
- —
Then
- ✓ any(spoke) is false
tests/test_hook.py:1348 · its file's page
What it checks (1)
assert not any(spoke), ( f"reads outside the repository must never drive the note; it spoke {sum(spoke)} time(s)" )observes_runviaspoke
Where the product reaches it
main→_run(flow)
Call flow
test_reads_outside_the_repository_are_not_counted→_runWhat 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 |