test_a_gate_says_whether_this_build_satisfied_it

Tests › tests/integration/test_gate_coverage_integration.py

passed Passed in the packaged run.

What this test is for

Why it exists

PLAN ITEM 2.8, AND THE ANSWER TURNED OUT TO BE A COMPOSITION RATHER THAN A NEW LAYER. The item asked to make `--predefined` ADDITIVE — to LABEL what is on and off instead of deciding what is indexed — and left open "whether doxygen alone can do this or the tree-sitter path must supply the excluded branches". The tree-sitter path ALREADY supplies them: gh#11 recovers a function doxygen never emitted, precisely BECAUSE the preprocessor skipped it. So what was missing was never the rows; it was the label, and three fields on one row now carry it:

Given

  1. root = tmp_path / "twoflag"
  2. (root / "src").mkdir(parents=True)
5 more
  1. (root / "src" / "twoflag.c").write_text(TWO_FLAG_SOURCE, encoding="utf-8")
  2. doxyfile = root / "Doxyfile"
  3. doxyfile.write_text(DOXYFILE, encoding="utf-8")
  4. db = tmp_path / "twoflag.db"
  5. build_index( output=db, repo_root=root, doxyfile=doxyfile, options={"predefined": ["FIXTURE_DECLARED"]}, )
→

When

  1. doss = function_dossier(db, "fixture_two_flags")
  2. origins = {gate.macro: gate.origin for gate in doss.gated_by}
→

Then

  1. ✓ doss is not None
  2. ✓ origins.get("FIXTURE_DECLARED") equals GATE_ORIGIN_DECLARED
  3. ✓ origins.get("FIXTURE_ABSENT") equals GATE_ORIGIN_UNDECLARED

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) · 41 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 485)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. load_declaration_located → _read_mapping15_read_mapping16. _read_mapping → _parsed_declaration16_parsed_declaration17. load_declaration_located → _checked_sections17_checked_sections

… 26 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 filesopt (line 696)opttry (line 1003)tryopt (line 845)optloop (line 1239)loopopt (line 847)optloop (line 746)looploop (line 1055)loopopt (line 1075)optmain44. _declared_index_scope → _existing_paths44_existing_paths45. 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–64. _pruned_dirs → _descendable62_descendable +2 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

… 5 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyother filesother filesother filesother filesloop (line 1576)looploop (line 1494)loopopt (line 1497)optloop (line 1507)loopmain216. _memberdef_corpora → _expansion_sql216_expansion_sql217. _expansion_sql → has_columns217has_columns218. has_columns → table_exists218table_exists219. _memberdef_corpora → _memberdef_candidates219_memberdef_candidates220. _memberdef_candidates → table_exists220table_exists221. _memberdef_candidates → documented_first221documented_first222. documented_first → records_provenance222records_provenance223. records_provenance → has_columns223has_columns224. _memberdef_candidates → symbol_provenance224symbol_provenance225. symbol_provenance → records_provenance225records_provenance▶ test enters226. _memberdef_candidates → self_declared_paths226self_declared_paths227. _memberdef_candidates → _one_line227_one_line

… 125 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyother filesother filesother filesother filesmain353–354. lock_roster → nestings_on353nestings_on +1 more355. _layer_present → table_exists355table_exists▶ test enters356. nestings_on → table_exists356table_exists357. lock_roster → _nesting_pairs357_nesting_pairs

… 8 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/symbols.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyloop ×2 (line 944)loop ×2main366. thread_roster → has_columns366has_columns367. thread_roster → _thread_columns367_thread_columns368. _thread_columns → has_columns368has_columns▶ test enters369–370. _thread_columns → has_columns369has_columns ×2

… 21 steps between

command-line usercommand-line usercommand-line usercommand-line userclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyother filesother filesother filesother filesloop (line 660)loopmain392. _gates → table_exists392table_exists393. _gates → _gate_columns393_gate_columns394. _gate_columns → has_columns394has_columns▶ test enters395. _gate_columns → has_columns395has_columns396. _gates → _with_defaults396_with_defaults397. _with_defaults → table_exists397table_exists▶ test enters398. _with_defaults → _defaults_for_macros398_defaults_for_macros399. _with_defaults → decided_default399decided_default400. decided_default → is_shipped_config400is_shipped_config
8 more

tests/integration/test_gate_coverage_integration.py:165 · its file's page

What it checks (3)

  1. assert doss is not None, ( "the function must be INDEXED even though the build does not satisfy its gates — that is " "gh#11's recovery, and it is what makes 'index the union, label the branches' possible " "without running the preprocessor twice" ) observes function_dossier via doss
  2. assert origins.get("FIXTURE_DECLARED") == GATE_ORIGIN_DECLARED, ( f"the build declared this macro, so the gate must say so: {origins}" ) not attributed
  3. assert origins.get("FIXTURE_ABSENT") == GATE_ORIGIN_UNDECLARED, ( f"the build did NOT declare this one, and that is the half that says the code is absent " f"from this variant: {origins}" ) 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_a_gate_says_whether_this_build_satisfied_it→function_dossier

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_gate_says_whether_this_build_satisfied_it · 3 checksfunction_dossier_dossier_connsymbol_provenanceREQ-DDB-INDEX-004 · measuredfunction_dossier… 5 calls …is_python_treeREQ-DDB-PIPE-003 · measuredfunction_dossier… 5 calls …_parseable_fileREQ-DDB-PIPE-011 · measuredfunction_dossier… 5 calls …has_languageREQ-DDB-PIPE-012 · measuredfunction_dossierconnectREQ-DDB-QUERY-001 · measuredfunction_dossier_dossier_connunresolved_inbound_for_rowidsREQ-DDB-QUERY-002 · measuredfunction_dossier_dossier_connfunction_candidatesREQ-DDB-QUERY-003 · measuredfunction_dossierREQ-DDB-QUERY-004 · measuredfunction_dossier_dossier_conngates_coveringREQ-DDB-QUERY-006 · measuredfunction_dossierREQ-DDB-QUERY-009 · measuredfunction_dossierREQ-DDB-QUERY-010 · measuredfunction_dossier_dossier_conn_macro_dossierREQ-DDB-QUERY-012 · measured

and 2 more requirement paths, listed below.

Also reaches 57 requirements

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