test_same_named_module_private_helpers_do_not_share_edges

Tests › tests/test_query.py

passed Passed in the packaged run.

What this test is for

Why it exists

gh#26. Name-based resolution collapsed three unrelated `_classify` functions into ONE graph node, so `dossier` described one of them and then reported the UNION of all three functions' neighbours — 3 of 4 callers fabricated, including a self-edge claiming recursion that belongs to a DIFFERENT module's function. Every fabricated row came back `confidence: exact`, because all three extraction layers resolve by name and therefore all three reached the same wrong function.

Given

  1. db = tmp_path / "collide.db"
  2. _name_collision_db(db)
→

When

  1. d = q.function_dossier(db, "_classify")
  2. caller_names = {c.name for c in d.callers}
→

Then

  1. ✓ d is not None
  2. ✓ d.file equals "pkg/guidance.py"
  3. ✓ len(d.candidates) equals 3
  4. ✓ [c.name for c in d.callers if c.edge_class == "call"] equals ["plan_guidance"]
  5. ✓ [c.name for c in d.callees if c.edge_class == "call"] equals []
  6. ✓ caller_names does not contain "_guard_scope"
  7. ✓ caller_names does not contain "plan_merge"
  8. ✓ caller_names does not contain "_classify"

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.

Look up one name: everything the index holds about it · 18 of 226 steps

… 17 earlier steps

callercallercallercallerclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/recovery.pyclew/query/recovery.pyclew/query/recovery.pyclew/query/recovery.pydossier18. _documentation_mentions → table_exists18table_exists19. _documentation_mentions → has_columns19has_columns20. has_columns → table_exists20table_exists21–22. _hint_from → _name_exists21_name_exists +1 more

… 23 steps between

callercallercallercallerclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyother filesother filesother filesother filesdossier46. _ambiguity_counts → table_exists46table_exists47. _ambiguity_counts → function_candidates47function_candidates48–51. function_candidates → table_exists48table_exists +3 more52–53. matching_identity → qualified_name_of52qualified_name_of +1 more

… 4 steps between

callercallercallercallerclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyother filesother filesother filesother filesdossier58. macro_definitions → connect58connect59. macro_definitions → macro_definitions_conn59macro_definitions_conn60. macro_definitions_conn → has_columns60has_columns▶ test enters61–62. macro_definitions_conn → _macro_def61_macro_def +1 more63. gates_covering → table_exists63table_exists▶ test enters64. gates_covering → has_columns64has_columns65. gates_covering → _gate_columns65_gate_columns

… 12 steps between

callercallercallercallerclew/query/payload.pyclew/query/payload.pyclew/query/payload.pyclew/query/payload.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyother filesother filesother filesother filesdossier78. _referenced_by → table_exists78table_exists79. _macro_def → symbol_provenance79symbol_provenance80–81. symbol_provenance → records_provenance80records_provenance +1 more82. _gate_definitions → _gate_definition_gaps82_gate_definition_gaps83. _flatten_subject → _empty_callers_note83_empty_callers_note

… 51 steps between

callercallercallercallerclew/query/subject.pyclew/query/subject.pyclew/query/subject.pyclew/query/subject.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyopt (line 1012)optopt (line 777)optalt (line 780)altopt (line 1014)optdossier135. dossier → connect135connect136. dossier → identity_rowids136identity_rowids137. identity_rowids → function_candidates137function_candidates▶ test enters138–139. identity_rowids → qualified_name_of138qualified_name_of +1 more140–141. identity_rowids → qualified_name_of140qualified_name_of +1 more142. dossier → _selector_from_signature142_selector_from_signature143. _selector_from_signature → qualified_name_of143qualified_name_of

… 29 steps between

callercallercallercallerclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/traversal.pyclew/query/traversal.pyclew/query/traversal.pyclew/query/traversal.pydossier173–174. _identity_walk → _make_node173_make_node +1 more175. termini_for → table_exists175table_exists▶ test enters176. _make_node → _reqs_for176_reqs_for177. _reqs_for → table_exists177table_exists

… 3 steps between

callercallercallercallerclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/traversal.pyclew/query/traversal.pyclew/query/traversal.pyclew/query/traversal.pyother filesother filesother filesother filesloop (line 362)looploop (line 368)looploop (line 429)loopdossier181. _identity_call_hops → qualified_name_of181qualified_name_of182. _identity_call_hops → _collapse_variants182_collapse_variants183. _collapse_variants → _variant_rank183_variant_rank▶ test enters184. _identity_walk → identity_rowids184identity_rowids185. _identity_walk → _cap_at_depth185_cap_at_depth

… 3 steps between

callercallercallercallerclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/traversal.pyclew/query/traversal.pyclew/query/traversal.pyclew/query/traversal.pydossier189. chain_trace → function_candidates189function_candidates190. chain_trace → candidate_rows190candidate_rows191. candidate_rows → symbol_provenance191symbol_provenance▶ test enters192–193. candidate_rows → qualified_name_of192qualified_name_of +1 more194. chain_trace → is_overloaded194is_overloaded195. chain_trace → _make_node195_make_node

… 5 steps between

callercallercallercallerclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/_common.pyclew/query/traversal.pyclew/query/traversal.pyclew/query/traversal.pyclew/query/traversal.pyother filesother filesother filesother filesloop (line 191)loopdossier201. _neighbors → _key_hops201_key_hops202. _key_hops → _key_edge_rows202_key_edge_rows203. _key_edge_rows → table_exists203table_exists▶ test enters204. _key_edge_rows → _key_r1_projection204_key_r1_projection205. _key_r1_projection → has_columns205has_columns

… 21 later steps

3 more

tests/test_query.py:1645 · its file's page

What it checks (8)

  1. assert d is not None observes function_dossier via d
  2. assert d.file == "pkg/guidance.py" observes function_dossier via d
  3. assert len(d.candidates) == 3, "the ambiguity signal must still fire" observes function_dossier via d
  4. assert [c.name for c in d.callers if c.edge_class == "call"] == ["plan_guidance"] observes function_dossier via d
  5. assert [c.name for c in d.callees if c.edge_class == "call"] == [], ( "guidance._classify calls nothing; a self-edge here belongs to scope._classify" ) observes function_dossier via d
  6. assert "_guard_scope" not in caller_names, "belongs to scope._classify" not attributed
  7. assert "plan_merge" not in caller_names, "belongs to mcp_config._classify" not attributed
  8. assert "_classify" not in caller_names, "fabricated recursion" 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_same_named_module_private_helpers_do_not_share_edges→_name_collision_db→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_same_named_module_private_helpers_do_not_share_edges · 8 checksfunction_dossier_dossier_connsymbol_provenanceREQ-DDB-INDEX-004 · measuredfunction_dossier… 5 calls …is_python_treeREQ-DDB-PIPE-003 · inferredfunction_dossier… 5 calls …_parseable_fileREQ-DDB-PIPE-011 · inferredfunction_dossier… 5 calls …has_languageREQ-DDB-PIPE-012 · inferredfunction_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 14 requirements

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