From 960b6f5a0b9c9bbe795d0c95ab0cf29a3fcb7c0a Mon Sep 17 00:00:00 2001 From: safishamsi Date: Mon, 24 Aug 2026 14:12:53 +0100 Subject: [PATCH] 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. --- tests/test_cross_repo_shared_types.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_cross_repo_shared_types.py b/tests/test_cross_repo_shared_types.py index eb1238824..de32d2d3b 100644 --- a/tests/test_cross_repo_shared_types.py +++ b/tests/test_cross_repo_shared_types.py @@ -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"}