test_names_are_unique_stable_and_path_safe¶
Tests › tests/test_sub_index_split.py
What this test is for
Why it exists
The name becomes a slug component and therefore a directory name, and two trees whose basenames collide — `a/dep` and `b/dep` — must not land on one database. Derived from the repo-relative PATH rather than the basename for that reason.
Given
repo = tmp_path / "collide"(repo / "app").mkdir(parents=True)
2 more
_nested(repo / "a" / "dep", as_pointer=True)_nested(repo / "b" / "dep", as_pointer=False)
When
split = derive_sub_indexes(repo)names = [s.name for s in split]derive_sub_indexes(repo)for name in names: assert "/" not in name and not name.startswith("."), f"unsafe name: {name!r}"
Then
- ✓ len(names) equals len(set(names))
- ✓ names equals [s.name for s in derive_sub_indexes(repo)]
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.
thread `clew-first-build-` — `_first_build_worker` (clew/mcp_server/server.py) · 37 of 142 steps
… 7 steps between
… 85 later steps
4 more
- Build, refresh and check the index · 37 of 153 steps
- clew — `main` (clew/cli.py) · 22 of 400 steps
- Build this wiki from the index · 2 of 400 steps
- `main` (clew/guard/main.py) · 2 of 357 steps
tests/test_sub_index_split.py:107 · its file's page
What it checks (3)
assert len(names) == len(set(names)), f"names collided: {names}"not attributedassert names == [s.name for s in derive_sub_indexes(repo)], "derivation is not stable"observesderive_sub_indexesassert "/" not in name and not name.startswith("."), f"unsafe name: {name!r}"not attributed
Where the product reaches it
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 2 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CONFIG-001 measured
- REQ-DDB-INDEX-002 measured