test_coverage_is_persisted_into_build_meta_and_reaches_status¶
Tests › tests/test_coverage.py
What this test is for
Why it exists
gh#6 part 2. A coverage number that lives only in a build warning has exactly the defect CLAUDE.md records for scope provenance: the pipeline computed it into the build LOG, which is gone by the time anyone queries the database.
Given
db_path, root = _coverage_db(tmp_path, _healthy(MIN_SUBSTANTIVE_FILES + 4))
When
coverage = measure_index_coverage(db_path, root)write_build_signature(db_path, coverage=coverage.as_meta())status = db_status(Target(repo_path=str(root), slug="t", db_path=str(db_path)))reported = status["coverage"]
Then
- ✓ reported["substantive_files"] equals str(MIN_SUBSTANTIVE_FILES + 4)
- ✓ reported["barren_files"] equals "0"
- ✓ reported["barren_ratio"] equals "0.000"
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.
thread `clew-first-build-` — `_first_build_worker` (clew/mcp_server/server.py) · 30 of 142 steps
… 63 earlier steps
… 42 later steps
2 more
- Build, refresh and check the index · 30 of 153 steps
- `main` (scripts/stage_probe.py) · 30 of 37 steps
tests/test_coverage.py:321 · its file's page
What it checks (3)
assert reported["substantive_files"] == str(MIN_SUBSTANTIVE_FILES + 4)not attributedassert reported["barren_files"] == "0", "a measured zero must be recorded, not omitted"not attributedassert reported["barren_ratio"] == "0.000"not attributed
Where the product reaches it
index→_index_action→build_or_refresh→db_status(flow)
Call flow
test_coverage_is_persisted_into_build_meta_and_reaches_status→_coverage_db→_healthy→measure_index_coverage→write_build_signature→db_statusWhat 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 8 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CONFIG-006 measured
- REQ-DDB-CONFIG-007 measured
- REQ-DDB-INDEX-002 measured
- REQ-DDB-INDEX-003 measured
- REQ-DDB-INDEX-004 measured
- REQ-DDB-MCP-001 measured
- REQ-DDB-MCP-004 measured
- REQ-DDB-PIPE-005 measured