test_registering_after_an_unreadable_registry_does_not_destroy_it¶
Tests › tests/test_mcp_server.py
What this test is for
Why it exists
THE LOSS SCENARIO END TO END, which neither of the two tests above covers on its own: read fails, `register` proceeds, and the single surviving entry becomes the whole registry. This asserts the new entry lands AND the previous content is still on disk to recover from.
Verifies REQ-DDB-MCP-003 REQ-DDB-QUERY-006 REQ-DDB-QUERY-008 REQ-DDB-QUERY-009
Given
home = tmp_path / "state"home.mkdir()
7 more
damaged = '{"/previously/registered": {"slug": "prev-000000", "db_path": "/prev/db"}'(home / st.REGISTRY_NAME).write_text(damaged)reg = st.TargetRegistry(home)repo = tmp_path / "newly_registered"repo.mkdir()target = reg.register(repo)survivors = [ p.read_text(encoding="utf-8") for p in home.iterdir() if p.is_file() and p.name != st.REGISTRY_NAME ]
When
- —
Then
- ✓ [t.repo_path for t in reg.targets()] equals [target.repo_path]
- ✓ any("/previously/registered" in text for text in survivors) holds
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) · 1 of 142 steps
… 32 earlier steps
… 105 later steps
4 more
- Build, refresh and check the index · 1 of 153 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:2251 · its file's page
What it checks (2)
assert [t.repo_path for t in reg.targets()] == [target.repo_path], ( "the new registration must still succeed" )not attributedassert any("/previously/registered" in text for text in survivors), ( "registering over an unreadable registry destroyed the only record of what it held" )not attributed
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 1 requirement
Its run touches their code; that is reach, not proof.
- REQ-DDB-MCP-001 measured