test_dossier_and_search_route_to_the_named_sub_index

Tests › tests/test_mcp_routing.py

passed Passed in the packaged run.

What this test is for

Why it exists

END TO END THROUGH THE TOOL METHODS THEMSELVES, not through `resolve_target` alone — `sub_index` was threaded through `db()`, `_route()`, `_answered()` and every `_search_*` handler individually, and a routing-layer test cannot see a spot where one of those forwards stayed `None` on its way to `self.db(...)`. Each sub-index gets its own marker table, so the only way `dossier`/`search` can see the right marker is if `sub_index` reached the file.

Given

  1. reg = st.TargetRegistry(tmp_path / "state")
→

When

  1. _mcp, state = build_server(reg)
  2. repo = tmp_path / "split"
  3. repo.mkdir()
7 more
  1. first = reg.register(repo, name="first-party")
  2. vendor = reg.register(repo, name="llama-cpp")
  3. for target, marker in ((first, "FIRST_PARTY_MARK"), (vendor, "VENDOR_MARK")): Path(target.db_path).parent.mkdir(parents=True, exist_ok=True) conn = sqlite3.connect(target.db_path) conn.execute(f"CREATE TABLE {marker} (x INTEGER)") conn.commit() conn.close() write_build_signature(Path(target.db_path))
  4. def _table_exists(db_path: str, name: str) -> bool: conn = sqlite3.connect(db_path) try: row = conn.execute( "SELECT 1 FROM sqlite_master WHERE type='table' AND name=?", (name,) ).fetchone() finally: conn.close() return row is not None
  5. db_first = state.tools.db(str(repo.resolve()), "first-party")
  6. db_vendor = state.tools.db(str(repo.resolve()), "llama-cpp")
  7. reply = state.tools.search( "nonexistent-symbol", target=str(repo.resolve()), sub_index="llama-cpp" )
→

Then

  1. ✓ _table_exists(str(db_first), "FIRST_PARTY_MARK") holds
  2. ✓ _table_exists(str(db_first), "VENDOR_MARK") is false
  3. ✓ _table_exists(str(db_vendor), "VENDOR_MARK") holds
  4. ✓ _table_exists(str(db_vendor), "FIRST_PARTY_MARK") is false
  5. ✓ reply.get("sub_index") equals "llama-cpp"

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.

clew — `main` (clew/cli.py) · 57 of 400 steps

… 204 earlier steps

command-line usercommand-line usercommand-line usercommand-line userclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyother filesother filesother filesother filesopt (line 352)opttry (line 155)tryloop (line 1576)loopmain205–206. query_main → _locate205_locate +1 more207. target_for → _safe_index_name207_safe_index_name▶ test enters208. target_for → state_home208state_home209–211. query_main → _payload209_payload +2 more212. corpus_payload → _symbol_corpus212_symbol_corpus▶ test enters213. _symbol_corpus → search_counted213search_counted214. search_counted → connect214connect215–216. search_counted → _memberdef_corpora215_memberdef_corpora +1 more217. _expansion_sql → has_columns217has_columns218. has_columns → table_exists218table_exists219. _memberdef_corpora → _memberdef_candidates219_memberdef_candidates220. _memberdef_candidates → table_exists220table_exists221. _memberdef_candidates → documented_first221documented_first222. documented_first → records_provenance222records_provenance

… 7 steps between

command-line usercommand-line usercommand-line usercommand-line usercommand-line usercommand-line userclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyother filesother filesother filesother filesother filesother filesloop (line 1507)loopopt (line 1966)optopt (line 1968)optopt (line 333)optmain230. _memberdef_candidates → _search_rank230_search_rank231. _memberdef_candidates → symbol_provenance231symbol_provenance232. search_counted → _class_candidates232_class_candidates233. _class_candidates → _search_rank233_search_rank234. _class_candidates → class_rows234class_rows235. class_rows → table_exists235table_exists236. class_rows → strip_xml236strip_xml237. search_counted → _config_candidates237_config_candidates238. _config_candidates → _search_rank238_search_rank239. _config_candidates → gate_symbol_rows239gate_symbol_rows240. gate_symbol_rows → table_exists240table_exists241. gate_symbol_rows → has_columns241has_columns242. search_counted → _file_candidates242_file_candidates243. _file_candidates → self_declared_paths243self_declared_paths244–245. _file_candidates → _search_rank244_search_rank +1 more246. _file_candidates → file_doc_rows246file_doc_rows247. file_doc_rows → table_exists247table_exists248. _file_candidates → undocumented_path_rows248undocumented_path_rows249. undocumented_path_rows → table_exists249table_exists250. undocumented_path_rows → has_columns250has_columns251. undocumented_path_rows → table_exists251table_exists252. _symbol_corpus → search_emptiness252search_emptiness253. search_emptiness → index_scope253index_scope254. index_scope → connect254connect255. index_scope → _scope_provenance255_scope_provenance256. _scope_provenance → table_exists256table_exists257. index_scope → _indexed_paths257_indexed_paths258. _indexed_paths → table_exists258table_exists259–260. index_scope → _extensions259_extensions +1 more261–267. search_emptiness → _scope_payload261_scope_payload +6 more268–269. _pruned_row → _absent268_absent +1 more270. search_emptiness → unsearched_corpora270unsearched_corpora271. unsearched_corpora → connect271connect272. unsearched_corpora → table_exists272table_exists273. unsearched_corpora → _unread_kind_counts273_unread_kind_counts274. unsearched_corpora → table_exists274table_exists275. unsearched_corpora → _unread_kind_counts275_unread_kind_counts276. search_emptiness → token_hit_counts276token_hit_counts

