test_edge_identity.py

tests/test_edge_identity.py

A NEIGHBOUR THE REPLY NAMED AND THE CALLER COULD NOT FOLLOW (C2 of the 1.1.0 review).

test_a_collided_callee_row_carries_its_qualified_identity

None test_edge_identity.test_a_collided_callee_row_carries_its_qualified_identity(Path colliding)

Each colliding callee row carries the qualified name that selects it.

tests/test_edge_identity.py:92

Show on the map →

Called by none

Calls dossier

Checks

  • assert set(callees) == {"execute"} or len(built.function.callees) == 2
  • assert quals == ["ClientSession::execute", "ServerManager::execute"], (f"two distinct identities sharing a bare name must be distinguishable: {quals}" )

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-004measuredtest_a_collided_callee_row_carries_its_qualified_identity → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance
REQ-DDB-QUERY-001measuredtest_a_collided_callee_row_carries_its_qualified_identity → dossier → connect
REQ-DDB-QUERY-002measuredtest_a_collided_callee_row_carries_its_qualified_identity → dossier → _chain_for → chain_trace
REQ-DDB-QUERY-003measuredtest_a_collided_callee_row_carries_its_qualified_identity → dossier → identity_rowids
REQ-DDB-QUERY-004measured
REQ-DDB-QUERY-005inferredtest_a_collided_callee_row_carries_its_qualified_identity → dossier → _chain_for → chain_trace → _make_node
REQ-DDB-QUERY-006measured
REQ-DDB-QUERY-009measured
REQ-DDB-QUERY-010measuredtest_a_collided_callee_row_carries_its_qualified_identity → dossier → identity_rowids
REQ-DDB-QUERY-012measured
REQ-DDB-QUERY-013inferredtest_a_collided_callee_row_carries_its_qualified_identity → dossier → _qualified_reread → _split_qualified → bare_tail
REQ-DDB-SCHEMA-011measured
REQ-DDB-WIKI-054inferredtest_a_collided_callee_row_carries_its_qualified_identity → dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all
Source · 15 lines
def test_a_collided_callee_row_carries_its_qualified_identity(colliding: Path) -> None:
    """THE ASSERTION IS ON FOLLOWABILITY, NOT ON A FIELD EXISTING. Two rows share the bare
    name `execute`; what makes the list usable is that the two carry DIFFERENT qualified
    names, so a reader can tell which is which and pass one back.
    """
    built = q.dossier(colliding, "app_run")
    callees = {e.name: e for e in built.function.callees}
    assert set(callees) == {"execute"} or len(built.function.callees) == 2

    quals = sorted(e.qualified for e in built.function.callees)
    assert quals == ["ClientSession::execute", "ServerManager::execute"], (
        f"two distinct identities sharing a bare name must be distinguishable: {quals}"
    )

Activity · 5 steps
lines 97–97built = q.dossier(colliding, "app_run")lines 98–98callees = {e.name: e for e in built.function.callees}lines 99–99assert set(callees) == {"execute"} or len(built.function.callees) == 2lines 101–101quals = sorted(e.qualified for e in built.function.callees)lines 102–104assert quals == ["ClientSession::execute", "ServerManager::execute"], ( f"two distinct identities sharing a bare name must be distinguishable: {quals}" )

test_a_free_function_publishes_an_empty_identity

None test_edge_identity.test_a_free_function_publishes_an_empty_identity(Path colliding)

An unqualified free function publishes no identity rather than a fabricated one.

tests/test_edge_identity.py:152

Show on the map →

Called by none

Calls dossier

