From 421a3284bc3b74d1c8c6b0c3935ae90c8a19804a Mon Sep 17 00:00:00 2001 From: QuantumGhost Date: Wed, 27 Aug 2025 15:07:01 +0800 Subject: [PATCH] fix(api): fix incorrectly handling of `array[boolean]` constant in loop node (#24619) --- api/core/workflow/nodes/loop/loop_node.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/core/workflow/nodes/loop/loop_node.py b/api/core/workflow/nodes/loop/loop_node.py index 5561150dcd..64296dc046 100644 --- a/api/core/workflow/nodes/loop/loop_node.py +++ b/api/core/workflow/nodes/loop/loop_node.py @@ -524,7 +524,10 @@ class LoopNode(BaseNode): @staticmethod def _get_segment_for_constant(var_type: SegmentType, original_value: Any) -> Segment: """Get the appropriate segment type for a constant value.""" - if not var_type.is_array_type() or var_type == SegmentType.BOOLEAN: + # TODO: Refactor for maintainability: + # 1. Ensure type handling logic stays synchronized with _VALID_VAR_TYPE (entities.py) + # 2. Consider moving this method to LoopVariableData class for better encapsulation + if not var_type.is_array_type() or var_type == SegmentType.ARRAY_BOOLEAN: value = original_value elif var_type in [ SegmentType.ARRAY_NUMBER,