… 8 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyother filesother filesother filesother filesopt (line 333)optopt (line 399)optmain285–286. search_emptiness → _scope_sentence285_scope_sentence +1 more287. search_emptiness → _verdict287_verdict288. _verdict → _unread_note288_unread_note289. _verdict → has_file_docs289has_file_docs290. has_file_docs → connect290connect291. has_file_docs → table_exists291table_exists292. search_emptiness → _scope_sentence292_scope_sentence293. _symbol_corpus → with_limit_disclosure293with_limit_disclosure294. corpus_payload → _prose_corpus294_prose_corpus▶ test enters295. _prose_corpus → search_prose_graded295search_prose_graded296. search_prose_graded → _query_tokens296_query_tokens

… 14 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyother filesother filesother filesother filesopt (line 474)optmain311. prose_emptiness → token_hit_counts311token_hit_counts312. prose_emptiness → _render_counts312_render_counts313. corpus_payload → _code_corpus313_code_corpus▶ test enters314–315. _code_corpus → search_code314search_code +1 more

… 10 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyother filesother filesother filesother filesmain326. count_code → _has_table326_has_table327. _code_corpus → with_limit_disclosure327with_limit_disclosure328. corpus_payload → _files_corpus328_files_corpus▶ test enters329. _files_corpus → files_context329files_context330. files_context → directory_rollup330directory_rollup

… 14 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyother filesother filesother filesother filesmain345. list_files → _matches345_matches346. _files_corpus → files_miss346files_miss347. corpus_payload → lock_roster347lock_roster▶ test enters348. lock_roster → connect348connect349. lock_roster → table_exists349table_exists

… 9 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyother filesother filesother filesother filesmain359–360. lock_roster → _object_route359_object_route +1 more361. corpus_payload → one361one▶ test enters362. corpus_payload → one362one363. corpus_payload → thread_roster363thread_roster364. thread_roster → connect364connect365. thread_roster → table_exists365table_exists

… 10 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyother filesother filesother filesother filesmain376–377. thread_roster → _thread_origins376_thread_origins +1 more378. corpus_payload → _config_found_on_the_wire378_config_found_on_the_wire▶ test enters379. _config_found_on_the_wire → _compact_gate_panel379_compact_gate_panel380. corpus_payload → kconfig_space380kconfig_space

… 20 later steps

7 more

tests/test_mcp_routing.py:697 · its file's page

What it checks (5)

  1. assert _table_exists(str(db_first), "FIRST_PARTY_MARK") not attributed
  2. assert not _table_exists(str(db_first), "VENDOR_MARK") not attributed
  3. assert _table_exists(str(db_vendor), "VENDOR_MARK") not attributed
  4. assert not _table_exists(str(db_vendor), "FIRST_PARTY_MARK") not attributed
  5. assert reply.get("sub_index") == "llama-cpp", ( f"reply did not name which sub-index answered: {reply.get('sub_index')!r}" ) not attributed

Where the product reaches it

Call flow

test_dossier_and_search_route_to_the_named_sub_index→build_server→write_build_signature

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_dossier_and_search_route_to_the_named_sub_index · 5 checkswrite_build_signatureREQ-DDB-CONFIG-006 · measuredwrite_build_signatureREQ-DDB-CONFIG-007 · measuredbuild_serverREQ-DDB-MCP-001 · measuredbuild_server_refusal_as_tool_errorREQ-DDB-MCP-004 · measuredwrite_build_signatureREQ-DDB-PIPE-005 · measuredbuild_server_register_promptsREQ-DDB-WIKI-034 · measured
Also reaches 13 requirements

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