test_plan_merge_classifies_every_action

Tests › tests/test_init.py

passed Passed in the packaged run.

What this test is for

Why it exists

The action drives the exit path — `unchanged` skips the write entirely and `update` is the only one the conflict rule gates — so a misclassification is either a silent overwrite or a refusal to do anything.

Verifies REQ-DDB-CLI-002

Given

  1. target = tmp_path / REPO_CONFIG_NAME
  2. entry = _expected_entry()
→

When

  1. plan_merge(target, entry)
  2. target.write_text(json.dumps({SERVERS_KEY: {"entropic": {}}}) + "\n", encoding="utf-8")
  3. target.write_text(json.dumps({SERVERS_KEY: {MCP_ENTRY_NAME: entry}}) + "\n", encoding="utf-8")
3 more
  1. other = {**entry, "command": "something-else"}
  2. target.write_text(json.dumps({SERVERS_KEY: {MCP_ENTRY_NAME: other}}) + "\n", encoding="utf-8")
  3. plan = plan_merge(target, entry)
→

Then

  1. ✓ plan_merge(target, entry).action equals INIT_ACTION_CREATE
  2. ✓ plan_merge(target, entry).action equals INIT_ACTION_ADD
  3. ✓ plan_merge(target, entry).action equals INIT_ACTION_UNCHANGED
  4. ✓ plan.action equals INIT_ACTION_UPDATE
  5. ✓ plan.diff contains "something-else"

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:786 · its file's page

What it checks (5)

  1. assert plan_merge(target, entry).action == INIT_ACTION_CREATE observes plan_merge
  2. assert plan_merge(target, entry).action == INIT_ACTION_ADD observes plan_merge
  3. assert plan_merge(target, entry).action == INIT_ACTION_UNCHANGED observes plan_merge
  4. assert plan.action == INIT_ACTION_UPDATE observes plan_merge via plan
  5. assert "something-else" in plan.diff observes plan_merge via plan

Where the product reaches it

  • main → init_main → _register → plan_merge (flow)

Call flow

test_plan_merge_classifies_every_action→_expected_entry→plan_merge

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_plan_merge_classifies_every_action · 5 checksplan_mergeREQ-DDB-MCP-001 · measured

Requirements it verifies (1)

requirementlinked byimplementers exercised
REQ-DDB-CLI-002catalogunknown
Also reaches 1 requirement

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