test_prune_at_nested_tree.py¶
tests/test_prune_at_nested_tree.py
gh#36 — the whole-repo scope walk descends a vendored tree it will never prune usefully.
test_a_nested_trees_own_top_level_dot_dirs_are_still_pruned
None test_prune_at_nested_tree.test_a_nested_trees_own_top_level_dot_dirs_are_still_pruned(Path tmp_path)
The nested tree's own `.git` and `.cache` are excluded without descending it.
tests/test_prune_at_nested_tree.py:87
Checks
assert submodule / ".cache" in excludes, "the nested tree's own cache dir must still be pruned"assert clone / ".git" in excludes, ("a nested CLONE's `.git` IS a directory and is the one thing nothing else prunes — " "stopping the walk must not stop excluding it" )
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-001 | measured | test_a_nested_trees_own_top_level_dot_dirs_are_still_pruned → whole_repo_scope |
Source · 21 lines
def test_a_nested_trees_own_top_level_dot_dirs_are_still_pruned(tmp_path: Path) -> None:
"""gh#333's REASON, PRESERVED. The whole-repo tier indexes a nested tree, so its `.git`
object store and its caches must still reach doxygen as excludes — otherwise stopping at
the boundary would hand doxygen the one directory nothing else prunes.
@brief The nested tree's own `.git` and `.cache` are excluded without descending it.
@return None.
@version 1
"""
from clew.scope import whole_repo_scope
repo, submodule, clone, _deep = _repo_with_deep_vendored_dots(tmp_path / "repo")
excludes = {p.resolve() for p in whole_repo_scope(repo).excludes}
assert submodule / ".cache" in excludes, "the nested tree's own cache dir must still be pruned"
assert clone / ".git" in excludes, (
"a nested CLONE's `.git` IS a directory and is the one thing nothing else prunes — "
"stopping the walk must not stop excluding it"
)
Activity · 5 steps
test_first_party_code_beside_the_vendored_tree_is_still_walked
None test_prune_at_nested_tree.test_first_party_code_beside_the_vendored_tree_is_still_walked(Path tmp_path)
A deep first-party dot-dir is still collected.
tests/test_prune_at_nested_tree.py:129
Checks
assert own.resolve() in excludes, "a first-party cache dir must still be pruned"
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-001 | measured | test_first_party_code_beside_the_vendored_tree_is_still_walked → whole_repo_scope |
Source · 17 lines
def test_first_party_code_beside_the_vendored_tree_is_still_walked(tmp_path: Path) -> None:
"""PRUNING ONE BRANCH IS NOT PRUNING THE WALK. First-party dot-directories at any depth
must still be collected — they are the ones this function exists for, and a fix that
stopped early everywhere would silently hand doxygen the parent's own caches.
@brief A deep first-party dot-dir is still collected.
@return None.
@version 1
"""
from clew.scope import whole_repo_scope
repo, _sub, _clone, _deep = _repo_with_deep_vendored_dots(tmp_path / "repo")
own = repo / "app" / "generated" / "__pycache__"
own.mkdir(parents=True)
excludes = {p.resolve() for p in whole_repo_scope(repo).excludes}
assert own.resolve() in excludes, "a first-party cache dir must still be pruned"1 more lines, not shown
Activity · 6 steps
test_the_nested_tree_itself_is_still_in_scope
None test_prune_at_nested_tree.test_the_nested_tree_itself_is_still_in_scope(Path tmp_path)
The vendored tree is not itself excluded.
tests/test_prune_at_nested_tree.py:108
Checks
assert submodule not in excludes, "the whole-repo tier indexes nested trees (gh#333)"assert clone not in excludes, "a nested clone is indexed and tagged, not excluded"assert scope.roots == (repo,)
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-001 | measured | test_the_nested_tree_itself_is_still_in_scope → whole_repo_scope |
Source · 21 lines
def test_the_nested_tree_itself_is_still_in_scope(tmp_path: Path) -> None:
"""THE CONTROL THAT KEEPS gh#333. Pruning the WALK must not exclude the TREE: the whole-repo
tier indexes a vendored dependency and tags its rows, and a `chain_trace` that stopped at the
submodule boundary is the defect gh#333 fixed. Stopping the walk is a statement about cost,
not about what belongs in the index.
@brief The vendored tree is not itself excluded.
@return None.
@version 1
"""
from clew.scope import whole_repo_scope
repo, submodule, clone, _deep = _repo_with_deep_vendored_dots(tmp_path / "repo")
scope = whole_repo_scope(repo)
excludes = {p.resolve() for p in scope.excludes}
assert submodule not in excludes, "the whole-repo tier indexes nested trees (gh#333)"
assert clone not in excludes, "a nested clone is indexed and tagged, not excluded"
assert scope.roots == (repo,)
Activity · 7 steps
test_the_walk_does_not_descend_a_nested_tree
None test_prune_at_nested_tree.test_the_walk_does_not_descend_a_nested_tree(Path tmp_path)
A deep dot-dir inside a nested tree is not collected.
tests/test_prune_at_nested_tree.py:67
Checks
assert deep not in excludes, ("a dot-dir this deep inside a vendored tree means the walk descended it — the whole " "641 MB, on every build" )
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-001 | measured | test_the_walk_does_not_descend_a_nested_tree → whole_repo_scope |
Source · 20 lines
def test_the_walk_does_not_descend_a_nested_tree(tmp_path: Path) -> None:
"""THE COST IS THE DESCENT, so the assertion is about what the walk never reached. A
dot-directory buried inside a vendored tree can only appear in the exclude list if the walk
read the whole tree to find it — which is the 24.6 s.
@brief A deep dot-dir inside a nested tree is not collected.
@return None.
@version 1
"""
from clew.scope import whole_repo_scope
repo, _sub, _clone, deep = _repo_with_deep_vendored_dots(tmp_path / "repo")
excludes = {p.resolve() for p in whole_repo_scope(repo).excludes}
assert deep not in excludes, (
"a dot-dir this deep inside a vendored tree means the walk descended it — the whole "
"641 MB, on every build"
)