test_a_widened_prose_search_says_so_in_the_envelope

Tests › tests/test_mcp_server.py

passed Passed in the packaged run.

What this test is for

Why it exists

THE DISCLOSURE IS THE HALF THAT KEEPS THE FIX HONEST. Relaxing FTS5's implicit AND to an OR removes a false negative — measured on mbedtls, five natural phrasings of a question the corpus could answer all returned nothing, and the agent grepped instead. Returning those rows WITHOUT saying the query was relaxed just swaps that for a false positive: "matched some of your terms" is a weaker claim than "matched all of them", and a reader who cannot tell them apart is no better off.

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

Given

  1. widened = tools.search("chime zzqqxwv", corpus="prose")
  2. exact = tools.search("chime", corpus="prose")
→

When

  1. —
→

Then

  1. ✓ widened["count"] is greater than 0
  2. ✓ widened["matched"] equals "some terms"
  3. ✓ widened["note"] contains "RELAXED"
  4. ✓ widened["note"] contains "zzqqxwv"
  5. ✓ exact["count"] is greater than 0
  6. ✓ exact does not contain "matched"

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

… 209 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 118)optmain210–211. _payload → export_search210export_search +1 more212. corpus_payload → _symbol_corpus212_symbol_corpus▶ test enters213. _symbol_corpus → search_counted213search_counted214. search_counted → connect214connect

… 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.pyloop (line 1576)loopmain216. _memberdef_corpora → _expansion_sql216_expansion_sql217. _expansion_sql → has_columns217has_columns218. has_columns → table_exists218table_exists219. _memberdef_corpora → _memberdef_candidates219_memberdef_candidates220. _memberdef_candidates → table_exists220table_exists

… 45 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 filesopt (line 150)optmain266–267. _prune_rows → _prune_rows266_prune_rows +1 more268. _pruned_row → _absent268_absent▶ test enters269. _pruned_row → _prune_rows269_prune_rows270. search_emptiness → unsearched_corpora270unsearched_corpora271. unsearched_corpora → connect271connect

… 20 steps between

command-line usercommand-line usercommand-line usercommand-line usercommand-line userclew/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)optmain292. 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–300. search_prose_graded → _fts_match299_fts_match +1 more301. 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 → connect309connect

… 1 step 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

2 more

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

What it checks (6)

  1. assert widened["count"] > 0, "the OR must recover the 'chime' hits" not attributed
  2. assert widened["matched"] == "some terms" not attributed
  3. assert "RELAXED" in widened["note"] not attributed
  4. assert "zzqqxwv" in widened["note"] not attributed
  5. assert exact["count"] > 0 not attributed
  6. assert "matched" not in exact 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 (4)

requirementlinked byimplementers exercised
REQ-DDB-MCP-001catalogunknown
REQ-DDB-QUERY-006catalogunknown
REQ-DDB-QUERY-008catalogunknown
REQ-DDB-QUERY-009catalogunknown
Also reaches 5 requirements

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