test_a_vendored_sub_indexs_own_stated_exclude_replays¶
Tests › tests/integration/test_sub_index_build.py
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
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))repo = tmp_path / "repo"
11 more
(repo / "app").mkdir(parents=True)(repo / "app" / "main.c").write_text("int app_entry(void) { return 0; }\n", encoding="utf-8")vendor = repo / "extern" / "dep"vendor.mkdir(parents=True)(vendor / "dep.c").write_text("int dep_helper(void) { return 1; }\n", encoding="utf-8")(vendor / ".git").write_text("gitdir: ../../.git/modules/dep\n", encoding="utf-8")generated = vendor / "build"generated.mkdir()(generated / "gen.c").write_text("int generated_fn(void) { return 9; }\n", encoding="utf-8")(repo / "Doxyfile").write_text("PROJECT_NAME = replay\nINPUT = .\n", encoding="utf-8")reg = TargetRegistry(tmp_path / "state")
When
_mcp, state = build_server(reg)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()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_secondafter_first, after_second = anyio.run(_run)
Then
- ✓ after_first equals {"dep_helper"}
- ✓ 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
… 8 steps between
… 5 steps between
… 8 later steps
7 more
- thread `clew-first-build-` — `_first_build_worker` (clew/mcp_server/server.py) · 97 of 142 steps
- clew — `main` (clew/cli.py) · 38 of 400 steps
- `main` (scripts/stage_probe.py) · 30 of 37 steps
- clew-mcp — `main` (clew/mcp_server/server.py) · 10 of 17 steps
- Build this wiki from the index · 6 of 400 steps
- `main` (clew/guard/main.py) · 3 of 357 steps
- `main` (scripts/incremental_probe.py) · 2 of 3 steps
tests/integration/test_sub_index_build.py:284 · its file's page
What it checks (4)
assert first.get("ok") is True, firstnot attributedassert second.get("ok") is True, secondnot attributedassert after_first == {"dep_helper"}, ( f"the stated exclude must apply on its own (first) build: {after_first}" )not attributedassert 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
main→build_server(flow)
Call flow
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.
Also reaches 54 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CLI-001 measured
- REQ-DDB-CONFIG-001 measured
- REQ-DDB-CONFIG-004 measured
- REQ-DDB-CONFIG-005 measured
- REQ-DDB-CONFIG-006 measured
- REQ-DDB-CONFIG-007 measured
- REQ-DDB-CONFIG-008 measured
- REQ-DDB-CONFIG-009 measured
- REQ-DDB-INDEX-001 measured
- REQ-DDB-INDEX-002 measured
- REQ-DDB-INDEX-003 measured
- REQ-DDB-INDEX-004 measured
- REQ-DDB-INDEX-005 measured
- REQ-DDB-INDEX-006 measured
- REQ-DDB-INDEX-007 measured
- REQ-DDB-INDEX-008 measured
- REQ-DDB-INDEX-009 measured
- REQ-DDB-INDEX-010 measured
- REQ-DDB-INDEX-011 measured
- REQ-DDB-MCP-001 measured
- REQ-DDB-MCP-002 measured
- REQ-DDB-MCP-003 measured
- REQ-DDB-MCP-004 measured
- REQ-DDB-PIPE-001 measured
- REQ-DDB-PIPE-003 measured
- REQ-DDB-PIPE-004 measured
- REQ-DDB-PIPE-005 measured
- REQ-DDB-PIPE-006 measured
- REQ-DDB-PIPE-007 measured
- REQ-DDB-PIPE-008 measured
- REQ-DDB-PIPE-009 measured
- REQ-DDB-PIPE-010 measured
- REQ-DDB-PIPE-011 measured
- REQ-DDB-PIPE-012 measured
- REQ-DDB-PIPE-013 measured
- REQ-DDB-PIPE-014 measured
- REQ-DDB-PIPE-015 measured
- REQ-DDB-QUERY-003 measured
- REQ-DDB-QUERY-011 measured
- REQ-DDB-SCHEMA-001 measured
- REQ-DDB-SCHEMA-002 measured
- REQ-DDB-SCHEMA-003 measured
- REQ-DDB-SCHEMA-004 measured
- REQ-DDB-SCHEMA-005 measured
- REQ-DDB-SCHEMA-006 measured
- REQ-DDB-SCHEMA-007 measured
- REQ-DDB-SCHEMA-009 measured
- REQ-DDB-SCHEMA-011 measured
- REQ-DDB-SCHEMA-012 measured
- REQ-DDB-SCHEMA-013 measured
- REQ-DDB-SCHEMA-014 measured
- REQ-DDB-SCHEMA-015 measured
- REQ-DDB-WIKI-034 measured
- REQ-DDB-WIKI-054 measured