test_a_stated_vocabulary_beats_the_repos_declaration

Tests › tests/test_diagnostics.py

passed Passed in the packaged run.

What this test is for

Why it exists

gh#332's PRECEDENCE, and it needs a real build because the `or` chain that implements it lives one line deep inside `_build_stages`. A mutation control found this untested: swapping the two sides — so the declaration beats the statement — left the entire suite green, which is tier 1 reachable and INERT, the exact shape gh#332 exists to fix reintroduced one line lower.

Given

  1. root = tmp_path / "repo"
  2. root.mkdir()
6 more
  1. (root / "unit.c").write_text("/** @brief A unit. */\nvoid unit(void) {}\n", encoding="utf-8")
  2. (root / ".clew.yaml").write_text( "event_tags:\n emits: producer\n handles: consumer\n", encoding="utf-8" )
  3. doxyfile = root / "Doxyfile"
  4. doxyfile.write_text( f"INPUT = {root}\nOUTPUT_DIRECTORY = {root}/out\nRECURSIVE = YES\nGENERATE_SQLITE3 = YES\n", encoding="utf-8", )
  5. declared_only = tmp_path / "declared.db"
  6. build_index(output=declared_only, repo_root=root, doxyfile=doxyfile)
→

When

  1. baseline = meta_section(declared_only, dg.META_PREFIX)
  2. stated = tmp_path / "stated.db"
  3. build_index( output=stated, repo_root=root, doxyfile=doxyfile, options={"event_tags": {"broadcasts": "producer"}}, )
  4. section = meta_section(stated, dg.META_PREFIX)
→

Then

  1. ✓ baseline["event_vocabulary_size"] equals "2"
  2. ✓ baseline["event_vocabulary_source"] equals dg.SOURCE_DECLARED
  3. ✓ section["event_vocabulary_size"] equals "1"
  4. ✓ section["event_vocabulary_source"] equals dg.SOURCE_DECLARED

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) · 33 of 400 steps

… 10 earlier steps

command-line usercommand-line usercommand-line usercommand-line userclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyother filesother filesother filesother filesalt (line 1171)altopt (line 529)optmain11. propose → build_context11build_context12. build_context → derive_scope12derive_scope13. derive_scope → _declared_index_scope13_declared_index_scope▶ test enters14. _declared_index_scope → load_declaration_located14load_declaration_located15–18. load_declaration_located → _read_mapping15_read_mapping +3 more19–20. _checked_section → _checked_list_section19_checked_list_section +1 more

… 18 steps between

command-line usercommand-line usercommand-line usercommand-line usercommand-line userclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyclew/scope.pyother filesother filesother filesother filesother filesloop (line 598)loopopt (line 696)opttry (line 1003)tryopt (line 845)optloop (line 1239)loopopt (line 847)optloop (line 746)looploop (line 1055)loopopt (line 1075)optloop (line 1117)loopmain39–40. _checked_document → _checked_entries39_checked_entries +1 more41. _checked_section → _check_section_keys41_check_section_keys42–44. _declared_index_scope → _existing_paths42_existing_paths +2 more45. derive_scope → whole_repo_scope45whole_repo_scope46. whole_repo_scope → _gitignored_paths46_gitignored_paths47. _gitignored_paths → git_argv47git_argv48–49. git_argv → _no_ext_diff48_no_ext_diff +1 more50. _gitignored_paths → git_env50git_env51. whole_repo_scope → list51list52. whole_repo_scope → nested_repo_roots52nested_repo_roots53. nested_repo_roots → _nested_repos_under53_nested_repos_under54–56. _nested_repos_under → _warn_unwalkable54_warn_unwalkable +2 more57. nested_repo_roots → _nested_repos_under57_nested_repos_under58. whole_repo_scope → _gitignored_paths58_gitignored_paths59–60. whole_repo_scope → _pruned_dirs59_pruned_dirs +1 more61. _pruned_dirs → _skip_dir61_skip_dir62. _pruned_dirs → _descendable62_descendable63–64. _descendable → _is_within63_is_within +1 more65–68. whole_repo_scope → _declaration_note65_declaration_note +3 more69. derive_scope → whole_repo_scope69whole_repo_scope▶ test enters70–72. build_context → repo_source_files70repo_source_files +2 more73. _ts_language_for → _grammar_available73_grammar_available▶ test enters74–75. _grammar_available → has_language74has_language +1 more76. _ts_language_for → _try_import_ts_module76_try_import_ts_module77–78. build_context → scope_membership77scope_membership +1 more

… 4 steps between

command-line usercommand-line usercommand-line usercommand-line userother filesother filesother filesother filesopt (line 288)optopt (line 385)optmain83. _cached_parser → _try_import_ts_module83_try_import_ts_module84. _ast_parse_one_file → _parseable_file84_parseable_file85. _parseable_file → binary_file85binary_file▶ test enters86–87. _ast_parse_one_file → _disambiguate_header86_disambiguate_header +1 more

… 23 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/propose/astdefs.pyclew/propose/astdefs.pyclew/propose/astdefs.pyclew/propose/astdefs.pyother filesother filesother filesother filesmain111. _accessor_site → callee_name111callee_name112. build_context → load_declaration112load_declaration113. load_declaration → load_declaration_located113load_declaration_located▶ test enters114–115. propose → _sections114_sections +1 more

… 57 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/init_command.pyclew/init_command.pyclew/init_command.pyclew/init_command.pyother filesother filesother filesother filesloop (line 312)looploop (line 314)loopmain173. diagnose → _check_doxygen173_check_doxygen174. _check_doxygen → uses_rustdoc174uses_rustdoc175. uses_rustdoc → discover_doxyfile175discover_doxyfile▶ test enters176. uses_rustdoc → has_cargo_manifest176has_cargo_manifest177. _check_doxygen → _needs_doxygen177_needs_doxygen178. _needs_doxygen → claims178claims

… 27 steps between

command-line usercommand-line usercommand-line usercommand-line userother filesother filesother filesother filestry (line 155)trymain206–207. _locate → target_for206target_for +1 more208. target_for → state_home208state_home▶ test enters209–210. query_main → _payload209_payload +1 more

… 190 later steps

6 more

tests/test_diagnostics.py:480 · its file's page

What it checks (4)

  1. assert baseline["event_vocabulary_size"] == "2", "premise: the declaration is read" observes meta_section via baseline
  2. assert baseline["event_vocabulary_source"] == dg.SOURCE_DECLARED observes meta_section via baseline
  3. assert section["event_vocabulary_size"] == "1", "a stated vocabulary REPLACES the declared one" observes meta_section via section
  4. assert section["event_vocabulary_source"] == dg.SOURCE_DECLARED observes meta_section via section

Where the product reaches it

  • index → _index_action → build_or_refresh → db_status → _meta_section → meta_section (flow)

Call flow

test_a_stated_vocabulary_beats_the_repos_declaration→meta_section

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_a_stated_vocabulary_beats_the_repos_declaration · 4 checksmeta_sectionREQ-DDB-MCP-001 · measured
Also reaches 50 requirements

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