test(merge): pin that a shared type links even when the declarations drift (#3007)

Document the cross-repo join's precision boundary: the key is namespace+name by design,
not structural, so a shared contract type whose declarations have drifted across repos
still links (and repo-unique types do not). Guards against a future change that tried to
gate the edge on member equality.
This commit is contained in:
safishamsi
2026-08-24 14:12:53 +01:00
parent c46b756cde
commit 960b6f5a0b
+22
View File
@@ -121,3 +121,25 @@ def test_sourceless_stub_is_not_linked(tmp_path):
[_type_node("evt", "OrderPlaced", "Contracts.Events")],
)
assert links == []
def test_same_namespace_and_name_link_even_when_the_declarations_drift(tmp_path):
"""The join key is namespace+name, deliberately NOT structural. Two repos
whose shared contract type has drifted (different source files, different
surrounding members) still link — a shared contract navigable across repos is
the point, and requiring structural equality would defeat it. This pins that
boundary so a future change that tried to gate on member equality fails here."""
links, _ = _merge(
tmp_path,
[
_type_node("evt", "OrderPlaced", "Contracts.Events", "v1/order.cs"),
_type_node("extra_a", "AuditLog", "Contracts.Events", "v1/audit.cs"),
],
[
_type_node("evt", "OrderPlaced", "Contracts.Events", "v2/order_placed.cs"),
_type_node("extra_b", "Telemetry", "Contracts.Events", "v2/telemetry.cs"),
],
)
# Only the shared name links; the repo-unique AuditLog/Telemetry do not.
assert len(links) == 1, links
assert {links[0]["source"], links[0]["target"]} == {"svc_a::evt", "svc_b::evt"}