test_a_vendored_sub_indexs_own_stated_exclude_replays

Tests › tests/integration/test_sub_index_build.py

passed Passed in the packaged run.

What this test is for

Why it exists

MECHANISM (a), owner-requested: a caller names an EXTRA exclude for one vendored sub-index — something recursion cannot discover on its own, like a plain (non-git) generated-output directory sitting inside a vendored tree — on that sub-index's first build, and it must still apply on a LATER refresh that passes no `exclude` argument at all. `_operator_excludes` already replays per-TARGET (`output=target.db_path` is specific to this sub-index), so this only works if `_sub_index_scope` leaves the caller's own `exclude` argument alone rather than folding its own auto-derived children-exclude into it — which would collapse an omitted argument into a concrete list and silently defeat the replay on every single call.

Given

  1. sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
  2. repo = tmp_path / "repo"
11 more
  1. (repo / "app").mkdir(parents=True)
  2. (repo / "app" / "main.c").write_text("int app_entry(void) { return 0; }\n", encoding="utf-8")
  3. vendor = repo / "extern" / "dep"
  4. vendor.mkdir(parents=True)
  5. (vendor / "dep.c").write_text("int dep_helper(void) { return 1; }\n", encoding="utf-8")
  6. (vendor / ".git").write_text("gitdir: ../../.git/modules/dep\n", encoding="utf-8")
  7. generated = vendor / "build"
  8. generated.mkdir()
  9. (generated / "gen.c").write_text("int generated_fn(void) { return 9; }\n", encoding="utf-8")
  10. (repo / "Doxyfile").write_text("PROJECT_NAME = replay\nINPUT = .\n", encoding="utf-8")
  11. reg = TargetRegistry(tmp_path / "state")
→

When

  1. _mcp, state = build_server(reg)
  2. def _functions(db_path: str) -> set[str]: conn = sqlite3.connect(f"file:{db_path}?mode=ro", uri=True) try: return {r[0] for r in conn.execute("SELECT name FROM memberdef WHERE kind='function'")} finally: conn.close()
  3. async def _run() -> tuple[set[str], set[str]]: with captured_output(): first = await state.build_or_refresh( _FakeCtx(), target=str(repo), sub_index="extern-dep", exclude=["extern/dep/build"], force=True, ) assert first.get("ok") is True, first target = state.registry.register(repo, "extern-dep") after_first = _functions(target.db_path) ## THE REPLAY: no `exclude` argument at all on this call. with captured_output(): second = await state.build_or_refresh( _FakeCtx(), target=str(repo), sub_index="extern-dep", force=True ) assert second.get("ok") is True, second after_second = _functions(target.db_path) return after_first, after_second
  4. after_first, after_second = anyio.run(_run)
→

