From 4cf039e029d1bdcc91d40e8e5454eb4e56d680e1 Mon Sep 17 00:00:00 2001 From: openclaw Date: Tue, 24 Mar 2026 08:09:29 +0000 Subject: [PATCH] feat(graph): add parent field to GraphNode domain entity Co-Authored-By: Claude Opus 4.6 --- backend/app/modules/graph/domain/entities.py | 1 + backend/tests/test_graph_service.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/backend/app/modules/graph/domain/entities.py b/backend/app/modules/graph/domain/entities.py index e1582f4..cf860d2 100644 --- a/backend/app/modules/graph/domain/entities.py +++ b/backend/app/modules/graph/domain/entities.py @@ -8,6 +8,7 @@ class GraphNode: label: str status: str # FileStatus or "unknown" group_id: str + parent: str | None = None @dataclass diff --git a/backend/tests/test_graph_service.py b/backend/tests/test_graph_service.py index 7a0a5ca..8ce5f1c 100644 --- a/backend/tests/test_graph_service.py +++ b/backend/tests/test_graph_service.py @@ -80,3 +80,9 @@ def test_neighbors_unknown_node(graph_service, scan_result): neighbors = graph_service.get_neighbors(view, "NONEXISTENT") assert len(neighbors.nodes) == 0 assert len(neighbors.edges) == 0 + + +def test_graph_node_has_parent_field(graph_service, scan_result): + view = graph_service.build_panorama(scan_result) + for node in view.nodes: + assert hasattr(node, 'parent')