test_declared_scope_rejection_reports_without_falling_back

Tests › tests/test_scope.py

passed Passed in the packaged run.

What this test is for

Why it exists

THE SEPARATE, BUILD-TIME CHECK a caller who can still refuse uses — `derive_scope` itself keeps absorbing a rejected declaration into the whole-repo tier for every other caller (the test right above this one asserts exactly that, unchanged). This one is for the NEW build-time guard, `_apply_scope`, to consult before committing to a scope.

Verifies REQ-DDB-PIPE-014

Given

  1. root = tmp_path / "repo"
  2. (root / "src").mkdir(parents=True)
  3. (root / ".clew.yaml").write_text("index_scope:\n excludes:\n - src\n", encoding="utf-8")
→

When

  1. rejection = sc.declared_scope_rejection(root)
  2. plain = tmp_path / "plain"
  3. (plain / "src").mkdir(parents=True)
5 more
  1. sc.declared_scope_rejection(plain)
  2. usable = tmp_path / "usable"
  3. (usable / "src").mkdir(parents=True)
  4. (usable / ".clew.yaml").write_text("index_scope:\n roots: [src]\n", encoding="utf-8")
  5. sc.declared_scope_rejection(usable)
→

Then

  1. ✓ rejection is not None
  2. ✓ rejection contains "roots"
  3. ✓ rejection contains "REPLACES"
  4. ✓ sc.declared_scope_rejection(plain) is None
  5. ✓ sc.declared_scope_rejection(usable) is None

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) · 10 of 142 steps

… 97 earlier steps

thread startthread startthread startthread startclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/mcp_server/freshness.pyclew/declaration.pyclew/declaration.pyclew/declaration.pyclew/declaration.pyother filesother filesother filesother filestry (line 3260)tryalt (line 1171)altopt (line 529)opt_first_build_worker98. notices → _code_notice98_code_notice99. _run_build_walked → declared_scope_rejection99declared_scope_rejection100. declared_scope_rejection → _declared_index_scope100_declared_index_scope▶ test enters101. _declared_index_scope → load_declaration_located101load_declaration_located102–105. load_declaration_located → _read_mapping102_read_mapping +3 more106. _checked_section → _checked_list_section106_checked_list_section107. _checked_list_section → all107all

… 18 steps between

thread startthread startthread startthread startclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/mcp_server/server.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/declaration.pyclew/declaration.pyclew/declaration.pyclew/declaration.pyother filesother filesother filesother filesloop (line 598)looptry (line 3260)try_first_build_worker126–127. _checked_document → _checked_entries126_checked_entries +1 more128. _checked_section → _check_section_keys128_check_section_keys129–131. _declared_index_scope → _existing_paths129_existing_paths +2 more132. _run_build_walked → _sub_index_scope132_sub_index_scope133. _sub_index_scope → first_party_sub_index133first_party_sub_index

… 9 later steps

2 more

tests/test_scope.py:520 · its file's page

What it checks (4)

  1. assert rejection is not None observes declared_scope_rejection via rejection
  2. assert "roots" in rejection and "REPLACES" in rejection observes declared_scope_rejection via rejection
  3. assert sc.declared_scope_rejection(plain) is None observes declared_scope_rejection
  4. assert sc.declared_scope_rejection(usable) is None observes declared_scope_rejection

Where the product reaches it

No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.

Call flow

test_declared_scope_rejection_reports_without_falling_back→declared_scope_rejection

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.

test_declared_scope_rejection_reports_without_falling_back · 4 checksdeclared_scope_rejectionREQ-DDB-CONFIG-001 · measureddeclared_scope_rejection… 5 calls …_validate_nodeREQ-DDB-GUARD-012 · inferreddeclared_scope_rejection… 5 calls …allREQ-DDB-WIKI-054 · inferred

Requirements it verifies (1)

requirementlinked byimplementers exercised
REQ-DDB-PIPE-014catalogunknown
Also reaches 3 requirements

Its run touches their code; that is reach, not proof.