test_nested_lookalike_path_agrees

Tests › tests/guard/test_guard_contract.py

passed Passed in the packaged run.

What this test is for

Why it exists

^tests/ must not match src/tests/, in either the listing or the gate.

Given

  1. (tmp_path / "src" / "tests").mkdir(parents=True)
  2. (tmp_path / "src" / "tests" / "n.c").write_text("void N(void) { }")
  3. monkeypatch.chdir(tmp_path)
→

When

  1. config = deep_merge(CONFIG_DEFAULTS, {"validate": {"exclude": ["tests/**"]}})
  2. listed = build_files_contract(["."], config)["files"]
  3. validate_file("src/tests/n.c", config, no_git=True)
→

Then

  1. ✓ any("src/tests/n.c" in f for f in listed) holds
  2. ✓ validate_file("src/tests/n.c", config, no_git=True) differs from []

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) · 74 of 357 steps

… 42 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.pyloop (line 651)loopopt (line 653)optopt (line 733)optmain43–44. load_config → apply_opt_in_languages43apply_opt_in_languages +1 more45. deep_merge → deep_merge45deep_merge46. load_config → deep_merge46deep_merge47. _run → run_precommit47run_precommit

… 18 steps between

program launcherprogram launcherprogram launcherprogram launcherother filesother filesother filesother filesopt (line 1336)optalt (line 1344)altmain66–67. read_catalog_at → git_text66git_text +1 more68–69. git_argv → _no_ext_diff68_no_ext_diff +1 more70–71. read_catalog_at → _refuse_url70_refuse_url +1 more

… 7 steps between

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.pyclew/guard/impact.pyclew/guard/impact.pyclew/guard/impact.pyclew/guard/impact.pyother filesother filesother filesother filestry (line 345)tryloop (line 326)looploop (line 69)loopopt (line 178)optmain79. load_failure_mode_ids → modes_of79modes_of80. _validate_files → validate_file80validate_file81. validate_file → get_validate81get_validate▶ test enters82. validate_file → excluded_by82excluded_by83–84. excluded_by → compile_globs83compile_globs +1 more85. validate_file → gate_exclusion85gate_exclusion86–87. gate_exclusion → _gate_matcher86_gate_matcher +1 more88–89. load_toolchain_config → _read_toml88_read_toml +1 more

… 8 steps between

program launcherprogram launcherprogram launcherprogram launcherprogram launcherclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyother filesother filesother filesother filesother filesopt (line 184)optloop (line 186)loopopt (line 189)optopt (line 98)optopt (line 168)optloop (line 647)loopopt (line 786)optopt (line 652)optmain98–99. load_toolchain_config → _entry_globs98_entry_globs +1 more100. _gate_matcher → compile_globs100compile_globs101. gate_exclusion → matches101matches102. gate_exclusion → binary_file102binary_file103. validate_file → parse_source_file103parse_source_file▶ test enters104–109. parse_source_file → parse_source_file_with_content104parse_source_file_with_content +5 more110. parse_content_for_file → language_for_file110language_for_file111–112. language_for_file → language_for_extension111language_for_extension +1 more113. language_for_file → _language_from_config113_language_from_config114. parse_content_for_file → parse_functions114parse_functions115. parse_functions → parse_functions_ts115parse_functions_ts116. parse_functions_ts → get_parser_for_language116get_parser_for_language117. parse_functions_ts → get_language_spec117get_language_spec118–119. parse_functions_ts → _collect_functions118_collect_functions +1 more120. _is_rust_test_item → _rust_attributes120_rust_attributes121. _collect_functions → _enclosing_class_for121_enclosing_class_for122. _enclosing_class_for → _rust_impl_self_type122_rust_impl_self_type123. _collect_functions → _declared_function123_declared_function124–125. _collect_functions → _append_declaration124_append_declaration +1 more

… 1 step between

program launcherprogram launcherprogram launcherprogram launcherprogram launcherclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyclew/guard/ts_parser.pyother filesother filesother filesother filesother filesloop (line 647)loopopt (line 658)optopt (line 377)optalt (line 380)altopt (line 383)optopt (line 384)optopt (line 400)optopt (line 681)optopt (line 683)optopt (line 227)opttry (line 241)trymain127–128. _append_declaration → _qualified_enclosing127_qualified_enclosing +1 more129–130. _collect_functions → _resolve_function_node129_resolve_function_node +1 more131. _resolve_function_node → _bound_function131_bound_function132–137. _collect_functions → _extract_function_name132_extract_function_name +5 more138–140. _find_preceding_doxygen → _collect_rust_doc138_collect_rust_doc +2 more141. _find_preceding_doxygen → _collect_c_comment141_collect_c_comment142. _find_preceding_doxygen → _find_python_docstring_block142_find_python_docstring_block143. _find_preceding_doxygen → parse_doxygen_tags143parse_doxygen_tags144. _find_preceding_doxygen → apply_autobrief144apply_autobrief145. _find_preceding_doxygen → _last_row145_last_row146–149. _collect_functions → _qualified_enclosing146_qualified_enclosing +3 more150. _js_returns_void → _function_carrier150_function_carrier151. _collect_functions → _produced_class151_produced_class152. _produced_class → _function_carrier152_function_carrier153–154. _collect_functions → _collect_functions153_collect_functions +1 more155. validate_file → unconfigured_language155unconfigured_language156. validate_file → check_file_presence156check_file_presence▶ test enters157. check_file_presence → get_validate157get_validate158–159. check_file_presence → _find_file_doxygen_start158_find_file_doxygen_start +1 more

… 13 steps between

