test_empty_results_are_explicit_not_bare

Tests › tests/test_mcp_server.py

passed Passed in the packaged run.

What this test is for

Why it exists

A bare empty list is indistinguishable from a broken tool. An earlier benchmark of a different query layer was invalidated exactly this way: agents read empty responses as failures, abandoned the index, and guessed names instead. So an empty result must SAY it is empty and say it is not an error.

Verifies REQ-DDB-MCP-001 REQ-DDB-QUERY-008

Given

  1. empty = tools.search("no_such_token_anywhere_xyz", corpus="prose")
  2. note = empty["note"].lower()
2 more
  1. populated = tools.search("telemetry")
  2. doss = tools.dossier("main")
→

When

  1. —
→

Then

  1. ✓ empty["count"] equals 0
  2. ✓ empty["results"] equals []
  3. ✓ empty contains "note"
  4. ✓ note contains "not an error"
  5. ✓ empty["note"] contains "no_such_token_anywhere_xyz"
  6. ✓ populated["count"] is greater than 0
  7. ✓ populated does not contain "note"
  8. ✓ doss["callers"] equals []

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) · 86 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

… 122 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 filesopt (line 118)optloop (line 1576)looploop (line 1494)loopopt (line 1497)optloop (line 1507)loopmain210–211. _payload → export_search210export_search +1 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–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. 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 → connect254connect

… 6 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 filesmain261–262. search_emptiness → _scope_payload261_scope_payload +1 more263–269. one → _listed263_listed +6 more270. search_emptiness → unsearched_corpora270unsearched_corpora271. unsearched_corpora → connect271connect

… 3 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.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyclew/query/corpus.pyother filesother filesother filesother filesopt (line 1968)optopt (line 333)optloop (line 1856)loopopt (line 1902)optmain275. unsearched_corpora → _unread_kind_counts275_unread_kind_counts276. search_emptiness → token_hit_counts276token_hit_counts277. token_hit_counts → connect277connect278. token_hit_counts → _one_token_count278_one_token_count279. _one_token_count → table_exists279table_exists280. _one_token_count → _expansion_sql280_expansion_sql281. _one_token_count → class_rows281class_rows282. _one_token_count → file_doc_rows282file_doc_rows283–284. search_emptiness → _conjunction_note283_conjunction_note +1 more

… 6 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 filesopt (line 1012)optopt (line 1014)optopt (line 474)optmain291. 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_tokens297. search_prose_graded → connect297connect298. search_prose_graded → table_exists298table_exists299. search_prose_graded → _fts_match299_fts_match300. search_prose_graded → _fts_match300_fts_match301. search_prose_graded → strip_xml301strip_xml302. search_prose_graded → list302list303. search_prose_graded → member_doc_rows303member_doc_rows304. member_doc_rows → table_exists304table_exists305. member_doc_rows → has_columns305has_columns306. search_prose_graded → _collapse306_collapse307. _prose_corpus → prose_emptiness307prose_emptiness308. prose_emptiness → has_prose_corpus308has_prose_corpus309. has_prose_corpus → connect309connect310. has_prose_corpus → table_exists310table_exists311. prose_emptiness → token_hit_counts311token_hit_counts312. prose_emptiness → _render_counts312_render_counts313. corpus_payload → _code_corpus313_code_corpus314–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

… 3 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyother filesother filesother filesother filesmain353–354. lock_roster → nestings_on353nestings_on +1 more355. _layer_present → table_exists355table_exists▶ test enters356. nestings_on → table_exists356table_exists357. lock_roster → _nesting_pairs357_nesting_pairs

… 1 step 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 ×2 (line 944)loop ×2main359–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_exists366. thread_roster → has_columns366has_columns367. thread_roster → _thread_columns367_thread_columns368. _thread_columns → has_columns368has_columns▶ test enters369–370. _thread_columns → has_columns369has_columns ×2

… 5 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

… 11 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyother filesother filesother filesother filesloop (line 660)loopmain392. _gates → table_exists392table_exists393. _gates → _gate_columns393_gate_columns394. _gate_columns → has_columns394has_columns▶ test enters395. _gate_columns → has_columns395has_columns396. _gates → _with_defaults396_with_defaults397. _with_defaults → table_exists397table_exists▶ test enters398. _with_defaults → _defaults_for_macros398_defaults_for_macros399. _with_defaults → decided_default399decided_default

… 1 later step

3 more

tests/test_mcp_server.py:1517 · its file's page

What it checks (8)

  1. assert empty["count"] == 0 not attributed
  2. assert empty["results"] == [] not attributed
  3. assert "note" in empty, "an empty result must explain itself" not attributed
  4. assert "not an error" in note not attributed
  5. assert "no_such_token_anywhere_xyz" in empty["note"], "the note must name what was searched for" not attributed
  6. assert populated["count"] > 0 not attributed
  7. assert "note" not in populated, "a populated result needs no disclaimer" not attributed
  8. assert doss["callers"] == [], "an always-present envelope key must survive at empty" not attributed

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.

Requirements it verifies (2)

requirementlinked byimplementers exercised
REQ-DDB-MCP-001catalogunknown
REQ-DDB-QUERY-008catalogunknown
Also reaches 15 requirements

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