test_search_total.py

tests/test_search_total.py

A search cut by its limit says how many rows there were (T1; 2.0.0).

test_a_cut_search_reports_the_true_total

None test_search_total.test_a_cut_search_reports_the_true_total(Path rich_db, Path repo_root, corpus, text)

limit=2 against a token with more matches: `_limited.total_available` is the full count.

tests/test_search_total.py:28

Checks

  • assert full["count"] > 2 and "_limited" not in full
  • assert cut["count"] == 2
  • assert cut["_limited"]["total_available"] == full["count"]
  • assert cut["_limited"]["adjusted"] == {"results": f"{full['count']} -> 2"}

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-004measuredtest_a_cut_search_reports_the_true_total → export_search → corpus_payload → _symbol_corpus → search_counted → _memberdef_corpora → _memberdef_candidates → symbol_provenance
REQ-DDB-QUERY-001measuredtest_a_cut_search_reports_the_true_total → export_search → corpus_payload → lock_roster
REQ-DDB-QUERY-002inferredtest_a_cut_search_reports_the_true_total → export_search → corpus_payload → _files_corpus → directory_rollup
REQ-DDB-QUERY-003measuredtest_a_cut_search_reports_the_true_total → export_search → corpus_payload → kconfig_space → table_exists
REQ-DDB-QUERY-004inferredtest_a_cut_search_reports_the_true_total → export_search → corpus_payload → kconfig_space → _gates → _with_defaults → _in_default_build
REQ-DDB-QUERY-006inferredtest_a_cut_search_reports_the_true_total → export_search → corpus_payload → kconfig_space
REQ-DDB-QUERY-007measuredtest_a_cut_search_reports_the_true_total → export_search → corpus_payload → _prose_corpus → prose_emptiness
REQ-DDB-QUERY-011inferredtest_a_cut_search_reports_the_true_total → export_search → corpus_payload → lock_roster
REQ-DDB-QUERY-013inferredtest_a_cut_search_reports_the_true_total → export_search → corpus_payload → kconfig_space → _gates → _with_defaults → decided_default
REQ-DDB-QUERY-014measuredtest_a_cut_search_reports_the_true_total → export_search
REQ-DDB-SCHEMA-011inferredtest_a_cut_search_reports_the_true_total → export_search → corpus_payload → lock_roster → nestings_on
Source · 10 lines
def test_a_cut_search_reports_the_true_total(rich_db: Path, repo_root: Path, corpus, text) -> None:
    """@brief limit=2 against a token with more matches: `_limited.total_available` is the full count."""
    full = export_search(rich_db, text, corpus=corpus, limit=1000, repo_root=repo_root)
    assert full["count"] > 2 and "_limited" not in full
    cut = export_search(rich_db, text, corpus=corpus, limit=2, repo_root=repo_root)
    assert cut["count"] == 2
    assert cut["_limited"]["total_available"] == full["count"]
    assert cut["_limited"]["adjusted"] == {"results": f"{full['count']} -> 2"}

Activity · 6 steps
lines 30–30full = export_search(rich_db, text, corpus=corpus, limit=1000, repo_root=repo_root)lines 31–31assert full["count"] > 2 and "_limited" not in fulllines 32–32cut = export_search(rich_db, text, corpus=corpus, limit=2, repo_root=repo_root)lines 33–33assert cut["count"] == 2lines 34–34assert cut["_limited"]["total_available"] == full["count"]lines 35–35assert cut["_limited"]["adjusted"] == {"results": f"{full['count']} -> 2"}

test_a_search_under_its_limit_has_no_limited_key

None test_search_total.test_a_search_under_its_limit_has_no_limited_key(Path rich_db, Path repo_root)

Absent, not `total_available == count`.

tests/test_search_total.py:46

Checks

  • assert "_limited" not in export_search(rich_db, "return", corpus="symbols", limit=25)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-004measuredtest_a_search_under_its_limit_has_no_limited_key → export_search → corpus_payload → _symbol_corpus → search_counted → _memberdef_corpora → _memberdef_candidates → symbol_provenance
REQ-DDB-QUERY-001measuredtest_a_search_under_its_limit_has_no_limited_key → export_search → corpus_payload → lock_roster
REQ-DDB-QUERY-002inferredtest_a_search_under_its_limit_has_no_limited_key → export_search → corpus_payload → _files_corpus → directory_rollup
REQ-DDB-QUERY-003measuredtest_a_search_under_its_limit_has_no_limited_key → export_search → corpus_payload → kconfig_space → table_exists
REQ-DDB-QUERY-004inferredtest_a_search_under_its_limit_has_no_limited_key → export_search → corpus_payload → kconfig_space → _gates → _with_defaults → _in_default_build
REQ-DDB-QUERY-006inferredtest_a_search_under_its_limit_has_no_limited_key → export_search → corpus_payload → kconfig_space
REQ-DDB-QUERY-007measuredtest_a_search_under_its_limit_has_no_limited_key → export_search → corpus_payload → _prose_corpus → prose_emptiness
REQ-DDB-QUERY-011inferredtest_a_search_under_its_limit_has_no_limited_key → export_search → corpus_payload → lock_roster
REQ-DDB-QUERY-013inferredtest_a_search_under_its_limit_has_no_limited_key → export_search → corpus_payload → kconfig_space → _gates → _with_defaults → decided_default
REQ-DDB-QUERY-014measuredtest_a_search_under_its_limit_has_no_limited_key → export_search
REQ-DDB-SCHEMA-011inferredtest_a_search_under_its_limit_has_no_limited_key → export_search → corpus_payload → lock_roster → nestings_on
Source · 3 lines
def test_a_search_under_its_limit_has_no_limited_key(rich_db: Path, repo_root: Path) -> None:
    """@brief Absent, not `total_available == count`."""
    assert "_limited" not in export_search(rich_db, "return", corpus="symbols", limit=25)

1 more lines, not shown

Activity · 1 steps
lines 48–48assert "_limited" not in export_search(rich_db, "return", corpus="symbols", limit=25)

test_the_mcp_reply_carries_the_same_disclosure

None test_search_total.test_the_mcp_reply_carries_the_same_disclosure(Path rich_db, Path repo_root)

The MCP `search` tool, not only the export, says it was cut.

tests/test_search_total.py:38

Show on the map →

Called by none

Calls none

Checks

  • assert cut["_limited"]["total_available"] == full

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-MCP-003measured
REQ-DDB-QUERY-001measured
REQ-DDB-QUERY-014measured
Source · 8 lines
def test_the_mcp_reply_carries_the_same_disclosure(rich_db: Path, repo_root: Path) -> None:
    """@brief The MCP `search` tool, not only the export, says it was cut."""
    tools = QueryTools(lambda: rich_db, lambda: repo_root)
    full = tools.search("return", corpus="code", limit=1000)["count"]
    cut = tools.search("return", corpus="code", limit=3)
    assert cut["_limited"]["total_available"] == full

Activity · 4 steps
lines 40–40tools = QueryTools(lambda: rich_db, lambda: repo_root)lines 41–41full = tools.search("return", corpus="code", limit=1000)["count"]lines 42–42cut = tools.search("return", corpus="code", limit=3)lines 43–43assert cut["_limited"]["total_available"] == full