test_db_status_freshness_uses_build_signature¶
Tests › tests/test_mcp_server.py
What this test is for
Why it exists
A missing db is stale; a db stamped with the current pipeline version is not; an older stamp is stale again even with a fresh mtime.
Verifies REQ-DDB-MCP-003 REQ-DDB-QUERY-006 REQ-DDB-QUERY-008 REQ-DDB-QUERY-009
Given
reg = st.TargetRegistry(tmp_path / "state")repo = tmp_path / "repo"
2 more
repo.mkdir()target = reg.register(repo)
When
st.db_status(target)Path(target.db_path).write_bytes(rich_db.read_bytes())status = st.db_status(target)write_build_signature(target.db_path, CLEW_BUILD_VERSION - 1)
Then
- ✓ st.db_status(target)["stale"] is True
- ✓ status["exists"] is True
- ✓ status["build_version"] equals CLEW_BUILD_VERSION
- ✓ status["stale"] is False
- ✓ st.db_status(target)["stale"] is True
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:2284 · its file's page
What it checks (5)
assert st.db_status(target)["stale"] is Trueobservesdb_statusassert status["exists"] is Trueobservesdb_statusviastatusassert status["build_version"] == CLEW_BUILD_VERSIONobservesdb_statusviastatusassert status["stale"] is Falseobservesdb_statusviastatusassert st.db_status(target)["stale"] is Trueobservesdb_status
Where the product reaches it
index→_index_action→build_or_refresh→db_status(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.
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