test_the_registry_holds_sub_indexes_of_one_root¶
Tests › tests/test_named_targets.py
What this test is for
Why it exists
THE FIELD THAT MAKES THE COMPOSITE KEY SAFE is `repo_path` inside the record. `targets()` used to reconstruct a Target's repo_path FROM THE KEY, which is correct while the key is a bare path and wrong the moment it carries a name — the result would be a path that does not exist, handed to `Path()` and stamped into replies as the repository that answered.
Given
repo = tmp_path / "myproj"repo.mkdir()
6 more
reg = TargetRegistry(home=tmp_path / "state")whole = reg.register(repo)first = reg.register(repo, name="first-party")vendor = reg.register(repo, name="llama-cpp")loaded = {t.slug: t for t in reg.targets()}for allocated in (whole, first, vendor): back = loaded[allocated.slug] assert back.repo_path == str(repo.resolve()), ( f"{allocated.slug} reloaded with repo_path {back.repo_path!r} — a composite key " "leaked into a field that is used as a filesystem path" ) assert back.name == allocated.name assert Path(back.db_path).parent.is_dir(), "the db directory was not created"
When
- —
Then
- ✓ len(loaded) equals 3
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) · 2 of 142 steps
… 31 earlier steps
… 105 later steps
4 more
- Build, refresh and check the index · 2 of 153 steps
- clew — `main` (clew/cli.py) · 2 of 400 steps
- clew-mcp — `main` (clew/mcp_server/server.py) · 2 of 17 steps
- `main` (scripts/incremental_probe.py) · 2 of 3 steps
tests/test_named_targets.py:145 · its file's page
What it checks (4)
assert len(loaded) == 3, f"expected three records, got {sorted(loaded)}"not attributedassert back.repo_path == str(repo.resolve()), ( f"{allocated.slug} reloaded with repo_path {back.repo_path!r} — a composite key " "leaked into a field that is used as a filesystem path" )not attributedassert back.name == allocated.namenot attributedassert Path(back.db_path).parent.is_dir(), "the db directory was not created"not attributed
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 1 requirement
Its run touches their code; that is reach, not proof.
- REQ-DDB-MCP-001 measured