test_an_invalid_guard_section_is_survived

Tests › tests/test_requirements_declared.py

passed Passed in the packaged run.

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

  1. (tmp_path / ".clew.yaml").write_text("guard:\n stray_top_level_key: true\n", encoding="utf-8")
→

When

  1. with caplog.at_level(logging.WARNING): result = requirements_module.load_guard_config(tmp_path)
→

Then

  1. ✓ result is None
  2. ✓ 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

program launcherprogram launcherprogram launcherprogram launcherclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyother filesother filesother filesother filesopt (line 733)optopt (line 705)optloop (line 417)loopalt (line 421)altopt (line 715)optmain17. _run → _setup_logging17_setup_logging18. _run → load_config18load_config19. load_config → refuse_doxygen_guard_leftovers19refuse_doxygen_guard_leftovers▶ test enters20. load_config → _fresh_defaults20_fresh_defaults21. load_config → read_requirements_section21read_requirements_section22–25. read_requirements_section → _validate_node22_validate_node +3 more26–28. _validate_node → _validate_dict_node26_validate_dict_node +2 more29. _suggest_key → list29list30. _validate_dict_node → _validate_node30_validate_node31. load_config → _shared_facts31_shared_facts32. _shared_facts → list32list33. load_config → read_guard_section33read_guard_section34. load_config → _fresh_defaults34_fresh_defaults35–40. load_config → validate_config_schema35validate_config_schema +5 more41–42. load_config → _log_declared_sections41_log_declared_sections +1 more

… 315 later steps

3 more

tests/test_requirements_declared.py:272 · its file's page

What it checks (2)

  1. assert result is None, "a rejected config must degrade to defaults, not propagate" observes load_guard_config via result
  2. assert 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

test_an_invalid_guard_section_is_survived→load_guard_config

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_an_invalid_guard_section_is_survived · 2 checksload_guard_configREQ-DDB-CONFIG-001 · measuredload_guard_configread_guard_configread_requirements_sectionREQ-DDB-GUARD-012 · measuredload_guard_configread_guard_configload_configapply_opt_in_languagesREQ-DDB-GUARD-024 · inferred
Also reaches 4 requirements

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