From 8129ca7c050bc214108286234a607a26d2ee55b0 Mon Sep 17 00:00:00 2001 From: -LAN- Date: Thu, 28 Aug 2025 04:29:32 +0800 Subject: [PATCH] chore(graph_engine): Move error_strategy.py to protocols/ Signed-off-by: -LAN- --- api/core/workflow/graph_engine/error_handling/__init__.py | 2 -- .../{error_handling => protocols}/error_strategy.py | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) rename api/core/workflow/graph_engine/{error_handling => protocols}/error_strategy.py (88%) diff --git a/api/core/workflow/graph_engine/error_handling/__init__.py b/api/core/workflow/graph_engine/error_handling/__init__.py index 4c865e58fc..1316710d0d 100644 --- a/api/core/workflow/graph_engine/error_handling/__init__.py +++ b/api/core/workflow/graph_engine/error_handling/__init__.py @@ -8,7 +8,6 @@ the Strategy pattern for clean separation of concerns. from .abort_strategy import AbortStrategy from .default_value_strategy import DefaultValueStrategy from .error_handler import ErrorHandler -from .error_strategy import ErrorStrategy from .fail_branch_strategy import FailBranchStrategy from .retry_strategy import RetryStrategy @@ -16,7 +15,6 @@ __all__ = [ "AbortStrategy", "DefaultValueStrategy", "ErrorHandler", - "ErrorStrategy", "FailBranchStrategy", "RetryStrategy", ] diff --git a/api/core/workflow/graph_engine/error_handling/error_strategy.py b/api/core/workflow/graph_engine/protocols/error_strategy.py similarity index 88% rename from api/core/workflow/graph_engine/error_handling/error_strategy.py rename to api/core/workflow/graph_engine/protocols/error_strategy.py index 0d3c662888..bf8b316423 100644 --- a/api/core/workflow/graph_engine/error_handling/error_strategy.py +++ b/api/core/workflow/graph_engine/protocols/error_strategy.py @@ -2,7 +2,7 @@ Base error strategy protocol. """ -from typing import Optional, Protocol +from typing import Protocol from core.workflow.graph import Graph from core.workflow.graph_events import GraphNodeEventBase, NodeRunFailedEvent @@ -16,7 +16,7 @@ class ErrorStrategy(Protocol): node execution failures. """ - def handle_error(self, event: NodeRunFailedEvent, graph: Graph, retry_count: int) -> Optional[GraphNodeEventBase]: + def handle_error(self, event: NodeRunFailedEvent, graph: Graph, retry_count: int) -> GraphNodeEventBase | None: """ Handle a node failure event.