test_a_stated_vocabulary_beats_the_repos_declaration¶
Tests › tests/test_diagnostics.py
What this test is for
Why it exists
gh#332's PRECEDENCE, and it needs a real build because the `or` chain that implements it lives one line deep inside `_build_stages`. A mutation control found this untested: swapping the two sides — so the declaration beats the statement — left the entire suite green, which is tier 1 reachable and INERT, the exact shape gh#332 exists to fix reintroduced one line lower.
Given
root = tmp_path / "repo"root.mkdir()
6 more
(root / "unit.c").write_text("/** @brief A unit. */\nvoid unit(void) {}\n", encoding="utf-8")(root / ".clew.yaml").write_text( "event_tags:\n emits: producer\n handles: consumer\n", encoding="utf-8" )doxyfile = root / "Doxyfile"doxyfile.write_text( f"INPUT = {root}\nOUTPUT_DIRECTORY = {root}/out\nRECURSIVE = YES\nGENERATE_SQLITE3 = YES\n", encoding="utf-8", )declared_only = tmp_path / "declared.db"build_index(output=declared_only, repo_root=root, doxyfile=doxyfile)
When
baseline = meta_section(declared_only, dg.META_PREFIX)stated = tmp_path / "stated.db"build_index( output=stated, repo_root=root, doxyfile=doxyfile, options={"event_tags": {"broadcasts": "producer"}}, )section = meta_section(stated, dg.META_PREFIX)
Then
- ✓ baseline["event_vocabulary_size"] equals "2"
- ✓ baseline["event_vocabulary_source"] equals dg.SOURCE_DECLARED
- ✓ section["event_vocabulary_size"] equals "1"
- ✓ section["event_vocabulary_source"] equals dg.SOURCE_DECLARED
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) · 33 of 400 steps
… 10 earlier steps
… 18 steps between
… 4 steps between
… 23 steps between
… 57 steps between
… 27 steps between
… 190 later steps
6 more
- thread `clew-first-build-` — `_first_build_worker` (clew/mcp_server/server.py) · 29 of 142 steps
- Build, refresh and check the index · 19 of 153 steps
- Build this wiki from the index · 10 of 400 steps
- `main` (clew/guard/main.py) · 3 of 357 steps
- clew-mcp — `main` (clew/mcp_server/server.py) · 1 of 17 steps
- `main` (scripts/incremental_probe.py) · 1 of 3 steps
tests/test_diagnostics.py:480 · its file's page
What it checks (4)
assert baseline["event_vocabulary_size"] == "2", "premise: the declaration is read"observesmeta_sectionviabaselineassert baseline["event_vocabulary_source"] == dg.SOURCE_DECLAREDobservesmeta_sectionviabaselineassert section["event_vocabulary_size"] == "1", "a stated vocabulary REPLACES the declared one"observesmeta_sectionviasectionassert section["event_vocabulary_source"] == dg.SOURCE_DECLAREDobservesmeta_sectionviasection
Where the product reaches it
index→_index_action→build_or_refresh→db_status→_meta_section→meta_section(flow)
Call flow
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.
Also reaches 50 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CLI-001 measured
- REQ-DDB-CONFIG-001 measured
- REQ-DDB-CONFIG-004 measured
- REQ-DDB-CONFIG-005 measured
- REQ-DDB-CONFIG-006 measured
- REQ-DDB-CONFIG-007 measured
- REQ-DDB-CONFIG-009 measured
- REQ-DDB-GUARD-012 measured
- REQ-DDB-INDEX-001 measured
- REQ-DDB-INDEX-002 measured
- REQ-DDB-INDEX-003 measured
- REQ-DDB-INDEX-004 measured
- REQ-DDB-INDEX-005 measured
- REQ-DDB-INDEX-006 measured
- REQ-DDB-INDEX-007 measured
- REQ-DDB-INDEX-008 measured
- REQ-DDB-INDEX-009 measured
- REQ-DDB-INDEX-010 measured
- REQ-DDB-INDEX-011 measured
- REQ-DDB-MCP-001 measured
- REQ-DDB-MCP-004 measured
- REQ-DDB-PIPE-001 measured
- REQ-DDB-PIPE-003 measured
- REQ-DDB-PIPE-004 measured
- REQ-DDB-PIPE-005 measured
- REQ-DDB-PIPE-006 measured
- REQ-DDB-PIPE-007 measured
- REQ-DDB-PIPE-008 measured
- REQ-DDB-PIPE-009 measured
- REQ-DDB-PIPE-010 measured
- REQ-DDB-PIPE-011 measured
- REQ-DDB-PIPE-012 measured
- REQ-DDB-PIPE-013 measured
- REQ-DDB-PIPE-014 measured
- REQ-DDB-PIPE-015 measured
- REQ-DDB-QUERY-003 measured
- REQ-DDB-QUERY-011 measured
- REQ-DDB-SCHEMA-001 measured
- REQ-DDB-SCHEMA-002 measured
- REQ-DDB-SCHEMA-003 measured
- REQ-DDB-SCHEMA-004 measured
- REQ-DDB-SCHEMA-005 measured
- REQ-DDB-SCHEMA-006 measured
- REQ-DDB-SCHEMA-007 measured
- REQ-DDB-SCHEMA-009 measured
- REQ-DDB-SCHEMA-011 measured
- REQ-DDB-SCHEMA-012 measured
- REQ-DDB-SCHEMA-013 measured
- REQ-DDB-SCHEMA-014 measured
- REQ-DDB-SCHEMA-015 measured