test_adopt_defaults_to_first_party_on_a_split_repo¶
Tests › tests/test_mcp_routing.py
What this test is for
Why it exists
THE FULLY-OMITTED-TARGET PATH, distinct from and upstream of `resolve_target`. Every tool call that names no `target` at all goes through `ensure_target` -> `adopt`, which NEVER consulted the registry before this fix — it always derived the unnamed whole-repo Target via `target_for`, bypassing `_preferred_default` entirely. On a genuinely split repository (first-party + vendored registered, no whole-repo record — the shape `derive_sub_indexes` actually produces) every omitted-target call would have resolved to a database that was never built, contradicting the server's own served promise that omitting the argument still gets an answer.
Given
reg = st.TargetRegistry(tmp_path / "state")
When
_mcp, state = build_server(reg)repo = tmp_path / "adopt_split"repo.mkdir()
3 more
first_party = reg.register(repo, name="first-party")reg.register(repo, name="llama-cpp")active = state.adopt(str(repo), st.TARGET_SOURCE_FLAG)
Then
- ✓ active.slug equals first_party.slug
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 · 39 of 153 steps
… 14 earlier steps
… 84 later steps
5 more
- thread `clew-first-build-` — `_first_build_worker` (clew/mcp_server/server.py) · 25 of 142 steps
- `main` (scripts/stage_probe.py) · 23 of 37 steps
- clew-mcp — `main` (clew/mcp_server/server.py) · 10 of 17 steps
- clew — `main` (clew/cli.py) · 2 of 400 steps
- `main` (scripts/incremental_probe.py) · 2 of 3 steps
tests/test_mcp_routing.py:978 · its file's page
What it checks (1)
assert active.slug == first_party.slug, ( f"adopt() on a split repo must activate first-party, got {active.slug!r}" )not 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.
Also reaches 7 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CONFIG-006 measured
- REQ-DDB-CONFIG-007 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