Checks

  • assert [c.name for c in callers] == ["app_run"]
  • assert callers[0].qualified == "", (f"a free function has no qualified name; echoing the bare one invents a selector value " f"the index does not hold: {callers[0].qualified!r}" )

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-004measuredtest_a_free_function_publishes_an_empty_identity → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance
REQ-DDB-QUERY-001measuredtest_a_free_function_publishes_an_empty_identity → dossier → connect
REQ-DDB-QUERY-002measuredtest_a_free_function_publishes_an_empty_identity → dossier → _chain_for → chain_trace
REQ-DDB-QUERY-003measuredtest_a_free_function_publishes_an_empty_identity → dossier → identity_rowids
REQ-DDB-QUERY-004measured
REQ-DDB-QUERY-005inferredtest_a_free_function_publishes_an_empty_identity → dossier → _chain_for → chain_trace → _make_node
REQ-DDB-QUERY-006measured
REQ-DDB-QUERY-009measured
REQ-DDB-QUERY-010measuredtest_a_free_function_publishes_an_empty_identity → dossier → identity_rowids
REQ-DDB-QUERY-012measured
REQ-DDB-QUERY-013inferredtest_a_free_function_publishes_an_empty_identity → dossier → _qualified_reread → _split_qualified → bare_tail
REQ-DDB-SCHEMA-011measured
REQ-DDB-WIKI-054inferredtest_a_free_function_publishes_an_empty_identity → dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all
Source · 16 lines
def test_a_free_function_publishes_an_empty_identity(colliding: Path) -> None:
    """`qualified_name_of` returns nothing for a definition carrying no owner, and that must
    reach the wire as an empty string rather than as the bare name repeated.

    A field echoing the bare name would read as "this IS the qualified form", which would send
    a caller to pass `qualified="app_run"` — a selector value the index does not hold, and a
    refusal where there was never any ambiguity. `absence is not emptiness` on a scalar: a free
    function HAS no qualified name, and saying so costs nothing while guessing costs a call.
    """
    built = q.dossier(colliding, "execute", qualified="ServerManager::execute")
    callers = built.function.callers
    assert [c.name for c in callers] == ["app_run"]
    assert callers[0].qualified == "", (
        f"a free function has no qualified name; echoing the bare one invents a selector value "
        f"the index does not hold: {callers[0].qualified!r}"
    )

1 more lines, not shown

Activity · 4 steps
lines 161–161built = q.dossier(colliding, "execute", qualified="ServerManager::execute")lines 162–162callers = built.function.callerslines 163–163assert [c.name for c in callers] == ["app_run"]lines 164–167assert callers[0].qualified == "", ( f"a free function has no qualified name; echoing the bare one invents a selector value " f"the index does not hold: {callers[0].qualified!r}" )

test_following_the_row_reaches_that_endpoint_and_not_its_namesake

None test_edge_identity.test_following_the_row_reaches_that_endpoint_and_not_its_namesake(Path colliding)

Following a published identity reaches the endpoint the row meant.

tests/test_edge_identity.py:135

Show on the map →

Called by none

Calls dossier

Checks

  • assert followed is not None
  • assert followed.function.rowid == by_qualified["ServerManager::execute"].rowid, ("the identity a row publishes must resolve to the row's own endpoint" )

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-004measuredtest_following_the_row_reaches_that_endpoint_and_not_its_namesake → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance
REQ-DDB-QUERY-001measuredtest_following_the_row_reaches_that_endpoint_and_not_its_namesake → dossier → connect
REQ-DDB-QUERY-002measuredtest_following_the_row_reaches_that_endpoint_and_not_its_namesake → dossier → _chain_for → chain_trace
REQ-DDB-QUERY-003measuredtest_following_the_row_reaches_that_endpoint_and_not_its_namesake → dossier → identity_rowids
REQ-DDB-QUERY-004measured
REQ-DDB-QUERY-005inferredtest_following_the_row_reaches_that_endpoint_and_not_its_namesake → dossier → _chain_for → chain_trace → _make_node
REQ-DDB-QUERY-006measured
REQ-DDB-QUERY-009measured
REQ-DDB-QUERY-010measuredtest_following_the_row_reaches_that_endpoint_and_not_its_namesake → dossier → identity_rowids
REQ-DDB-QUERY-012measured
REQ-DDB-QUERY-013inferredtest_following_the_row_reaches_that_endpoint_and_not_its_namesake → dossier → _qualified_reread → _split_qualified → bare_tail
REQ-DDB-SCHEMA-011measured
REQ-DDB-WIKI-054inferredtest_following_the_row_reaches_that_endpoint_and_not_its_namesake → dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all
Source · 15 lines
def test_following_the_row_reaches_that_endpoint_and_not_its_namesake(colliding: Path) -> None:
    """THE ROUND TRIP END TO END, which is the only assertion that proves the saved call. A
    field that round-trips through `matching_identity` but lands on the wrong body would pass
    the test above and still cost the cell its mark.
    """
    built = q.dossier(colliding, "app_run")
    by_qualified = {e.qualified: e for e in built.function.callees}

    followed = q.dossier(colliding, "execute", qualified="ServerManager::execute")
    assert followed is not None
    assert followed.function.rowid == by_qualified["ServerManager::execute"].rowid, (
        "the identity a row publishes must resolve to the row's own endpoint"
    )

