test_a_split_build_separates_first_party_from_vendored

Tests › tests/integration/test_sub_index_build.py

passed Passed in the packaged run.

What this test is for

Why it exists

Asserts on SYMBOL MEMBERSHIP rather than counts: each index must hold its own function and not the other's. Counts would be satisfied by two indexes that both covered everything.

Given

  1. repo = _split_repo(tmp_path / "repo")
→

When

  1. with captured_output(): built = build_sub_indexes(repo, home=tmp_path / "state")
  2. by_name = {t.name: t for t in built}
  3. def _functions(db: str) -> set[str]: conn = sqlite3.connect(f"file:{db}?mode=ro", uri=True) try: return {r[0] for r in conn.execute("SELECT name FROM memberdef WHERE kind='function'")} finally: conn.close()
2 more
  1. first = _functions(by_name[FIRST_PARTY_INDEX].db_path)
  2. vendored = _functions(by_name["extern-dep"].db_path)
→

Then

  1. ✓ set(by_name) equals {FIRST_PARTY_INDEX, "extern-dep"}
  2. ✓ first contains "app_entry"
  3. ✓ first does not contain "dep_helper"
  4. ✓ vendored contains "dep_helper"

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) · 49 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 1666)optopt (line 352)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–26. whole_repo_scope → nested_repo_roots10nested_repo_roots +16 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_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

… 3 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

… 3 steps between

thread startthread startthread startthread startclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/mcp_server/state.pyother filesother filesother filesother filestry (line 3260)try_first_build_worker61. _run_build_walked → captured_output61captured_output62. _run_build_walked → build_lock62build_lock63. build_lock → _os_lock63_os_lock▶ test enters64. _os_lock → lock_path64lock_path65. _run_build_walked → db_status65db_status66. db_status → _options_meta66_options_meta

… 31 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/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/declaration.pyclew/declaration.pyclew/declaration.pyclew/declaration.pytry (line 3260)tryalt (line 1171)altopt (line 485)opt_first_build_worker98. notices → _code_notice98_code_notice99. _run_build_walked → declared_scope_rejection99declared_scope_rejection100. declared_scope_rejection → _declared_index_scope100_declared_index_scope▶ test enters101. _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

… 22 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 filesloop (line 648)looptry (line 3260)try_first_build_worker127. _checked_entries → _checked_entry127_checked_entry128. _checked_section → _check_section_keys128_check_section_keys129–131. _declared_index_scope → _existing_paths129_existing_paths +2 more132. _run_build_walked → _sub_index_scope132_sub_index_scope133. _sub_index_scope → first_party_sub_index133first_party_sub_index

… 1 step 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 filescatch (line 3328)catch_first_build_worker135. _sub_index_scope → declared_sub_index_excludes135declared_sub_index_excludes136. declared_sub_index_excludes → load_declaration136load_declaration137. load_declaration → load_declaration_located137load_declaration_located▶ test enters138. _run_build_walked → _bounded_output138_bounded_output139. _bounded_output → all139all

… 3 later steps

6 more

tests/integration/test_sub_index_build.py:75 · its file's page

What it checks (4)

  1. assert set(by_name) == {FIRST_PARTY_INDEX, "extern-dep"}, f"unexpected split: {sorted(by_name)}" not attributed
  2. assert "app_entry" in first, "the first-party index is missing first-party code" not attributed
  3. assert "dep_helper" not in first, ( "the first-party index still contains the vendored tree, so the split saved nothing" ) not attributed
  4. assert "dep_helper" in vendored, "the vendored index is missing the vendored code" not attributed

Where the product reaches it

No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.

Call flow

test_a_split_build_separates_first_party_from_vendored→_split_repo→captured_output→build_sub_indexes

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_split_build_separates_first_party_from_vendored · 4 checksbuild_sub_indexesderive_sub_indexeswhole_repo_scopeREQ-DDB-CONFIG-001 · measuredbuild_sub_indexesderive_sub_indexesREQ-DDB-INDEX-002 · measured
Also reaches 49 requirements

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