test_a_non_inspecting_call_does_not_consume_a_pressure_slot

Tests › tests/test_hook.py

passed Passed in the packaged run.

What this test is for

Why it exists

THE BEHAVIOURAL FORM of gh#11, which the predicate tests cannot show. `_is_inspection` being right is necessary and not sufficient: the gate has to run BEFORE `_record`, or a `git push` still increments the tally and merely declines to speak about it — and the tally is what the note reports as "N file-inspection calls".

Verifies REQ-DDB-WIKI-054

Given

  1. env = {"CLAUDE_CODE_SESSION_ID": "gh11-pressure"}
  2. def call(command: str) -> bool: ## THE MODALITY FLAG IS THE POINT and must be passed explicitly: `_run` sends no argv, ## so the hook would fall back to the READ wording and never reach the Bash gate at ## all. Caught by this test failing on the `git push` line the first time. event = json.dumps({"tool_input": {"command": command}}) out = subprocess.run( [sys.executable, "-m", "clew_hook", hook.SHELL_FLAG], input=event, capture_output=True, text=True, env={**os.environ, "TMPDIR": str(tmp_path), **env}, ) return bool(out.stdout.strip())
  3. inspect = "grep -n thing clew/cli.py"
→

When

  1. —
→

Then

  1. ✓ [call(inspect) for _ in range(hook._INTERVAL - 1)] equals [False] * (hook._INTERVAL - 1)
  2. ✓ call("git push origin main") is false
  3. ✓ call(inspect) holds

tests/test_hook.py:1199 · its file's page

What it checks (3)

  1. assert [call(inspect) for _ in range(hook._INTERVAL - 1)] == [False] * (hook._INTERVAL - 1) not attributed
  2. assert not call("git push origin main"), "a push must not speak" not attributed
  3. assert call(inspect), ( "the next real inspection should have been the one that speaks; it did not, so the " "interleaved `git push` consumed a pressure slot and the reported count is still a " "count of Bash calls rather than of file inspections" ) 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)

requirementlinked byimplementers exercised
REQ-DDB-WIKI-054catalogunknown