test_a_declared_root_indexes_a_nested_repository¶
Tests › tests/test_index_scope_inheritance.py
What this test is for
Why it exists
THE REVERSAL gh#333 MAKES, at the declared tier. This used to assert the opposite — that a nested clone under a declared root is excluded and warned about — on the argument that two codebases in one `search` result cannot be told apart. The premise was right and the remedy was backwards: entropic wraps llama.cpp, and a `chain_trace` that stops at the boundary answers "this call leaves the repo" when it could answer what the call does. They are told apart by being TAGGED (gh#335), which `external_roots` is the detection half of.
Given
root = _repo_with_exempt_fixture(tmp_path / "repo")nested = root / "evidence" / "other_project"
5 more
repo_with_submodules(root, "evidence/other_project")(nested / "src").mkdir(parents=True)(nested / "src" / "theirs.c").write_text("int theirs(void) { return 1; }\n", encoding="utf-8")(root / "evidence" / "notes.md").write_text("# ours\n", encoding="utf-8")(root / ".clew.yaml").write_text( "index_scope:\n roots: ['src', 'evidence']\n", encoding="utf-8" )
When
derived = sc.derive_scope(root)excluded = {p.resolve() for p in derived.excludes}external_roots(root)
Then
- ✓ excluded does not contain nested.resolve()
- ✓ {p.resolve() for p in derived.roots} contains (root / "evidence").resolve()
- ✓ external_roots(root) contains "evidence/other_project"
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.
clew — `main` (clew/cli.py) · 17 of 400 steps
… 10 earlier steps
… 18 steps between
… 8 steps between
… 329 later steps
4 more
- thread `clew-first-build-` — `_first_build_worker` (clew/mcp_server/server.py) · 15 of 142 steps
- Build this wiki from the index · 7 of 400 steps
- Build, refresh and check the index · 6 of 153 steps
- `main` (clew/guard/main.py) · 2 of 357 steps
tests/test_index_scope_inheritance.py:139 · its file's page
What it checks (3)
assert nested.resolve() not in excluded, ( "gh#333: a nested repository is indexed and tagged, never cut out of the scope" )not attributedassert (root / "evidence").resolve() in {p.resolve() for p in derived.roots}observesderive_scopeviaderivedassert "evidence/other_project" in external_roots(root)observesexternal_roots
Where the product reaches it
main→propose_main→propose→build_context→derive_scope(flow)
Call flow
test_a_declared_root_indexes_a_nested_repository→_repo_with_exempt_fixture→repo_with_submodules→derive_scope→external_rootsWhat 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 4 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CONFIG-001 measured
- REQ-DDB-GUARD-012 inferred
- REQ-DDB-INDEX-005 measured
- REQ-DDB-WIKI-054 inferred