test_a_first_party_target_adds_nested_excludes

Tests › tests/test_named_targets.py

passed Passed in the packaged run.

What this test is for

Why it exists

ADDS, never replaces. The operator's own exclusions and the derived ones answer different questions — "what I do not want indexed" and "what belongs to another index" — and dropping either produces a build that is quietly wrong in a different direction.

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. first = target_for(repo, tmp_path / "state", name=FIRST_PARTY_INDEX)
  2. got_exclude, got_options = _sub_index_scope(first, repo.resolve(), ["build"], None)
→

Then

  1. ✓ got_exclude contains "build"
  2. ✓ got_exclude contains "extern/dep"
  3. ✓ got_options is None

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) · 36 of 142 steps

thread startthread startthread startthread startthread startclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyother filesother filesother filesother filesother filestry (line 1664)trytry (line 1003)tryopt (line 847)optloop (line 746)loopopt (line 1666)optopt (line 352)opt_first_build_worker1. _first_build_worker → first_party_sub_index1first_party_sub_index2–3. first_party_sub_index → whole_repo_scope2whole_repo_scope +1 more4. _gitignored_paths → git_argv4git_argv5–6. git_argv → _no_ext_diff5_no_ext_diff +1 more7. list → link7link8. _gitignored_paths → git_env8git_env9. whole_repo_scope → list9list10–14. whole_repo_scope → nested_repo_roots10nested_repo_roots +4 more15. nested_repo_roots → _nested_repos_under15_nested_repos_under16–26. whole_repo_scope → _gitignored_paths16_gitignored_paths +10 more27–32. first_party_sub_index → _under_any27_under_any +5 more33. _first_build_worker → target_for33target_for34. target_for → _safe_index_name34_safe_index_name▶ test enters35. target_for → state_home35state_home36. _first_build_worker → _run_build36_run_build37. _run_build → nested_tree_cache37nested_tree_cache

… 62 steps between

thread startthread startthread startthread startclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/declaration.pyclew/declaration.pyclew/declaration.pyclew/declaration.pyalt (line 1171)altopt (line 485)opt_first_build_worker100. declared_scope_rejection → _declared_index_scope100_declared_index_scope101. _declared_index_scope → load_declaration_located101load_declaration_located102. load_declaration_located → _read_mapping102_read_mapping103. _read_mapping → _parsed_declaration103_parsed_declaration104. load_declaration_located → _checked_sections104_checked_sections

… 26 steps between

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/declaration.pyclew/declaration.pyclew/declaration.pyclew/declaration.pyother filesother filesother filesother filestry (line 3260)trycatch (line 3328)catch_first_build_worker131. _declared_index_scope → _existing_paths131_existing_paths132. _run_build_walked → _sub_index_scope132_sub_index_scope133. _sub_index_scope → first_party_sub_index133first_party_sub_index▶ test enters134. _sub_index_scope → derive_sub_indexes134derive_sub_indexes135. _sub_index_scope → declared_sub_index_excludes135declared_sub_index_excludes136. declared_sub_index_excludes → load_declaration136load_declaration137. load_declaration → load_declaration_located137load_declaration_located138. _run_build_walked → _bounded_output138_bounded_output139. _bounded_output → all139all

… 3 later steps

6 more

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

What it checks (3)

  1. assert "build" in got_exclude, "the operator's own exclusion was dropped" not attributed
  2. assert "extern/dep" in got_exclude, "the nested tree was not excluded from first-party" not attributed
  3. assert got_options is None not attributed

Where the product reaches it

  • main → query_main → _locate → target_for (flow)

Call flow

test_a_first_party_target_adds_nested_excludes→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_first_party_target_adds_nested_excludes · 3 checks_sub_index_scopedeclared_sub_index_excludesREQ-DDB-CONFIG-001 · measured_sub_index_scope… 6 calls …_validate_nodeREQ-DDB-GUARD-012 · inferred_sub_index_scopederive_sub_indexesREQ-DDB-INDEX-002 · measuredtarget_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.