test_search_finds_a_class_by_name

Tests › tests/test_query.py

passed Passed in the packaged run.

What this test is for

Why it exists

gh#315, the headline defect. `search` read `memberdef WHERE kind='function'` and the file-doc corpus, and NOTHING ELSE — classes live in `compounddef`, a table it never touched. So a class name returned a confident empty result, which is indistinguishable from a measured negative and is the worst failure mode this project has. Reproduced live on this repo's own index: `search("WritePlan")` returned only the mcp_config.py FILE DOC while the class sits at line 132.

Verifies REQ-DDB-QUERY-002

Given

  1. —
→

When

  1. hits = q.search(_class_db(tmp_path), "PolygonWidget")
  2. by_name = {h.name: h for h in hits}
→

Then

  1. ✓ by_name contains "demo::shape::PolygonWidget"
  2. ✓ by_name["demo::shape::PolygonWidget"].kind equals "class"
  3. ✓ by_name["demo::shape::PolygonWidget"].file equals "src/demo/shape/PolygonWidget.hpp"
  4. ✓ by_name["demo::shape::PolygonWidget"].brief equals "Recomputes the cached outline."

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) · 35 of 400 steps

… 211 earlier steps

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 1576)looploop (line 1494)loopopt (line 1497)optloop (line 1507)loopmain212. corpus_payload → _symbol_corpus212_symbol_corpus213. _symbol_corpus → search_counted213search_counted214. search_counted → connect214connect▶ test enters215–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–223. documented_first → records_provenance222records_provenance +1 more224. _memberdef_candidates → symbol_provenance224symbol_provenance225. symbol_provenance → records_provenance225records_provenance226. _memberdef_candidates → self_declared_paths226self_declared_paths227–228. _memberdef_candidates → _one_line227_one_line +1 more229. _memberdef_candidates → strip_xml229strip_xml230. _memberdef_candidates → _search_rank230_search_rank231. _memberdef_candidates → symbol_provenance231symbol_provenance232–233. search_counted → _class_candidates232_class_candidates +1 more234. _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_scope

… 147 later steps

2 more

tests/test_query.py:1389 · its file's page

What it checks (4)

  1. assert "demo::shape::PolygonWidget" in by_name not attributed
  2. assert by_name["demo::shape::PolygonWidget"].kind == "class" not attributed
  3. assert by_name["demo::shape::PolygonWidget"].file == "src/demo/shape/PolygonWidget.hpp" not attributed
  4. assert by_name["demo::shape::PolygonWidget"].brief == "Recomputes the cached outline." not attributed

Where the product reaches it

No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.

Call flow

test_search_finds_a_class_by_name→search→_class_db

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_search_finds_a_class_by_name · 4 checkssearch… 3 calls …symbol_provenanceREQ-DDB-INDEX-004 · measuredsearchREQ-DDB-QUERY-001 · measuredsearch… 3 calls …table_existsREQ-DDB-QUERY-003 · measuredsearchsearch_counted_class_candidatesclass_rowsREQ-DDB-QUERY-007 · measuredsearchREQ-DDB-QUERY-012 · measured

Requirements it verifies (1)

requirementlinked byimplementers exercised
REQ-DDB-QUERY-002catalogunknown
Also reaches 5 requirements

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