Skip to content

Commit ca85966

Browse files
committed
fix(depgraph): detect a measure that references itself as a cycle
Symptom: a model containing 'M1 = [M1] + 1' passed the cycle check and the gate reported no circular dependency, while the real engine refuses to refresh it. Root cause: add_edge dropped any edge whose endpoints were equal, so the self loop never reached the Tarjan pass and the single node component never triggered the self edge branch. Self edges are now stored.
1 parent a1f31d5 commit ca85966

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎src/semantic_diff/depgraph.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ def add_node(self, node_id: str, kind: str, label: str, detail: str = "") -> Non
6060
self.reverse.setdefault(node_id, set())
6161

6262
def add_edge(self, dependent: str, dependency: str) -> None:
63-
if dependent == dependency:
64-
return
63+
# Self edges are kept. A measure whose expression references itself is a real
64+
# cycle that fails refresh, and dropping the edge made find_cycles blind to it.
6565
self.edges.setdefault(dependent, set()).add(dependency)
6666
self.reverse.setdefault(dependency, set()).add(dependent)
6767
self.edges.setdefault(dependency, set())

0 commit comments

Comments
 (0)