test_status_interprets_an_unresolvable_version_skew¶
Tests › tests/test_mcp_server.py
What this test is for
Why it exists
gh#29's cheapest half, end to end through the real `status` tool. An index stamped NEWER than the server expects makes `stale: true` unclearable by any action the consumer can take — a rebuild re-stamps the same newer version — and it shipped for months as two mismatched integers with nothing interpreting them. Observed live at 23 against a server expecting 17.
Verifies REQ-DDB-MCP-003 REQ-DDB-QUERY-006 REQ-DDB-QUERY-008 REQ-DDB-QUERY-009
Given
repo = tmp_path / "repo"repo.mkdir()
9 more
_mcp, state = servertarget = state.registry.register(str(repo))state.active = targetstate.target_source = st.TARGET_SOURCE_FLAGdb = Path(target.db_path)conn = sqlite3.connect(db)conn.execute("CREATE TABLE memberdef (id INTEGER)")conn.commit()conn.close()
When
write_build_signature(db, version=CLEW_BUILD_VERSION + 6)payload = await state.status(_FakeCtx())schema = [n for n in payload["staleness"] if n["axis"] == "schema"]
Then
- ✓ payload["stale"] is True
- ✓ len(schema) equals 1
- ✓ schema[0]["message"].lower() contains "restart"
- ✓ schema[0]["message"] contains "CANNOT CLEAR"
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:811 · its file's page
What it checks (4)
assert payload["stale"] is Truenot attributedassert len(schema) == 1, "an unresolvable skew must be explained, not merely flagged"not attributedassert "restart" in schema[0]["message"].lower()not attributedassert "CANNOT CLEAR" in schema[0]["message"]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 7 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-002 measured
- REQ-DDB-MCP-004 measured
- REQ-DDB-PIPE-005 measured