test_name_accessors_degrade_gracefully_on_table_less_db¶
Tests › tests/test_query.py
What this test is for
Why it exists
#41: a corrupt/unbuilt db (valid sqlite, no pipeline tables) must make EVERY name-based accessor degrade to "not found" (empty/None), never raise a raw sqlite OperationalError — matching the table_exists convention already pervasive across the query layer. Before the fix callers/callees guarded their table, but dossier/source/search/thread_of/chain_trace/resolve_symbol queried memberdef cold and raised, so the same corrupt db gave inconsistent behaviour across the tier-1 surface.
Given
p = tmp_path / "corrupt.db"conn = sqlite3.connect(p)
3 more
conn.execute("CREATE TABLE junk(x)")conn.commit()conn.close()
When
q.callers(p, "x")q.callees(p, "x")q.search(p, "x")
5 more
q.thread_of(p, "x")q.function_dossier(p, "x")q.source(p, "x", tmp_path)q.resolve_symbol(p, "x")q.chain_trace(p, "x")
Then
- ✓ q.callers(p, "x") equals []
- ✓ q.callees(p, "x") equals []
- ✓ q.search(p, "x") equals []
- ✓ q.thread_of(p, "x") equals []
- ✓ q.function_dossier(p, "x") is None
- ✓ q.source(p, "x", tmp_path) is None
- ✓ q.resolve_symbol(p, "x") is None
- ✓ q.chain_trace(p, "x") is not None
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) · 19 of 400 steps
… 211 earlier steps
… 7 steps between
… 149 later steps
3 more
- `main` (scripts/export_parity.py) · 19 of 203 steps
- Look up one name: everything the index holds about it · 7 of 226 steps
- Build this wiki from the index · 1 of 400 steps
tests/test_query.py:858 · its file's page
What it checks (8)
assert q.callers(p, "x") == []observescallersassert q.callees(p, "x") == []observescalleesassert q.search(p, "x") == []observessearchassert q.thread_of(p, "x") == []observesthread_ofassert q.function_dossier(p, "x") is Noneobservesfunction_dossierassert q.source(p, "x", tmp_path) is Noneobservessourceassert q.resolve_symbol(p, "x") is Noneobservesresolve_symbolassert q.chain_trace(p, "x") is not Noneobserveschain_trace
Where the product reaches it
dossier→_chain_for→chain_trace(flow)
Call flow
test_name_accessors_degrade_gracefully_on_table_less_db→callers→callees→search→thread_of→function_dossier→source→resolve_symbol→chain_traceWhat 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.
and 4 more requirement paths, listed below.
Also reaches 16 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-INDEX-004 inferred
- REQ-DDB-PIPE-003 inferred
- REQ-DDB-PIPE-011 inferred
- REQ-DDB-PIPE-012 inferred
- REQ-DDB-QUERY-001 measured
- REQ-DDB-QUERY-002 measured
- REQ-DDB-QUERY-003 measured
- REQ-DDB-QUERY-004 measured
- REQ-DDB-QUERY-005 inferred
- REQ-DDB-QUERY-006 inferred
- REQ-DDB-QUERY-007 measured
- REQ-DDB-QUERY-009 measured
- REQ-DDB-QUERY-010 measured
- REQ-DDB-QUERY-012 measured
- REQ-DDB-QUERY-013 inferred
- REQ-DDB-SCHEMA-011 inferred