Activity · 5 steps
lines 140–140built = q.dossier(colliding, "app_run")lines 141–141by_qualified = {e.qualified: e for e in built.function.callees}lines 143–143followed = q.dossier(colliding, "execute", qualified="ServerManager::execute")lines 144–144assert followed is not Nonelines 145–147assert followed.function.rowid == by_qualified["ServerManager::execute"].rowid, ( "the identity a row publishes must resolve to the row's own endpoint" )

test_the_published_identity_is_accepted_by_the_selector

None test_edge_identity.test_the_published_identity_is_accepted_by_the_selector(Path colliding)

The published identity is one the qualified selector accepts.

tests/test_edge_identity.py:109

Checks

  • assert edge.qualified, f"{edge.name} published no identity to follow"
  • assert len(ids) == 1, (f"{edge.qualified!r} selected {len(ids)} identities; a neighbour row must name " f"exactly one, or following it reproduces the ambiguity it was meant to resolve" )

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-INDEX-004measuredtest_the_published_identity_is_accepted_by_the_selector → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance
REQ-DDB-QUERY-001measuredtest_the_published_identity_is_accepted_by_the_selector → dossier → connect
REQ-DDB-QUERY-002measuredtest_the_published_identity_is_accepted_by_the_selector → dossier → _chain_for → chain_trace
REQ-DDB-QUERY-003measuredtest_the_published_identity_is_accepted_by_the_selector → identity_rowids
REQ-DDB-QUERY-004measured
REQ-DDB-QUERY-005inferredtest_the_published_identity_is_accepted_by_the_selector → dossier → _chain_for → chain_trace → _make_node
REQ-DDB-QUERY-006measured
REQ-DDB-QUERY-009measured
REQ-DDB-QUERY-010measuredtest_the_published_identity_is_accepted_by_the_selector → identity_rowids
REQ-DDB-QUERY-012measured
REQ-DDB-QUERY-013inferredtest_the_published_identity_is_accepted_by_the_selector → dossier → _qualified_reread → _split_qualified → bare_tail
REQ-DDB-SCHEMA-011measured
REQ-DDB-WIKI-054inferredtest_the_published_identity_is_accepted_by_the_selector → dossier → _rank_enum_over_mirror → _class_side_is_only_enum_mirrors → all
Source · 24 lines
def test_the_published_identity_is_accepted_by_the_selector(colliding: Path) -> None:
    """THE DEFECT THIS GUARDS AGAINST BY NAME. The served `qualified` description advertised
    `candidates[i].signature` for a parameter the code compares against the QUALIFIED NAME,
    so obeying the instruction failed 87.5% of the time it was tried. A hint or a row derived
    by one rule and accepted by another reproduces that defect in a new place.

    So this asserts the round trip rather than the string, through `identity_rowids` — which is
    the function `dossier(subject, qualified=...)` actually passes the selector to, not merely
    one that agrees with it today.
    """
    built = q.dossier(colliding, "app_run")
    conn = sqlite3.connect(str(colliding))
    try:
        for edge in built.function.callees:
            assert edge.qualified, f"{edge.name} published no identity to follow"
            ids = identity_rowids(conn, edge.name, edge.qualified)
            assert len(ids) == 1, (
                f"{edge.qualified!r} selected {len(ids)} identities; a neighbour row must name "
                f"exactly one, or following it reproduces the ambiguity it was meant to resolve"
            )
    finally:
        conn.close()

Activity · 7 steps
lines 119–119built = q.dossier(colliding, "app_run")lines 120–120conn = sqlite3.connect(str(colliding))lines 121–121trylines 122–122◇ for edge in built.function.calleeslines 123–123assert edge.qualified, f"{edge.name} published no identity to follow"lines 124–124ids = identity_rowids(conn, edge.name, edge.qualified)lines 125–128assert len(ids) == 1, ( f"{edge.qualified!r} selected {len(ids)} identities; a neighbour row must name " f"exactly one, or following it reproduces the ambiguity it was meant to resolve" )