test_cull_drops_stale_and_keeps_current¶
Tests › tests/test_mcp_server.py
What this test is for
Why it exists
The sweep removes version-stale and never-built targets while leaving a current database registered.
Verifies REQ-DDB-MCP-003 REQ-DDB-QUERY-006 REQ-DDB-QUERY-008 REQ-DDB-QUERY-009
Given
reg = st.TargetRegistry(tmp_path / "state")good, stale, missing = (tmp_path / n for n in ("good", "stale", "missing"))
6 more
for d in (good, stale, missing): d.mkdir()t_good = reg.register(good)t_stale = reg.register(stale)reg.register(missing)Path(t_good.db_path).write_bytes(rich_db.read_bytes())Path(t_stale.db_path).write_bytes(rich_db.read_bytes())
When
write_build_signature(t_stale.db_path, CLEW_BUILD_VERSION - 1)culled = st.cull(reg, max_age_days=None)
Then
- ✓ {c["repo_path"] for c in culled} equals {t_stale.repo_path, str(missing)}
- ✓ [t.repo_path for t in reg.targets()] equals [t_good.repo_path]
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) · 31 of 142 steps
… 32 earlier steps
… 26 steps between
… 42 later steps
5 more
- Build, refresh and check the index · 31 of 153 steps
- `main` (scripts/stage_probe.py) · 30 of 37 steps
- clew — `main` (clew/cli.py) · 1 of 400 steps
- clew-mcp — `main` (clew/mcp_server/server.py) · 1 of 17 steps
- `main` (scripts/incremental_probe.py) · 1 of 3 steps
tests/test_mcp_server.py:2357 · its file's page
What it checks (2)
assert {c["repo_path"] for c in culled} == {t_stale.repo_path, str(missing)}observescullviaculledassert [t.repo_path for t in reg.targets()] == [t_good.repo_path]not attributed
Where the product reaches it
No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.
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.
Requirements it verifies (4)
| requirement | linked by | implementers exercised |
|---|---|---|
| REQ-DDB-MCP-003 | catalog | unknown |
| REQ-DDB-QUERY-006 | catalog | unknown |
| REQ-DDB-QUERY-008 | catalog | unknown |
| REQ-DDB-QUERY-009 | catalog | unknown |
Also reaches 6 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CONFIG-006 measured
- REQ-DDB-CONFIG-007 measured
- REQ-DDB-INDEX-003 measured
- REQ-DDB-MCP-001 measured
- REQ-DDB-MCP-004 measured
- REQ-DDB-PIPE-005 measured