test_register_and_unregister_query_tools

Tests › tests/test_mcp_server.py

passed Passed in the packaged run.

What this test is for

Why it exists

The register helper adds exactly the tier-1 set; the unregister helper removes exactly it, leaving tier-0 intact.

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

Given

  1. mcp, state = server
→

When

  1. registered = register_query_tools(mcp, state.tools)
  2. names = await _names(mcp)
  3. removed = unregister_query_tools(mcp)
  4. names = await _names(mcp)
→

Then

  1. ✓ set(registered) equals set(TIER1_TOOLS)
  2. ✓ set(TIER1_TOOLS) is at most names
  3. ✓ TIER0 is at most names
  4. ✓ set(removed) equals set(TIER1_TOOLS)
  5. ✓ names & set(TIER1_TOOLS) equals set()
  6. ✓ TIER0 is at most names

What it exercises

The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.

Build, refresh and check the index · 6 of 153 steps

… 22 earlier steps

callercallercallercallerclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/wiki/themes/clew/static/web.jsclew/wiki/themes/clew/static/web.jsclew/wiki/themes/clew/static/web.jsclew/wiki/themes/clew/static/web.jsclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyloop (line 662)looploop (line 693)loopcatch (line 562)catchindex23–24. adopt → _sync_tier123_sync_tier1 +1 more25. register_query_tools → _add_tool25_add_tool▶ test enters26–28. _add_tool → _strip_titles26_strip_titles +2 more29. register_query_tools → _answering_with_refresh29_answering_with_refresh30. _answering_with_refresh → refused30refused31. _answering_with_refresh → _take_context31_take_context32. _take_context → list32list33. register_query_tools → list33list34. adopt → db_status34db_status35. db_status → _options_meta35_options_meta

… 118 later steps

1 more

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

What it checks (6)

  1. assert set(registered) == set(TIER1_TOOLS) observes register_query_tools via registered
  2. assert set(TIER1_TOOLS) <= names not attributed
  3. assert TIER0 <= names not attributed
  4. assert set(removed) == set(TIER1_TOOLS) observes unregister_query_tools via removed
  5. assert names & set(TIER1_TOOLS) == set() not attributed
  6. assert TIER0 <= names not attributed

Where the product reaches it

  • index → _index_action → build_or_refresh → _activate_tier1 → register_query_tools (flow)

Call flow

test_register_and_unregister_query_tools→unregister_query_tools→register_query_tools

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.

test_register_and_unregister_query_tools · 6 checksregister_query_toolsREQ-DDB-MCP-003 · measuredregister_query_toolsREQ-DDB-MCP-004 · measuredregister_query_tools_answering_with_refresh_take_contextREQ-DDB-WIKI-054 · inferred

Requirements it verifies (4)

requirementlinked byimplementers exercised
REQ-DDB-MCP-001catalogunknown
REQ-DDB-QUERY-006catalogunknown
REQ-DDB-QUERY-008catalogunknown
REQ-DDB-QUERY-009catalogunknown
Also reaches 3 requirements

Its run touches their code; that is reach, not proof.