test_an_invalid_guard_section_is_survived¶
Tests › tests/test_requirements_declared.py
What this test is for
Why it exists
An invalid `guard:` section must cost the index its declared values, loudly, and never the build. This loader runs AFTER the doxygen run and every edge-import stage, so a target repo with one stray key used to burn an entire build and then die at exit 1 with a message from a different tool.
Given
(tmp_path / ".clew.yaml").write_text("guard:\n stray_top_level_key: true\n", encoding="utf-8")
When
with caplog.at_level(logging.WARNING): result = requirements_module.load_guard_config(tmp_path)
Then
- ✓ result is None
- ✓ any("INVALID" in rec.message for rec in caplog.records) holds
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.
`main` (clew/guard/main.py) · 15 of 357 steps
… 16 earlier steps
… 315 later steps
3 more
- thread `clew-first-build-` — `_first_build_worker` (clew/mcp_server/server.py) · 4 of 142 steps
- Build this wiki from the index · 4 of 400 steps
- clew — `main` (clew/cli.py) · 3 of 400 steps
tests/test_requirements_declared.py:272 · its file's page
What it checks (2)
assert result is None, "a rejected config must degrade to defaults, not propagate"observesload_guard_configviaresultassert any("INVALID" in rec.message for rec in caplog.records), ( "falling back to built-in defaults silently is the failure mode being fixed" )not attributed
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
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 4 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-CONFIG-001 measured
- REQ-DDB-GUARD-012 measured
- REQ-DDB-GUARD-014 measured
- REQ-DDB-GUARD-024 inferred