test_the_decl_def_duality_still_elects_the_definition

Tests › tests/test_outofline_definitions.py

passed Passed in the packaged run.

What this test is for

Why it exists

THE REGRESSION THIS PINS. Widening the definition test to "carries a body" made it TRUE for BOTH rows of a duality pair, so the `rowid` tiebreak elected the header DECLARATION — which doxygen emits first. Measured on mbedtls before this test existed: 37 multi-row names flipped their resolved rowid, and `resolve_symbol` joins `path` on `file_id` while taking `bodystart`, so the elected row published a HEADER path with the .c's body line — a fabricated file:line an agent would go read.

Given

  1. conn = _duality_fixture(tmp_path)
→

When

  1. try: got = _common.resolve_rowid(conn, "u128_eq") rows = _common.function_candidates(conn, "u128_eq") finally: conn.close()
→

Then

  1. ✓ got equals DUAL_DEF
  2. ✓ rows[0][0] equals DUAL_DEF

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 · 6 of 226 steps

… 45 earlier steps

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. function_candidates → table_exists48table_exists▶ test enters49–51. function_candidates → _test_scope_term49_test_scope_term +2 more52–53. matching_identity → qualified_name_of52qualified_name_of +1 more

… 155 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.pyclew/query/traversal.pyclew/query/traversal.pyclew/query/traversal.pyclew/query/traversal.pyother filesother filesother filesother filesloop (line 558)looploop (line 570)loopopt (line 239)optopt (line 285)optdossier209. chain_trace → _expand_neighbor209_expand_neighbor210. _expand_neighbor → resolve_rowid210resolve_rowid211. resolve_rowid → table_exists211table_exists▶ test enters212. resolve_rowid → function_candidates212function_candidates213. resolve_rowid → _test_scope_term213_test_scope_term214. _expand_neighbor → _make_node214_make_node215. subject_payload → _flatten_subject215_flatten_subject

… 11 later steps

1 more

tests/test_outofline_definitions.py:224 · its file's page

What it checks (2)

  1. assert got == DUAL_DEF, ( f"resolved to rowid {got}; the header DECLARATION row was elected over the definition " f"because both carry the same body span and the tiebreak is rowid ascending" ) observes resolve_rowid via got
  2. assert rows[0][0] == DUAL_DEF, ( f"candidates ranked the declaration first: {rows}. `resolve_symbol` joins path on " f"file_id but takes bodystart, so this publishes a header path with the .c's line" ) observes function_candidates via rows

Where the product reaches it

  • dossier → identity_rowids → function_candidates (flow)
  • dossier → _chain_for → chain_trace → _expand_neighbor → resolve_rowid (flow)

Call flow

test_the_decl_def_duality_still_elects_the_definition→_duality_fixture→resolve_rowid→function_candidates

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_the_decl_def_duality_still_elects_the_definition · 2 checksresolve_rowidREQ-DDB-QUERY-003 · measuredresolve_rowidREQ-DDB-QUERY-010 · measured
Also reaches 2 requirements

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