test_live_like_document_round_trips_with_only_servers_changed

Tests › tests/test_init.py

passed Passed in the packaged run.

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

  1. target = tmp_path / "claude-like.json"
  2. target.write_text(json.dumps(LIVE_LIKE_DOCUMENT, indent=2) + "\n", encoding="utf-8")
  3. entry = _expected_entry()
→

When

  1. apply_plan(plan_merge(target, entry))
  2. after = json.loads(target.read_text(encoding="utf-8"))
  3. list(after)
3 more
  1. list(LIVE_LIKE_DOCUMENT)
  2. for key, value in LIVE_LIKE_DOCUMENT.items(): if key != SERVERS_KEY: assert after[key] == value, f"unrelated key {key} was altered"
  3. list(after[SERVERS_KEY])
→

Then

  1. ✓ list(after) equals list(LIVE_LIKE_DOCUMENT)
  2. ✓ list(after[SERVERS_KEY]) equals ["entropic", "other-tool", MCP_ENTRY_NAME]
  3. ✓ after[SERVERS_KEY][MCP_ENTRY_NAME] equals entry
  4. ✓ 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

command-line usercommand-line usercommand-line usercommand-line userclew/init_command.pyclew/init_command.pyclew/init_command.pyclew/init_command.pyother filesother filesother filesother filestry (line 683)trymain191. config_path → global_config_path191global_config_path192. _register → plan_merge192plan_merge193. plan_merge → load_document193load_document▶ test enters194–196. plan_merge → _classify194_classify +2 more197–198. _register → _execute197_execute +1 more

… 202 later steps

tests/test_init.py:807 · its file's page

What it checks (5)

  1. assert list(after) == list(LIVE_LIKE_DOCUMENT), "top-level key ORDER must be preserved" observes list
  2. assert after[key] == value, f"unrelated key {key} was altered" not attributed
  3. assert list(after[SERVERS_KEY]) == ["entropic", "other-tool", MCP_ENTRY_NAME] observes list
  4. assert after[SERVERS_KEY][MCP_ENTRY_NAME] == entry observes _expected_entry via entry
  5. assert after[SERVERS_KEY]["entropic"] == LIVE_LIKE_DOCUMENT[SERVERS_KEY]["entropic"] not attributed

Where the product reaches it

  • main → propose_main → _emit → apply_plan (flow)
  • dossier → subject_payload → _flatten_subject → list (flow)
  • main → init_main → _register → plan_merge (flow)

Call flow

test_live_like_document_round_trips_with_only_servers_changed→_expected_entry→apply_plan→plan_merge→list

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_live_like_document_round_trips_with_only_servers_changed · 5 checksapply_planREQ-DDB-CLI-002 · measuredplan_mergeREQ-DDB-MCP-001 · measured
Also reaches 2 requirements

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