test_multi_source_edge_collapses_to_one_row_per_endpoint

Tests › tests/test_query.py

passed Passed in the packaged run.

What this test is for

Why it exists

#38. One logical edge found by two layers must surface ONCE.

Verifies REQ-DDB-QUERY-002

Given

  1. db = tmp_path / "multi.db"
  2. _multi_source_db(db)
→

When

  1. calls = [c for c in q.callees(db, "driver") if c.edge_class == "call"]
  2. pump = next(c for c in calls if c.name == "pump")
  3. solo = next(c for c in calls if c.name == "solo")
  4. inbound = [c for c in q.callers(db, "pump") if c.edge_class == "call"]
→

Then

  1. ✓ [c.name for c in calls] equals ["pump", "solo"]
  2. ✓ (pump.source, pump.confidence) equals ("doxygen_sqlite", "exact")
  3. ✓ (solo.source, solo.confidence) equals ("ast", "resolved")
  4. ✓ [c.name for c in inbound] equals ["driver"]
  5. ✓ (inbound[0].source, inbound[0].confidence) equals ("doxygen_sqlite", "exact")

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 · 10 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_exists▶ test enters21–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

… 81 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

… 37 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

… 15 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:1550 · its file's page

What it checks (5)

  1. assert [c.name for c in calls] == ["pump", "solo"], "one row per endpoint, name-ordered" observes callees via calls
  2. assert (pump.source, pump.confidence) == ("doxygen_sqlite", "exact") not attributed
  3. assert (solo.source, solo.confidence) == ("ast", "resolved") not attributed
  4. assert [c.name for c in inbound] == ["driver"] observes callers via inbound
  5. assert (inbound[0].source, inbound[0].confidence) == ("doxygen_sqlite", "exact") observes callers via inbound

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_multi_source_edge_collapses_to_one_row_per_endpoint→callees→_multi_source_db→callers

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_multi_source_edge_collapses_to_one_row_per_endpoint · 5 checkscallersREQ-DDB-QUERY-001 · measuredcallers_call_edges_dataflow_edgesresolve_rowidREQ-DDB-QUERY-003 · measuredcallers_call_edges_direct_call_edges_implementors_by_identityREQ-DDB-QUERY-009 · measuredcallersREQ-DDB-QUERY-010 · measured

Requirements it verifies (1)

requirementlinked byimplementers exercised
REQ-DDB-QUERY-002catalogunknown
Also reaches 4 requirements

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