test_an_unbuilt_directory_target_refuses_instead_of_answering¶
Tests › tests/test_mcp_server.py
What this test is for
Why it exists
THE SECOND HALF, and the one a naive fix breaks. An unregistered string that IS a directory must NOT raise `unknown target` — deriving a target for it is how a third-party repo gets indexed in the first place — but it must not silently answer from the DERIVED DEFAULT either. It has to refuse with the exact call that fixes it.
Verifies REQ-DDB-QUERY-006 REQ-DDB-QUERY-008 REQ-DDB-QUERY-009
Given
registry = st.TargetRegistry(tmp_path / "state")
When
_mcp, srv = build_server(registry)unbuilt = tmp_path / "never_indexed"unbuilt.mkdir()
2 more
srv.answering(str(unbuilt))message = str(caught.value)
Then
- ✓ srv.resolve_target(str(unbuilt)).repo_path equals str(unbuilt)
- ✓ raises RuntimeError
- ✓ message contains "index(action='refresh'"
- ✓ message contains str(unbuilt)
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 · 16 of 153 steps
… 15 earlier steps
… 31 steps between
… 71 later steps
4 more
- clew-mcp — `main` (clew/mcp_server/server.py) · 9 of 17 steps
- thread `clew-first-build-` — `_first_build_worker` (clew/mcp_server/server.py) · 1 of 142 steps
- clew — `main` (clew/cli.py) · 1 of 400 steps
- `main` (scripts/incremental_probe.py) · 1 of 3 steps
tests/test_mcp_server.py:3248 · its file's page
What it checks (3)
assert srv.resolve_target(str(unbuilt)).repo_path == str(unbuilt)not attributedassert "index(action='refresh'" in message, "the refusal must carry the call that fixes it"not attributedassert str(unbuilt) in messagenot attributed
Where the product reaches it
main→build_server(flow)
Call flow
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 (3)
| requirement | linked by | implementers exercised |
|---|---|---|
| REQ-DDB-QUERY-006 | catalog | unknown |
| REQ-DDB-QUERY-008 | catalog | unknown |
| REQ-DDB-QUERY-009 | catalog | unknown |
Also reaches 6 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CONFIG-001 measured
- REQ-DDB-MCP-001 measured
- REQ-DDB-MCP-003 measured
- REQ-DDB-MCP-004 measured
- REQ-DDB-WIKI-034 measured
- REQ-DDB-WIKI-054 measured