test_live_like_document_round_trips_with_only_servers_changed¶
Tests › tests/test_init.py
What this test is for
Why it exists
Shaped like the real user-scope file, which is the one this tool can do irreversible damage to. Every other top-level key must come back deep-equal AND in its original position — `mcpServers` sits in the middle here on purpose, because a merge that rebuilt the document would move it to the end.
Given
target = tmp_path / "claude-like.json"target.write_text(json.dumps(LIVE_LIKE_DOCUMENT, indent=2) + "\n", encoding="utf-8")entry = _expected_entry()
When
apply_plan(plan_merge(target, entry))after = json.loads(target.read_text(encoding="utf-8"))list(after)
3 more
list(LIVE_LIKE_DOCUMENT)for key, value in LIVE_LIKE_DOCUMENT.items(): if key != SERVERS_KEY: assert after[key] == value, f"unrelated key {key} was altered"list(after[SERVERS_KEY])
Then
- ✓ list(after) equals list(LIVE_LIKE_DOCUMENT)
- ✓ list(after[SERVERS_KEY]) equals ["entropic", "other-tool", MCP_ENTRY_NAME]
- ✓ after[SERVERS_KEY][MCP_ENTRY_NAME] equals entry
- ✓ after[SERVERS_KEY]["entropic"] equals LIVE_LIKE_DOCUMENT[SERVERS_KEY]["entropic"]
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.
clew — `main` (clew/cli.py) · 4 of 400 steps
… 190 earlier steps
… 202 later steps
tests/test_init.py:807 · its file's page
What it checks (5)
assert list(after) == list(LIVE_LIKE_DOCUMENT), "top-level key ORDER must be preserved"observeslistassert after[key] == value, f"unrelated key {key} was altered"not attributedassert list(after[SERVERS_KEY]) == ["entropic", "other-tool", MCP_ENTRY_NAME]observeslistassert after[SERVERS_KEY][MCP_ENTRY_NAME] == entryobserves_expected_entryviaentryassert after[SERVERS_KEY]["entropic"] == LIVE_LIKE_DOCUMENT[SERVERS_KEY]["entropic"]not attributed
Where the product reaches it
Call flow
test_live_like_document_round_trips_with_only_servers_changed→_expected_entry→apply_plan→plan_merge→listWhat 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.
Also reaches 2 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CLI-002 measured
- REQ-DDB-MCP-001 measured