test_submodules_and_clones_both_become_sub_indexes

Tests › tests/test_sub_index_split.py

passed Passed in the packaged run.

What this test is for

Why it exists

THE POINTER-FILE HALF IS THE ONE THAT MATTERS. A submodule's `.git` is a FILE, and a fixture built only from directories would pass against a detector blind to exactly the case this feature exists for.

Given

  1. repo = tmp_path / "vendored"
  2. (repo / "app").mkdir(parents=True)
3 more
  1. (repo / "app" / "main.c").write_text("int main(void){return 0;}\n", encoding="utf-8")
  2. clone = _nested(repo / "extern" / "cloned", as_pointer=False)
  3. submodule = _nested(repo / "deps" / "submoduled", as_pointer=True)
→

When

  1. split = derive_sub_indexes(repo)
  2. by_name = {s.name: s for s in split}
  3. first = by_name[FIRST_PARTY_INDEX]
2 more
  1. vendored = [s for s in split if s.name != FIRST_PARTY_INDEX]
  2. all(s.excludes == () for s in vendored)
→

Then

  1. ✓ by_name contains FIRST_PARTY_INDEX
  2. ✓ len(split) equals 3
  3. ✓ set(first.excludes) equals {clone.resolve(), submodule.resolve()}
  4. ✓ first.roots equals (repo.resolve(),)
  5. ✓ {s.roots[0] for s in vendored} equals {clone.resolve(), submodule.resolve()}
  6. ✓ all(s.excludes == () for s in vendored) holds

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) · 37 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)opt_first_build_worker1. _first_build_worker → first_party_sub_index1first_party_sub_index2. first_party_sub_index → whole_repo_scope2whole_repo_scope3. whole_repo_scope → _gitignored_paths3_gitignored_paths4. _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–29. first_party_sub_index → _under_any27_under_any +2 more30–31. _first_party → _own_ignores30_own_ignores +1 more32. first_party_sub_index → _gitignored_paths32_gitignored_paths33. _first_build_worker → target_for33target_for

… 7 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.pyother filesother filesother filesother filesloop (line 205)looploop (line 286)loop_first_build_worker41. _sub_index_rejection → _buildable_sub_indexes41_buildable_sub_indexes42. _buildable_sub_indexes → derive_sub_indexes42derive_sub_indexes43. derive_sub_indexes → whole_repo_scope43whole_repo_scope▶ test enters44–46. derive_sub_indexes → _nested_trees_recursive44_nested_trees_recursive +2 more47. _nested_trees_recursive → list47list48–49. _nested_trees_recursive → _gitignored_paths48_gitignored_paths +1 more50–55. derive_sub_indexes → _direct_parent50_direct_parent +5 more56. _sub_index_rejection → _offered_sub_indexes56_offered_sub_indexes57. _offered_sub_indexes → derive_sub_indexes57derive_sub_indexes

… 85 later steps

4 more

tests/test_sub_index_split.py:70 · its file's page

What it checks (6)

  1. assert FIRST_PARTY_INDEX in by_name, f"no first-party sub-index in {sorted(by_name)}" not attributed
  2. assert len(split) == 3, f"expected first-party plus two trees, got {sorted(by_name)}" observes derive_sub_indexes via split
  3. assert set(first.excludes) == {clone.resolve(), submodule.resolve()}, ( f"first-party does not exclude both nested trees: {first.excludes}" ) observes _nested via clone
  4. assert first.roots == (repo.resolve(),) not attributed
  5. assert {s.roots[0] for s in vendored} == {clone.resolve(), submodule.resolve()} observes _nested via clone
  6. assert all(s.excludes == () for s in vendored) observes all

Where the product reaches it

  • build_wiki → _build_site → _all_flows → entry_point_flows → _scripts → console_scripts → _nested (flow)
  • dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all (flow)
  • index → _index_action → build_or_refresh → _build_subject → _sub_index_rejection → _buildable_sub_indexes → derive_sub_indexes (flow)

Call flow

test_submodules_and_clones_both_become_sub_indexes→_nested→derive_sub_indexes→all

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_submodules_and_clones_both_become_sub_indexes · 6 checksderive_sub_indexeswhole_repo_scopeREQ-DDB-CONFIG-001 · measuredderive_sub_indexesREQ-DDB-INDEX-002 · measuredallREQ-DDB-WIKI-054 · inferred
Also reaches 3 requirements

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