test_an_index_scope_declaration_is_what_yields_roots¶
Tests › tests/test_scope.py
What this test is for
Why it exists
#57: index scope used to be identical to GATE scope, but they answer different questions — the gate says what MUST be documented, the index says what should be reasonable-about. Coupling them forced a repo to loosen its quality bar to widen its graph. Here the gate covers `src/` alone while `vendor/` and `tests/` are the trees a reader wants; the declaration is what lets them differ.
Verifies REQ-DDB-PIPE-014
Given
root = tmp_path / "repo"root.mkdir()_repo_gating_only_src(root)
When
sc.derive_scope(root)(root / ".clew.yaml").write_text( "index_scope:\n roots: [src, vendor, tests]\n", encoding="utf-8" )declared = sc.derive_scope(root)
Then
- ✓ sc.derive_scope(root).roots equals (root.resolve(),)
- ✓ declared.source equals sc.SOURCE_DECLARED
- ✓ sorted(p.name for p in declared.roots) equals ["src", "tests", "vendor"]
- ✓ declared.is_derived() is True
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) · 31 of 400 steps
… 10 earlier steps
… 18 steps between
… 329 later steps
4 more
- thread `clew-first-build-` — `_first_build_worker` (clew/mcp_server/server.py) · 29 of 142 steps
- Build, refresh and check the index · 20 of 153 steps
- Build this wiki from the index · 7 of 400 steps
- `main` (clew/guard/main.py) · 2 of 357 steps
tests/test_scope.py:340 · its file's page
What it checks (4)
assert sc.derive_scope(root).roots == (root.resolve(),), "the gate declares no boundary"observesderive_scopeassert declared.source == sc.SOURCE_DECLAREDobservesderive_scopeviadeclaredassert sorted(p.name for p in declared.roots) == ["src", "tests", "vendor"]observesderive_scopeviadeclaredassert declared.is_derived() is True, "a declared scope is the only tier that narrows"observesderive_scopeviadeclared
Where the product reaches it
main→propose_main→propose→build_context→derive_scope(flow)
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.
Requirements it verifies (1)
| requirement | linked by | implementers exercised |
|---|---|---|
| REQ-DDB-PIPE-014 | catalog | unknown |
Also reaches 3 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CONFIG-001 measured
- REQ-DDB-GUARD-012 inferred
- REQ-DDB-WIKI-054 inferred