test_a_declared_root_indexes_a_nested_repository

Tests › tests/test_index_scope_inheritance.py

passed Passed in the packaged run.

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

  1. root = _repo_with_exempt_fixture(tmp_path / "repo")
  2. nested = root / "evidence" / "other_project"
5 more
  1. repo_with_submodules(root, "evidence/other_project")
  2. (nested / "src").mkdir(parents=True)
  3. (nested / "src" / "theirs.c").write_text("int theirs(void) { return 1; }\n", encoding="utf-8")
  4. (root / "evidence" / "notes.md").write_text("# ours\n", encoding="utf-8")
  5. (root / ".clew.yaml").write_text( "index_scope:\n roots: ['src', 'evidence']\n", encoding="utf-8" )
→

When

  1. derived = sc.derive_scope(root)
  2. excluded = {p.resolve() for p in derived.excludes}
  3. external_roots(root)
→

Then

  1. ✓ excluded does not contain nested.resolve()
  2. ✓ {p.resolve() for p in derived.roots} contains (root / "evidence").resolve()
  3. ✓ 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

command-line usercommand-line usercommand-line usercommand-line userclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyother filesother filesother filesother filesalt (line 1171)altopt (line 529)optmain11. propose → build_context11build_context12. build_context → derive_scope12derive_scope13. derive_scope → _declared_index_scope13_declared_index_scope▶ test enters14. _declared_index_scope → load_declaration_located14load_declaration_located15–18. load_declaration_located → _read_mapping15_read_mapping +3 more19–20. _checked_section → _checked_list_section19_checked_list_section +1 more

… 18 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyother filesother filesother filesother filesloop (line 598)loopopt (line 696)opttry (line 1003)tryopt (line 845)optloop (line 1239)loopopt (line 847)optloop (line 746)loopmain39–40. _checked_document → _checked_entries39_checked_entries +1 more41. _checked_section → _check_section_keys41_check_section_keys42–44. _declared_index_scope → _existing_paths42_existing_paths +2 more45–46. derive_scope → whole_repo_scope45whole_repo_scope +1 more47. _gitignored_paths → git_argv47git_argv48. git_argv → _no_ext_diff48_no_ext_diff▶ test enters49. git_argv → list49list50. _gitignored_paths → git_env50git_env51. whole_repo_scope → list51list52. whole_repo_scope → nested_repo_roots52nested_repo_roots53. nested_repo_roots → _nested_repos_under53_nested_repos_under▶ test enters54–56. _nested_repos_under → _warn_unwalkable54_warn_unwalkable +2 more57. nested_repo_roots → _nested_repos_under57_nested_repos_under58. whole_repo_scope → _gitignored_paths58_gitignored_paths

… 8 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyother filesother filesother filesother filesmain67–68. whole_repo_scope → _vendored_clause67_vendored_clause +1 more69. derive_scope → whole_repo_scope69whole_repo_scope▶ test enters70–71. build_context → repo_source_files70repo_source_files +1 more

… 329 later steps

4 more

tests/test_index_scope_inheritance.py:139 · its file's page

What it checks (3)

  1. assert nested.resolve() not in excluded, ( "gh#333: a nested repository is indexed and tagged, never cut out of the scope" ) not attributed
  2. assert (root / "evidence").resolve() in {p.resolve() for p in derived.roots} observes derive_scope via derived
  3. assert "evidence/other_project" in external_roots(root) observes external_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_roots

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_declared_root_indexes_a_nested_repository · 3 checksderive_scopeREQ-DDB-CONFIG-001 · measuredderive_scope… 5 calls …_validate_nodeREQ-DDB-GUARD-012 · inferredexternal_rootsREQ-DDB-INDEX-005 · measuredderive_scope… 5 calls …allREQ-DDB-WIKI-054 · inferred
Also reaches 4 requirements

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