From 73963e71408e6ac5f5504cf0fe351e566430e140 Mon Sep 17 00:00:00 2001 From: Lars Date: Thu, 9 Apr 2026 21:17:34 +0200 Subject: [PATCH] fix: ImportError - normalize_signal_value does not exist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root Cause: - Tried to import normalize_signal_value from normalization_engine - Function does not exist (only normalize_decision_signal) - Caused 500 Internal Server Error on workflow execution Backend workflow_executor.py: - Changed import: normalize_signal_value → normalize_decision_signal - normalize_decision_signal returns NormalizedSignal (not dict) - Use returned object directly (no .get() calls) - Simplified logic Fix: ```python # BEFORE (broken): normalized = normalize_signal_value(...) normalized_signals.append(NormalizedSignal(..., normalized.get('status'))) # AFTER (working): normalized_signal = normalize_decision_signal(...) normalized_signals.append(normalized_signal) ``` Issue: 500 Internal Server Error on workflow execution Version: 0.9p (workflow module) Part 3: End Node Template Engine - Import Fix Co-Authored-By: Claude Opus 4.6 --- backend/workflow_executor.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/backend/workflow_executor.py b/backend/workflow_executor.py index e81e574..b14fc0d 100644 --- a/backend/workflow_executor.py +++ b/backend/workflow_executor.py @@ -28,7 +28,7 @@ from question_augmenter import ( parse_question_augmentations_from_jsonb ) from result_container_parser import parse_result_container -from normalization_engine import normalize_all_signals, normalize_signal_value, load_question_catalog +from normalization_engine import normalize_all_signals, normalize_decision_signal, load_question_catalog from logic_evaluator import evaluate_logic_expression, resolve_signal_reference from join_evaluator import evaluate_join_node as evaluate_join_node_core from db import get_db, get_cursor @@ -334,21 +334,15 @@ async def execute_node( type_catalog_entry = catalog.get(q_config['type'], {}) # Normalize with question-specific spectrum - normalized = normalize_signal_value( + normalized_signal = normalize_decision_signal( + question_type=signal_id, # Use ID as question_type raw_value=signal_value, answer_spectrum=q_config['answer_spectrum'], normalization_rules=type_catalog_entry.get('normalization_rules') ) - normalized_signals.append(NormalizedSignal( - question_type=signal_id, # Store ID as question_type (for template access) - raw_value=signal_value, - normalized_value=normalized.get('normalized_value'), - status=normalized.get('status'), - confidence=normalized.get('confidence'), - metadata=normalized.get('metadata') - )) - logger.debug(f"Node {node.id}: Normalized signal '{signal_id}' = '{signal_value}' → '{normalized.get('normalized_value')}'") + normalized_signals.append(normalized_signal) + logger.debug(f"Node {node.id}: Normalized signal '{signal_id}' = '{signal_value}' → '{normalized_signal.normalized_value}' (status: {normalized_signal.status})") logger.info(f"Node {node.id}: Normalized {len(normalized_signals)} signals")