feat: stabilize graph zone containers

This commit is contained in:
2026-05-25 02:08:45 +02:00
parent 0f7b7d1fed
commit 558e0dc157
7 changed files with 496 additions and 13 deletions

View File

@@ -96,6 +96,43 @@ def test_resolver_assigns_seed_nodes_and_boundary_edges() -> None:
}
def test_resolver_ignores_context_only_edges_for_boundaries_and_attraction() -> None:
resolution = resolve_zones(
nodes=[
_node("repo", kind="Repository"),
_node("svc.prod", deploymentEnvironment="prod"),
_node("svc.context", kind="service"),
],
edges=[
_edge("edge.repo-prod", "repo", "svc.prod", "declares", displayOnly=True),
_edge("edge.prod-context", "svc.prod", "svc.context", "declares", displayOnly=True),
],
zone_definitions=[
{
"id": "prod",
"label": "prod",
"membership": {"field": "deploymentEnvironment", "op": "equals", "value": "prod"},
"attraction": {
"rules": [
{
"edge_type": "*",
"direction": "both",
"depth": 1,
}
]
},
},
],
)
assert resolution.zone_by_id("prod").boundary_edge_ids == ()
assert resolution.zone_by_id("prod").internal_edge_ids == ()
assert "svc.context" not in resolution.node_assignments
assert "ZONE_EDGE_CROSSES_ZONE_BOUNDARY" not in {
diagnostic.code for diagnostic in resolution.diagnostics
}
def test_resolver_attracts_nodes_by_edge_type_direction_and_depth() -> None:
resolution = resolve_zones(
nodes=[