test_a_config_symbol_does_not_outrank_a_function_it_gates

Tests › tests/test_kconfig.py

passed Passed in the packaged run.

What this test is for

Why it exists

THE COST OF THE NEW CORPUS, bounded. A gating symbol habitually shares every token with the function it gates, and the function is the row a caller can read a body for. The config tier breaks a TIE only, so a query that spells neither name exactly must still put the function first — otherwise adding the corpus degrades every existing query, which is how the neighbour-cap experiment cost 48% in tokens.

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

Given

  1. root, db = _no_kconfig_repo(tmp_path)
  2. _add_functions(db, ("widget_lock", "widget_telemetry"))
→

When

  1. import_kconfig_gates(db, root)
  2. hits = search(db, "telemetry")
  3. kinds = [h.kind for h in hits]
  4. exact = search(db, "PROJ_OMIT_TELEMETRY")
→

Then

  1. ✓ kinds contains "function"
  2. ✓ kinds contains CONFIG_SYMBOL_KIND
  3. ✓ kinds.index("function") is less than kinds.index(CONFIG_SYMBOL_KIND)
  4. ✓ exact[0].kind equals CONFIG_SYMBOL_KIND

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) · 40 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 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. 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–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:665 · its file's page

What it checks (4)

  1. assert "function" in kinds, "the fixture's functions must still be findable" not attributed
  2. assert CONFIG_SYMBOL_KIND in kinds, "and a gating symbol must be in the same reply" not attributed
  3. assert kinds.index("function") < kinds.index(CONFIG_SYMBOL_KIND) not attributed
  4. assert exact[0].kind == CONFIG_SYMBOL_KIND 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_a_config_symbol_does_not_outrank_a_function_it_gates→_no_kconfig_repo→_add_functions→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_a_config_symbol_does_not_outrank_a_function_it_gates · 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 12 requirements

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