test_status_publishes_the_barren_ratio_and_offenders¶
Tests › tests/test_coverage.py
What this test is for
Why it exists
The consumer-facing half: a thin index must be visible to an agent that never saw the build log, WITH the offenders, so `status` alone is enough to refuse an expensive run against a hollow index.
Given
files = _healthy(6) + [(f"library/guarded_{n}.c", 500, 0) for n in range(25)]db_path, root = _coverage_db(tmp_path, files)
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["barren_ratio"] equals "0.806"
- ✓ reported["largest_barren"] contains "library/guarded_"
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:352 · its file's page
What it checks (2)
assert reported["barren_ratio"] == "0.806"not attributedassert "library/guarded_" in reported["largest_barren"]not attributed
Where the product reaches it
index→_index_action→build_or_refresh→db_status(flow)
Call flow
test_status_publishes_the_barren_ratio_and_offenders→_healthy→_coverage_db→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