test_prose_search_reaches_documentation_attached_to_a_member

Tests › tests/test_query.py

passed Passed in the packaged run.

What this test is for

Why it exists

gh#404 — THE TEXT WAS ALWAYS STORED AND NEVER SEARCHED. The prose corpus read markdown and file-level doc comments; a doc comment on a MEMBER went nowhere. Measured on mbedtls: `search_prose("MBEDTLS_ALLOW_PRIVATE_ACCESS")` returned zero while `memberdef.detaileddescription` held the paragraph that answers the question — and the graded cell was told the miss was definitive and ran three greps to find what the index was holding.

Verifies REQ-DDB-QUERY-002

Given

  1. db = _member_doc_db(tmp_path)
→

When

  1. found = q.search_prose_graded(db, "private members", limit=5)
  2. hit = found.hits[0]
→

Then

  1. ✓ found.hits holds
  2. ✓ hit.file_path equals "library/common.h"
  3. ✓ hit.heading contains "member documentation"
  4. ✓ hit.snippet does not contain "<para>"
  5. ✓ hit.snippet contains "their members are private"

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

… 215 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.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

… 73 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)optmain294. corpus_payload → _prose_corpus294_prose_corpus295. _prose_corpus → search_prose_graded295search_prose_graded296. search_prose_graded → _query_tokens296_query_tokens▶ test enters297. 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_corpus

… 92 later steps

2 more

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

What it checks (5)

  1. assert found.hits, "the member's documentation is the only prose here and must be found" observes search_prose_graded via found
  2. assert hit.file_path == "library/common.h" not attributed
  3. assert "member documentation" in hit.heading, "the heading must say where the prose came from" not attributed
  4. assert "<para>" not in hit.snippet, f"doxygen's XML must be stripped: {hit.snippet!r}" not attributed
  5. assert "their members are private" in hit.snippet not attributed

Where the product reaches it

  • main → query_main → _payload → export_search → corpus_payload → _prose_corpus → search_prose_graded (flow)

Call flow

test_prose_search_reaches_documentation_attached_to_a_member→_member_doc_db→search_prose_graded

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_prose_search_reaches_documentation_attached_to_a_member · 5 checkssearch_prose_gradedREQ-DDB-QUERY-001 · measuredsearch_prose_gradedtable_existsREQ-DDB-QUERY-003 · measuredsearch_prose_gradedmember_doc_rowsREQ-DDB-QUERY-007 · measured

Requirements it verifies (1)

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

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