test_build_or_refresh_without_target_is_an_error

Tests › tests/test_mcp_server.py

passed Passed in the packaged run.

What this test is for

Why it exists

build_or_refresh reports (never raises) when no source supplied a target, and does not register tier-1.

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

Given

  1. mcp, state = server
  2. result = await state.build_or_refresh(_FakeCtx())
  3. for source in ("--repo", "CLAUDE_PROJECT_DIR", "roots/list"): assert source in result["error"], f"the error must name the {source} source"
→

When

  1. —
→

Then

  1. ✓ result["ok"] is False
  2. ✓ result["error"] equals NO_TARGET_ERROR
  3. ✓ result["error"] does not contain "set_target"

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

… 2 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.pyopt (line 3019)opttry (line 2509)tryopt (line 2603)optindex3–4. _index_action → status3status +1 more5. build_or_refresh → _build_subject5_build_subject▶ test enters6–9. _build_subject → ensure_target6ensure_target +3 more10. _roots_askable → roots_request_supported10roots_request_supported11. roots_request_supported → server_request_surface11server_request_surface

… 2 steps between

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/routing.pyclew/mcp_server/routing.pyclew/mcp_server/routing.pyclew/mcp_server/routing.pyloop (line 2353)loopindex14. list → link14link15. _target_from_roots → root_uri_to_path15root_uri_to_path16. ensure_target → adopt16adopt17. adopt → repo_indexes17repo_indexes18. repo_indexes → target_for18target_for

… 135 later steps

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

What it checks (4)

  1. assert result["ok"] is False not attributed
  2. assert result["error"] == NO_TARGET_ERROR not attributed
  3. assert "set_target" not in result["error"] not attributed
  4. assert source in result["error"], f"the error must name the {source} source" 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 (4)

requirementlinked byimplementers exercised
REQ-DDB-MCP-003catalogunknown
REQ-DDB-QUERY-006catalogunknown
REQ-DDB-QUERY-008catalogunknown
REQ-DDB-QUERY-009catalogunknown
Also reaches 5 requirements

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