test_a_whole_repo_target_keeps_the_callers_scope

Tests › tests/test_named_targets.py

passed Passed in the packaged run.

What this test is for

Why it exists

THE #511 GUARD. A repository that COULD be split must keep building whole until someone builds its named targets. Narrowing it here would shrink an index nobody asked to shrink and report success — a smaller index that reads as healthy, which is the silent-narrowing failure that task records.

Given

  1. repo = tmp_path / "vendored"
  2. (repo / "app").mkdir(parents=True)
3 more
  1. nested = repo / "extern" / "dep"
  2. nested.mkdir(parents=True)
  3. (nested / ".git").write_text("gitdir: ../../.git/modules/dep\n", encoding="utf-8")
→

When

  1. whole = target_for(repo, tmp_path / "state")
  2. _sub_index_scope(whole, repo.resolve(), None, None)
  3. _sub_index_scope(whole, repo.resolve(), ["build"], {"kconfig": {}})
→

Then

  1. ✓ _sub_index_scope(whole, repo.resolve(), None, None) equals (None, None)
  2. ✓ _sub_index_scope(whole, repo.resolve(), ["build"], {"kconfig": {}}) equals ( ["build"], {"kconfig": {}}, )

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

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

… 105 later steps

4 more

tests/test_named_targets.py:203 · its file's page

What it checks (2)

  1. assert _sub_index_scope(whole, repo.resolve(), None, None) == (None, None) observes _sub_index_scope
  2. assert _sub_index_scope(whole, repo.resolve(), ["build"], {"kconfig": {}}) == ( ["build"], {"kconfig": {}}, ) observes _sub_index_scope

Where the product reaches it

  • main → query_main → _locate → target_for (flow)

Call flow

test_a_whole_repo_target_keeps_the_callers_scope→target_for→_sub_index_scope

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_a_whole_repo_target_keeps_the_callers_scope · 2 checks_sub_index_scopedeclared_sub_index_excludesREQ-DDB-CONFIG-001 · inferred_sub_index_scope… 6 calls …_validate_nodeREQ-DDB-GUARD-012 · inferred_sub_index_scopederive_sub_indexesREQ-DDB-INDEX-002 · inferredtarget_forREQ-DDB-MCP-001 · measured_sub_index_scope… 6 calls …allREQ-DDB-WIKI-054 · inferred
Also reaches 5 requirements

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