test_search_finds_a_gating_symbol_by_name

Tests › tests/test_kconfig.py

passed Passed in the packaged run.

What this test is for

Why it exists

gh#394, THE DISCOVERY HALF. After gh#390 stored the rows, `dossier` answered for a config symbol and `search` still returned NOTHING — so a caller who did not already know the name could not find it, which is the common case for "what turns this on". The graded agent searched for these symbols BY NAME nine times in one run and was refused every time.

Verifies REQ-DDB-CONFIG-005 REQ-DDB-PIPE-014 REQ-DDB-QUERY-006

Given

  1. root, db = _no_kconfig_repo(tmp_path)
→

When

  1. import_kconfig_gates(db, root)
  2. hits = search(db, "PROJ_THREADING_PTHREAD")
→

Then

  1. ✓ hits holds
  2. ✓ hits[0].name equals "PROJ_THREADING_PTHREAD"
  3. ✓ hits[0].kind equals CONFIG_SYMBOL_KIND
  4. ✓ len([h for h in hits if h.kind == CONFIG_SYMBOL_KIND]) equals 1

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

… 70 earlier steps

command-line usercommand-line usercommand-line usercommand-line userother filesother filesother filesother filesloop (line 134)looploop (line 135)loopopt (line 385)optmain71–72. repo_source_files → _scandir71_scandir +1 more73. _ts_language_for → _grammar_available73_grammar_available74–75. _grammar_available → has_language74has_language +1 more76. _ts_language_for → _try_import_ts_module76_try_import_ts_module77–80. build_context → scope_membership77scope_membership +3 more81. _ast_parse_one_file → _ts_language_for81_ts_language_for▶ test enters82–85. _ast_parse_one_file → _cached_parser82_cached_parser +3 more86–87. _ast_parse_one_file → _disambiguate_header86_disambiguate_header +1 more

… 124 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 filesloop (line 1576)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. documented_first → records_provenance222records_provenance

… 7 steps between

command-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/_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.pyother filesother filesother filesother filesother filesloop (line 1507)loopmain230. _memberdef_candidates → _search_rank230_search_rank231. _memberdef_candidates → symbol_provenance231symbol_provenance232. search_counted → _class_candidates232_class_candidates▶ test enters233. _class_candidates → _search_rank233_search_rank234. _class_candidates → class_rows234class_rows235. class_rows → table_exists235table_exists236. class_rows → strip_xml236strip_xml237–238. search_counted → _config_candidates237_config_candidates +1 more239. _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_kconfig.py:643 · its file's page

What it checks (4)

  1. assert hits, "a stored gating symbol must be discoverable" not attributed
  2. assert hits[0].name == "PROJ_THREADING_PTHREAD" not attributed
  3. assert hits[0].kind == CONFIG_SYMBOL_KIND not attributed
  4. assert len([h for h in hits if h.kind == CONFIG_SYMBOL_KIND]) == 1 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_gating_symbol_by_name→_no_kconfig_repo→import_kconfig_gates

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_gating_symbol_by_name · 4 checksimport_kconfig_gatesdeclared_macro_namesbare_macro_namesREQ-DDB-CONFIG-004 · measuredimport_kconfig_gatesrun_harvestREQ-DDB-PIPE-003 · measuredimport_kconfig_gatesREQ-DDB-PIPE-007 · measuredimport_kconfig_gatesrun_harvest_harvest_one_file_parseable_fileREQ-DDB-PIPE-011 · measuredimport_kconfig_gates… 4 calls …has_languageREQ-DDB-PIPE-012 · inferredimport_kconfig_gatesensure_kconfig_gates_tableREQ-DDB-SCHEMA-013 · measured

Requirements it verifies (3)

requirementlinked byimplementers exercised
REQ-DDB-CONFIG-005catalogunknown
REQ-DDB-PIPE-014catalogunknown
REQ-DDB-QUERY-006catalogunknown
Also reaches 11 requirements

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