diff --git a/api/core/workflow/entities/base_node.py b/api/core/workflow/entities/base_node.py index 694aa8c218..af9e70d039 100644 --- a/api/core/workflow/entities/base_node.py +++ b/api/core/workflow/entities/base_node.py @@ -181,7 +181,6 @@ class BaseNodeData(ABC, BaseModel): model_config = ConfigDict(extra="allow") type: NodeType - # Keep empty default for backward compatibility with legacy graph payloads. title: str = "" desc: str | None = None version: str = "1" diff --git a/api/core/workflow/nodes/base/node.py b/api/core/workflow/nodes/base/node.py index d7bad766a3..839230844e 100644 --- a/api/core/workflow/nodes/base/node.py +++ b/api/core/workflow/nodes/base/node.py @@ -245,10 +245,6 @@ class Node(Generic[NodeDataT]): if "id" not in config: raise ValueError("node config missing required 'id' field") node_id = config["id"] - if not isinstance(node_id, str) or not node_id.strip(): - raise ValueError("node config 'id' field must be a non-empty string") - if node_id != id: - raise ValueError(f"node config 'id' field ('{node_id}') does not match constructor id ('{id}')") self._node_id = node_id self._node_execution_id: str = "" diff --git a/api/core/workflow/nodes/http_request/entities.py b/api/core/workflow/nodes/http_request/entities.py index b3152f1511..ba7e8b703c 100644 --- a/api/core/workflow/nodes/http_request/entities.py +++ b/api/core/workflow/nodes/http_request/entities.py @@ -90,7 +90,6 @@ class HttpRequestNodeData(BaseNodeData): Code Node Data. """ - # Keep default for backward compatibility with model construction paths. type: NodeType = NodeType.HTTP_REQUEST method: Literal[ "get", diff --git a/api/core/workflow/nodes/start/entities.py b/api/core/workflow/nodes/start/entities.py index 72538b0271..ccdb36d4d5 100644 --- a/api/core/workflow/nodes/start/entities.py +++ b/api/core/workflow/nodes/start/entities.py @@ -12,6 +12,5 @@ class StartNodeData(BaseNodeData): Start Node Data """ - # Keep default for backward compatibility with model construction paths. type: NodeType = NodeType.START variables: Sequence[VariableEntity] = Field(default_factory=list) diff --git a/api/tests/unit_tests/core/workflow/nodes/test_base_node.py b/api/tests/unit_tests/core/workflow/nodes/test_base_node.py index b948a8eb3c..3741694a3e 100644 --- a/api/tests/unit_tests/core/workflow/nodes/test_base_node.py +++ b/api/tests/unit_tests/core/workflow/nodes/test_base_node.py @@ -72,32 +72,6 @@ def test_node_initialization_falls_back_to_node_type_when_data_type_is_missing() assert node.node_data.type == NodeType.ANSWER -def test_node_initialization_rejects_empty_config_id(): - graph_config: dict[str, object] = {} - init_params, runtime_state = _build_context(graph_config) - - with pytest.raises(ValueError, match="non-empty string"): - _SampleNode( - id="node-1", - config={"id": "", "data": {"type": NodeType.ANSWER, "title": "Sample", "foo": "bar"}}, - graph_init_params=init_params, - graph_runtime_state=runtime_state, - ) - - -def test_node_initialization_rejects_mismatched_config_id(): - graph_config: dict[str, object] = {} - init_params, runtime_state = _build_context(graph_config) - - with pytest.raises(ValueError, match="does not match constructor id"): - _SampleNode( - id="node-1", - config={"id": "node-2", "data": {"type": NodeType.ANSWER, "title": "Sample", "foo": "bar"}}, - graph_init_params=init_params, - graph_runtime_state=runtime_state, - ) - - def test_missing_generic_argument_raises_type_error(): graph_config: dict[str, object] = {}