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
Checks
assert set(callees) == {"execute"} or len(built.function.callees) == 2assert quals == ["ClientSession::execute", "ServerManager::execute"], (f"two distinct identities sharing a bare name must be distinguishable: {quals}" )
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-004 | measured | test_a_collided_callee_row_carries_its_qualified_identity → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance |
| REQ-DDB-QUERY-001 | measured | test_a_collided_callee_row_carries_its_qualified_identity → dossier → connect |
| REQ-DDB-QUERY-002 | measured | test_a_collided_callee_row_carries_its_qualified_identity → dossier → _chain_for → chain_trace |
| REQ-DDB-QUERY-003 | measured | test_a_collided_callee_row_carries_its_qualified_identity → dossier → identity_rowids |
| REQ-DDB-QUERY-004 | measured | |
| REQ-DDB-QUERY-005 | inferred | test_a_collided_callee_row_carries_its_qualified_identity → dossier → _chain_for → chain_trace → _make_node |
| REQ-DDB-QUERY-006 | measured | |
| REQ-DDB-QUERY-009 | measured | |
| REQ-DDB-QUERY-010 | measured | test_a_collided_callee_row_carries_its_qualified_identity → dossier → identity_rowids |
| REQ-DDB-QUERY-012 | measured | |
| REQ-DDB-QUERY-013 | inferred | test_a_collided_callee_row_carries_its_qualified_identity → dossier → _qualified_reread → _split_qualified → bare_tail |
| REQ-DDB-SCHEMA-011 | measured | |
| REQ-DDB-WIKI-054 | inferred | test_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
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
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
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-004 | measured | test_a_free_function_publishes_an_empty_identity → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance |
| REQ-DDB-QUERY-001 | measured | test_a_free_function_publishes_an_empty_identity → dossier → connect |
| REQ-DDB-QUERY-002 | measured | test_a_free_function_publishes_an_empty_identity → dossier → _chain_for → chain_trace |
| REQ-DDB-QUERY-003 | measured | test_a_free_function_publishes_an_empty_identity → dossier → identity_rowids |
| REQ-DDB-QUERY-004 | measured | |
| REQ-DDB-QUERY-005 | inferred | test_a_free_function_publishes_an_empty_identity → dossier → _chain_for → chain_trace → _make_node |
| REQ-DDB-QUERY-006 | measured | |
| REQ-DDB-QUERY-009 | measured | |
| REQ-DDB-QUERY-010 | measured | test_a_free_function_publishes_an_empty_identity → dossier → identity_rowids |
| REQ-DDB-QUERY-012 | measured | |
| REQ-DDB-QUERY-013 | inferred | test_a_free_function_publishes_an_empty_identity → dossier → _qualified_reread → _split_qualified → bare_tail |
| REQ-DDB-SCHEMA-011 | measured | |
| REQ-DDB-WIKI-054 | inferred | test_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
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
Checks
assert followed is not Noneassert followed.function.rowid == by_qualified["ServerManager::execute"].rowid, ("the identity a row publishes must resolve to the row's own endpoint" )
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-004 | measured | test_following_the_row_reaches_that_endpoint_and_not_its_namesake → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance |
| REQ-DDB-QUERY-001 | measured | test_following_the_row_reaches_that_endpoint_and_not_its_namesake → dossier → connect |
| REQ-DDB-QUERY-002 | measured | test_following_the_row_reaches_that_endpoint_and_not_its_namesake → dossier → _chain_for → chain_trace |
| REQ-DDB-QUERY-003 | measured | test_following_the_row_reaches_that_endpoint_and_not_its_namesake → dossier → identity_rowids |
| REQ-DDB-QUERY-004 | measured | |
| REQ-DDB-QUERY-005 | inferred | test_following_the_row_reaches_that_endpoint_and_not_its_namesake → dossier → _chain_for → chain_trace → _make_node |
| REQ-DDB-QUERY-006 | measured | |
| REQ-DDB-QUERY-009 | measured | |
| REQ-DDB-QUERY-010 | measured | test_following_the_row_reaches_that_endpoint_and_not_its_namesake → dossier → identity_rowids |
| REQ-DDB-QUERY-012 | measured | |
| REQ-DDB-QUERY-013 | inferred | test_following_the_row_reaches_that_endpoint_and_not_its_namesake → dossier → _qualified_reread → _split_qualified → bare_tail |
| REQ-DDB-SCHEMA-011 | measured | |
| REQ-DDB-WIKI-054 | inferred | test_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
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
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-INDEX-004 | measured | test_the_published_identity_is_accepted_by_the_selector → dossier → _chain_for → chain_trace → candidate_rows → symbol_provenance |
| REQ-DDB-QUERY-001 | measured | test_the_published_identity_is_accepted_by_the_selector → dossier → connect |
| REQ-DDB-QUERY-002 | measured | test_the_published_identity_is_accepted_by_the_selector → dossier → _chain_for → chain_trace |
| REQ-DDB-QUERY-003 | measured | test_the_published_identity_is_accepted_by_the_selector → identity_rowids |
| REQ-DDB-QUERY-004 | measured | |
| REQ-DDB-QUERY-005 | inferred | test_the_published_identity_is_accepted_by_the_selector → dossier → _chain_for → chain_trace → _make_node |
| REQ-DDB-QUERY-006 | measured | |
| REQ-DDB-QUERY-009 | measured | |
| REQ-DDB-QUERY-010 | measured | test_the_published_identity_is_accepted_by_the_selector → identity_rowids |
| REQ-DDB-QUERY-012 | measured | |
| REQ-DDB-QUERY-013 | inferred | test_the_published_identity_is_accepted_by_the_selector → dossier → _qualified_reread → _split_qualified → bare_tail |
| REQ-DDB-SCHEMA-011 | measured | |
| REQ-DDB-WIKI-054 | inferred | test_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()