test_status_interprets_an_unresolvable_version_skew

Tests › tests/test_mcp_server.py

passed Passed in the packaged run.

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

  1. repo = tmp_path / "repo"
  2. repo.mkdir()
9 more
  1. _mcp, state = server
  2. target = state.registry.register(str(repo))
  3. state.active = target
  4. state.target_source = st.TARGET_SOURCE_FLAG
  5. db = Path(target.db_path)
  6. conn = sqlite3.connect(db)
  7. conn.execute("CREATE TABLE memberdef (id INTEGER)")
  8. conn.commit()
  9. conn.close()
→

When

  1. write_build_signature(db, version=CLEW_BUILD_VERSION + 6)
  2. payload = await state.status(_FakeCtx())
  3. schema = [n for n in payload["staleness"] if n["axis"] == "schema"]
→

Then

  1. ✓ payload["stale"] is True
  2. ✓ len(schema) equals 1
  3. ✓ schema[0]["message"].lower() contains "restart"
  4. ✓ 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

thread startthread startthread startthread startclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pytry (line 1664)tryopt (line 1666)optopt (line 352)opt_first_build_worker33. _first_build_worker → target_for33target_for34. target_for → _safe_index_name34_safe_index_name35. target_for → state_home35state_home▶ test enters36. _first_build_worker → _run_build36_run_build37. _run_build → nested_tree_cache37nested_tree_cache

… 26 steps between

thread startthread startthread startthread startthread startclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyother filesother filesother filesother filesother filestry (line 3260)try_first_build_worker64. _os_lock → lock_path64lock_path65. _run_build_walked → db_status65db_status66. db_status → _options_meta66_options_meta▶ test enters67. _options_meta → _meta_section67_meta_section68. _meta_section → meta_section68meta_section69. db_status → stated_options69stated_options70. db_status → read_build_signature70read_build_signature71–79. db_status → _source_drift71_source_drift +8 more80. db_status → list80list81–84. db_status → _diagnostics_meta81_diagnostics_meta +3 more85. db_status → code_identity85code_identity86–88. code_identity → source_fingerprint86source_fingerprint +2 more89. db_status → notices89notices90–91. notices → code_identity90code_identity +1 more92–94. _data_notice → _cost_clause92_cost_clause +2 more95–98. notices → _schema_notice95_schema_notice +3 more99. _run_build_walked → declared_scope_rejection99declared_scope_rejection100. declared_scope_rejection → _declared_index_scope100_declared_index_scope

… 42 later steps

5 more

tests/test_mcp_server.py:811 · its file's page

What it checks (4)

  1. assert payload["stale"] is True not attributed
  2. assert len(schema) == 1, "an unresolvable skew must be explained, not merely flagged" not attributed
  3. assert "restart" in schema[0]["message"].lower() not attributed
  4. assert "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

test_status_interprets_an_unresolvable_version_skew→write_build_signature

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.

test_status_interprets_an_unresolvable_version_skew · 4 checkswrite_build_signatureREQ-DDB-CONFIG-006 · measuredwrite_build_signatureREQ-DDB-CONFIG-007 · measuredwrite_build_signatureREQ-DDB-PIPE-005 · measured

Requirements it verifies (4)

requirementlinked byimplementers exercised
REQ-DDB-MCP-003catalogunknown
REQ-DDB-QUERY-006catalogunknown
REQ-DDB-QUERY-008catalogunknown
REQ-DDB-QUERY-009catalogunknown
Also reaches 7 requirements

Its run touches their code; that is reach, not proof.