test_an_unregistered_sub_index_derives_its_own_target¶
Tests › tests/test_mcp_routing.py
What this test is for
Why it exists
THE FIRST BUILD OF A SUB-INDEX HAS NO REGISTRY ENTRY TO MATCH — `siblings` is empty, so `resolve_target(target, sub_index)` falls all the way through to the unregistered-directory fallback. That fallback derives via `target_for`, and `sub_index` has to reach that call: dropping it there silently derives the WHOLE-repo target — same `repo_path`, but a DIFFERENT slug and `db_path` — for a caller that named a part.
Given
reg = st.TargetRegistry(tmp_path / "state")
When
_mcp, state = build_server(reg)repo = tmp_path / "never_registered"repo.mkdir()
2 more
whole = st.target_for(repo, reg.home)named = state.resolve_target(str(repo.resolve()), "llama-cpp")
Then
- ✓ named.name equals "llama-cpp"
- ✓ named.slug differs from whole.slug
- ✓ named.db_path differs from whole.db_path
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
… 78 later steps
4 more
- clew-mcp — `main` (clew/mcp_server/server.py) · 10 of 17 steps
- thread `clew-first-build-` — `_first_build_worker` (clew/mcp_server/server.py) · 2 of 142 steps
- clew — `main` (clew/cli.py) · 2 of 400 steps
- `main` (scripts/incremental_probe.py) · 2 of 3 steps
tests/test_mcp_routing.py:890 · its file's page
What it checks (3)
assert named.name == "llama-cpp"not attributedassert named.slug != whole.slug, ( "a named sub_index on an unregistered repo must not derive the whole-repo target" )observestarget_forviawholeassert named.db_path != whole.db_pathobservestarget_forviawhole
Where the product reaches it
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.
Also reaches 5 requirements
Its run touches their code; that is reach, not proof.
- 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