Then

  1. ✓ after_first equals {"dep_helper"}
  2. ✓ after_second equals {"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.

Build, refresh and check the index · 101 of 153 steps

… 2 earlier steps

callercallercallercallerclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyopt (line 3019)opttry (line 2509)tryopt (line 2603)optindex3–4. _index_action → status3status +1 more5. build_or_refresh → _build_subject5_build_subject▶ test enters6–7. _build_subject → ensure_target6ensure_target +1 more

… 8 steps between

callercallercallercallercallercallerclew/mcp_server/server.pyclew/mcp_server/server.pyclew/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.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/wiki/themes/clew/static/web.jsclew/wiki/themes/clew/static/web.jsclew/wiki/themes/clew/static/web.jsclew/wiki/themes/clew/static/web.jsclew/wiki/themes/clew/static/web.jsclew/wiki/themes/clew/static/web.jsclew/mcp_server/routing.pyclew/mcp_server/routing.pyclew/mcp_server/routing.pyclew/mcp_server/routing.pyclew/mcp_server/routing.pyclew/mcp_server/routing.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyother filesother filesother filesother filesother filesother filesopt (line 352)optopt (line 169)optloop (line 169)loopopt (line 171)optopt (line 172)optopt (line 2070)optloop (line 662)loopcatch (line 562)catchopt (line 1826)optopt (line 1874)optopt (line 1887)optopt (line 1904)optindex16. ensure_target → adopt16adopt17. adopt → repo_indexes17repo_indexes18. repo_indexes → target_for18target_for19–20. target_for → _safe_index_name19_safe_index_name +1 more21. repo_indexes → target_for21target_for22. adopt → target_for22target_for23. adopt → _sync_tier123_sync_tier124. _sync_tier1 → register_query_tools24register_query_tools▶ test enters25–29. register_query_tools → _add_tool25_add_tool +4 more30. _answering_with_refresh → refused30refused31. _answering_with_refresh → _take_context31_take_context32. _take_context → list32list33. register_query_tools → list33list34. adopt → db_status34db_status35–36. db_status → _options_meta35_options_meta +1 more37. _meta_section → meta_section37meta_section38. db_status → stated_options38stated_options39. db_status → read_build_signature39read_build_signature40–48. db_status → _source_drift40_source_drift +8 more49. db_status → list49list50–53. db_status → _diagnostics_meta50_diagnostics_meta +3 more54. db_status → code_identity54code_identity55–57. code_identity → source_fingerprint55source_fingerprint +2 more58. db_status → notices58notices59–60. notices → code_identity59code_identity +1 more61–63. _data_notice → _cost_clause61_cost_clause +2 more64–67. notices → _schema_notice64_schema_notice +3 more68–69. _build_subject → resolve_target68resolve_target +1 more70. _indexes_for → repo_indexes70repo_indexes71. _indexes_for → repo_indexes71repo_indexes72. resolve_target → list72list73. resolve_target → target_for73target_for74–75. resolve_target → unknown_target_error74unknown_target_error +1 more

… 5 steps between

callercallercallercallercallercallerclew/mcp_server/server.pyclew/mcp_server/server.pyclew/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.pyclew/mcp_server/state.pyclew/mcp_server/state.pyclew/wiki/themes/clew/static/web.jsclew/wiki/themes/clew/static/web.jsclew/wiki/themes/clew/static/web.jsclew/wiki/themes/clew/static/web.jsclew/wiki/themes/clew/static/web.jsclew/wiki/themes/clew/static/web.jsclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyother filesother filesother filesother filesother filesother filestry (line 1003)tryloop (line 205)looploop (line 286)loopopt (line 2549)optopt (line 2553)optopt (line 3032)optindex81. describe_declaration → _parsed_declaration81_parsed_declaration82. resolve_target → 82… 1 call not run83. _build_subject → target_for83target_for84. _build_subject → _sub_index_rejection84_sub_index_rejection85. _sub_index_rejection → first_party_sub_index85first_party_sub_index86. first_party_sub_index → whole_repo_scope86whole_repo_scope87. whole_repo_scope → _gitignored_paths87_gitignored_paths88. _gitignored_paths → git_argv88git_argv89. git_argv → _no_ext_diff89_no_ext_diff90. git_argv → list90list91. _gitignored_paths → git_env91git_env92. whole_repo_scope → list92list93–109. whole_repo_scope → nested_repo_roots93nested_repo_roots +16 more110–112. first_party_sub_index → _under_any110_under_any +2 more113–114. _first_party → _own_ignores113_own_ignores +1 more115. first_party_sub_index → _gitignored_paths115_gitignored_paths116. _sub_index_rejection → _buildable_sub_indexes116_buildable_sub_indexes117. _buildable_sub_indexes → derive_sub_indexes117derive_sub_indexes118–121. derive_sub_indexes → whole_repo_scope118whole_repo_scope +3 more122. _nested_trees_recursive → list122list123–124. _nested_trees_recursive → _gitignored_paths123_gitignored_paths +1 more125–130. derive_sub_indexes → _direct_parent125_direct_parent +5 more131. _sub_index_rejection → _offered_sub_indexes131_offered_sub_indexes132. _offered_sub_indexes → derive_sub_indexes132derive_sub_indexes133. _offered_sub_indexes → list133list134. build_or_refresh → code_identity134code_identity▶ test enters135. build_or_refresh → stale_code_refusal135stale_code_refusal136. stale_code_refusal → code_identity136code_identity137–138. build_or_refresh → _build_lock137_build_lock +1 more139. _build_once → db_status139db_status140. build_or_refresh → adopt140adopt141–142. build_or_refresh → _activate_tier1141_activate_tier1 +1 more143. build_or_refresh → db_status143db_status144–145. _index_action → read_comments144read_comments +1 more

… 8 later steps

7 more

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

What it checks (4)

  1. assert first.get("ok") is True, first not attributed
  2. assert second.get("ok") is True, second not attributed
  3. assert after_first == {"dep_helper"}, ( f"the stated exclude must apply on its own (first) build: {after_first}" ) not attributed
  4. assert after_second == {"dep_helper"}, ( f"the stated exclude must REPLAY on a refresh that names no exclude at all — a " f"generated_fn reappearing here means the omitted argument silently discarded a " f"previously-stated operator decision: {after_second}" ) not attributed

Where the product reaches it

Call flow

test_a_vendored_sub_indexs_own_stated_exclude_replays→build_server→captured_output

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_vendored_sub_indexs_own_stated_exclude_replays · 4 checksbuild_serverREQ-DDB-MCP-001 · measuredbuild_server_refusal_as_tool_errorREQ-DDB-MCP-004 · measuredbuild_server_register_promptsREQ-DDB-WIKI-034 · measured
Also reaches 54 requirements

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