test_an_unknown_key_inside_index_scope_refuses_by_name¶
Tests › tests/test_scope.py
What this test is for
Why it exists
FOUND WHILE FIXING gh#5 AND IT IS THE WORSE HALF. Section NAMES were validated against KNOWN_SECTIONS; the keys inside a section were not. So `exclude:` for `excludes:` parsed to a valid mapping that no consumer ever read — the reporter's own YAML used the singular, and even with `roots` supplied it would have excluded nothing while reporting success.
Verifies REQ-DDB-PIPE-014
Given
root = tmp_path / "repo"(root / "src").mkdir(parents=True)(root / ".clew.yaml").write_text( "index_scope:\n roots:\n - src\n exclude:\n - src/gen\n", encoding="utf-8" )
When
derived = sc.derive_scope(root)
Then
- ✓ derived.source equals sc.SOURCE_WHOLE_REPO
- ✓ derived.reason contains "exclude"
- ✓ derived.reason contains "excludes"
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) · 28 of 400 steps
… 10 earlier steps
… 18 steps between
… 330 later steps
4 more
- thread `clew-first-build-` — `_first_build_worker` (clew/mcp_server/server.py) · 26 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:459 · its file's page
What it checks (3)
assert derived.source == sc.SOURCE_WHOLE_REPO, ( "a declaration carrying an unread key must NOT be applied as though it were understood — " "silently honouring `roots` while dropping `exclude` is the half-applied scope change " "that reads as success" )observesderive_scopeviaderivedassert "exclude" in derived.reason, "the reason must name the offending key"observesderive_scopeviaderivedassert "excludes" in derived.reason, "and the accepted spelling, so the fix is one edit"observesderive_scopeviaderived
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