test_the_production_registrations_pass_a_refresh_hook

Tests › tests/test_mcp_server.py

passed Passed in the packaged run.

What this test is for

Why it exists

THE OTHER HALF OF THE SAME FAIL-OPEN. The wrapper can be perfect and still never be used, because `before` defaults to None — so passing nothing at a call site disables the refresh with no error and no schema change. A structural check on the source is the only thing that pins it: an assertion about behaviour cannot distinguish "registered without a hook" from "registered with a hook that did nothing".

Verifies REQ-DDB-MCP-001 REQ-DDB-MCP-003 REQ-DDB-QUERY-006 REQ-DDB-QUERY-008 REQ-DDB-QUERY-009

Given

  1. source = inspect.getsource(server_module)
  2. calls = [ line.strip() for line in source.splitlines() if "register_query_tools(self.mcp" in line or "register_query_tools(\n" in line ]
  3. for call in calls: assert "self._auto_refresh" in call, ( f"a production registration omits the refresh hook, so queries against that " f"server never refresh a stale index: {call!r}" )
→

When

  1. —
→

Then

  1. ✓ calls holds

tests/test_mcp_server.py:3759 · its file's page

What it checks (2)

  1. assert calls, "no production registration found — did the call sites move?" not attributed
  2. assert "self._auto_refresh" in call, ( f"a production registration omits the refresh hook, so queries against that " f"server never refresh a stale index: {call!r}" ) 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 (5)

requirementlinked byimplementers exercised
REQ-DDB-MCP-001catalogunknown
REQ-DDB-MCP-003catalogunknown
REQ-DDB-QUERY-006catalogunknown
REQ-DDB-QUERY-008catalogunknown
REQ-DDB-QUERY-009catalogunknown