test_the_gate_layer_reports_its_own_state_independently_of_kconfig¶
Tests › tests/test_kconfig.py
What this test is for
Why it exists
gh#404 — `found` ANSWERS A DIFFERENT QUESTION THAN THE ONE CALLERS ASK. It is true when a Kconfig was discovered and parsed, which is all it ever claimed. But a caller reads `found: false` as "this repository has no configuration space", and mbedtls — which has no Kconfig — measured 12,096 gating sites over 1,107 distinct symbols. Kconfig is a Zephyr/Linux convention; a header of `#define`s is the dominant C one, and reporting the dominant case as absence is the misreport `KconfigSpace` exists to prevent, one level up.
Verifies REQ-DDB-CONFIG-005 REQ-DDB-PIPE-014
Given
gated, _db = _no_kconfig_repo(tmp_path / "gated")
When
import_kconfig_gates(_db, gated)space = kconfig_space(_db, None)empty_db = tmp_path / "empty.db"
12 more
conn = sqlite3.connect(str(empty_db))conn.execute("CREATE TABLE path (name TEXT, type INT)")ensure_kconfig_gates_table(conn)conn.commit()conn.close()empty_space = kconfig_space(empty_db, None)bare_db = tmp_path / "bare.db"conn = sqlite3.connect(str(bare_db))conn.execute("CREATE TABLE path (name TEXT, type INT)")conn.commit()conn.close()bare_space = kconfig_space(bare_db, None)
Then
- ✓ import_kconfig_gates(_db, gated) is greater than 0
- ✓ space.found is False
- ✓ space.gate_state equals LAYER_STATE_POPULATED
- ✓ space.gate_symbols is greater than 0
- ✓ space.found or space.gate_state == LAYER_STATE_POPULATED holds
- ✓ empty_space.gate_state equals LAYER_STATE_EMPTY
- ✓ empty_space.gate_symbols equals 0
- ✓ bare_space.gate_state equals LAYER_STATE_ABSENT
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) · 23 of 400 steps
… 70 earlier steps
… 128 steps between
… 158 steps between
… 1 later step
2 more
- `main` (scripts/export_parity.py) · 17 of 203 steps
- Look up one name: everything the index holds about it · 4 of 226 steps
tests/test_kconfig.py:952 · its file's page
What it checks (8)
assert import_kconfig_gates(_db, gated) > 0observesimport_kconfig_gatesassert space.found is False, "this fixture has no Kconfig — `found` must stay honest about that"observeskconfig_spaceviaspaceassert space.gate_state == LAYER_STATE_POPULATEDobserveskconfig_spaceviaspaceassert space.gate_symbols > 0, "the harvest saw gating symbols and must say how many"observeskconfig_spaceviaspaceassert space.found or space.gate_state == LAYER_STATE_POPULATEDobserveskconfig_spaceviaspaceassert empty_space.gate_state == LAYER_STATE_EMPTY, ( "a table that exists and holds nothing is a MEASUREMENT, not an absent detector" )observeskconfig_spaceviaempty_spaceassert empty_space.gate_symbols == 0observeskconfig_spaceviaempty_spaceassert bare_space.gate_state == LAYER_STATE_ABSENT, ( "an absent layer must NOT read as an empty one — that is the substitution this whole " "class was written to prevent" )observeskconfig_spaceviabare_space
Where the product reaches it
main→query_main→_payload→export_search→corpus_payload→kconfig_space(flow)
Call flow
test_the_gate_layer_reports_its_own_state_independently_of_kconfig→_no_kconfig_repo→import_kconfig_gates→kconfig_space→ensure_kconfig_gates_tableWhat 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)
| requirement | linked by | implementers exercised |
|---|---|---|
| REQ-DDB-CONFIG-005 | catalog | unknown |
| REQ-DDB-PIPE-014 | catalog | unknown |
Also reaches 12 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CONFIG-004 measured
- REQ-DDB-PIPE-003 measured
- REQ-DDB-PIPE-007 measured
- REQ-DDB-PIPE-011 measured
- REQ-DDB-PIPE-012 inferred
- REQ-DDB-QUERY-001 measured
- REQ-DDB-QUERY-003 measured
- REQ-DDB-QUERY-004 inferred
- REQ-DDB-QUERY-006 measured
- REQ-DDB-QUERY-013 inferred
- REQ-DDB-SCHEMA-012 measured
- REQ-DDB-SCHEMA-013 measured