program launcherprogram launcherprogram launcherprogram launcherprogram launcherclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/impact.pyclew/guard/impact.pyclew/guard/impact.pyclew/guard/impact.pyclew/guard/impact.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyother filesother filesother filesother filesother filesloop (line 181)looploop (line 118)loopopt (line 120)optopt (line 268)optopt (line 138)optopt (line 247)optloop (line 193)looploop (line 631)looploop (line 635)looploop (line 638)loopmain173–174. apply_autobrief → _split_inline_tags173_split_inline_tags +1 more175. validate_file → check_presence175check_presence▶ test enters176. check_presence → get_validate176get_validate177. check_presence → _is_void_function177_is_void_function178. _is_void_function → _is_rust_unit_fn178_is_rust_unit_fn179. check_presence → _suggest_skeleton179_suggest_skeleton180. check_presence → _brief_hint180_brief_hint181. validate_file → check_return_presence181check_return_presence182. check_return_presence → get_validate182get_validate183. check_return_presence → _require_return183_require_return184. check_return_presence → _is_void_function184_is_void_function185. validate_file → check_tags185check_tags186. check_tags → get_validate186get_validate187. check_tags → _validate_tag_value187_validate_tag_value188. validate_file → check_req_coverage188check_req_coverage189. check_req_coverage → get_requirements189get_requirements190. check_req_coverage → _has_active_requirements190_has_active_requirements191. _has_active_requirements → load_requirements_full191load_requirements_full

… 9 steps between

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.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyloop (line 361)loopopt (line 374)optopt (line 251)optmain201. _has_version_gate → get_requirements201get_requirements202. check_req_coverage → _exemption_hint202_exemption_hint203. validate_file → check_bus_tags203check_bus_tags▶ test enters204. check_bus_tags → get_validate204get_validate205. check_bus_tags → _bus_tags205_bus_tags206. _bus_tags → get_validate206get_validate

… 2 steps between

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.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyloop (line 1337)looploop (line 252)loopmain209–210. check_bus_tags → _crosses_bus209_crosses_bus +1 more211. validate_file → check_unknown_tags211check_unknown_tags▶ test enters212. check_unknown_tags → get_validate212get_validate213. check_unknown_tags → _event_tags213_event_tags

… 2 steps between

program launcherprogram launcherprogram launcherprogram launcherprogram launcherclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/main.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyclew/guard/checks.pyother filesother filesother filesother filesother filesopt (line 924)optloop (line 252)looploop (line 1022)loopopt (line 1026)optopt (line 260)optloop (line 1096)loopopt (line 265)optmain216. _edit_distance → _edit_distance216_edit_distance217. _edit_distance → list217list218. validate_file → check_removed_tags218check_removed_tags▶ test enters219. validate_file → check_exemption_reasons219check_exemption_reasons220. check_exemption_reasons → get_validate220get_validate221. validate_file → check_duplicate_tags221check_duplicate_tags222. check_duplicate_tags → get_validate222get_validate223. validate_file → check_req_exists223check_req_exists224. check_req_exists → get_validate224get_validate225. check_req_exists → _uncheckable225_uncheckable226. validate_file → check_fails_when_exists226check_fails_when_exists227. validate_file → check_fails_when_markers227check_fails_when_markers228. check_fails_when_markers → marker228marker229. validate_file → get_file_at_revision229get_file_at_revision

… 68 steps between

program launcherprogram launcherprogram launcherprogram launcherclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/config.pyclew/guard/coverage.pyclew/guard/coverage.pyclew/guard/coverage.pyclew/guard/coverage.pyother filesother filesother filesother filesloop (line 179)looploop (line 182)loopmain298. analyze_coverage → collect_tagged_functions298collect_tagged_functions299. collect_tagged_functions → find_source_files299find_source_files300. find_source_files → get_validate300get_validate▶ test enters301–306. find_source_files → _git_ls_files301_git_ls_files +5 more307. collect_tagged_functions → _process_source_file307_process_source_file308. _process_source_file → parse_source_file_with_content308parse_source_file_with_content

… 49 later steps

4 more

tests/guard/test_guard_contract.py:286 · its file's page

What it checks (2)

  1. assert any("src/tests/n.c" in f for f in listed) observes build_files_contract via listed
  2. assert validate_file("src/tests/n.c", config, no_git=True) != [] observes validate_file

Where the product reaches it

  • main → _run → _dispatch_subcommand → _run_files_command → build_files_contract (flow)
  • main → _run → load_config → deep_merge (flow)
  • main → _run → run_precommit → _validate_files → validate_file (flow)

Call flow

test_nested_lookalike_path_agrees→deep_merge→build_files_contract→validate_file

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_nested_lookalike_path_agrees · 2 checksbuild_files_contractfind_source_files_git_ls_filesgit_argvREQ-DDB-CONFIG-001 · measuredbuild_files_contracttoolchain_contractREQ-DDB-CONFIG-009 · measuredvalidate_fileREQ-DDB-GUARD-001 · measuredvalidate_filecheck_version_stalenessREQ-DDB-GUARD-002 · inferredvalidate_filecheck_tagsREQ-DDB-GUARD-003 · measuredvalidate_filecheck_req_coverageREQ-DDB-GUARD-004 · measuredvalidate_filecheck_return_presenceREQ-DDB-GUARD-005 · measuredvalidate_filecheck_file_presenceREQ-DDB-GUARD-006 · measuredvalidate_filecheck_duplicate_tagsREQ-DDB-GUARD-007 · measuredvalidate_filecheck_req_coverage_has_active_requirementsfilter_requirements_by_versionREQ-DDB-GUARD-009 · inferredvalidate_filecheck_req_coverage_has_active_requirementsload_requirements_fullREQ-DDB-GUARD-011 · inferredbuild_files_contractfind_source_filesREQ-DDB-GUARD-013 · measured

and 14 more requirement paths, listed below.

Also reaches 26 requirements

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