mirror of
https://github.com/semantica-agi/semantica.git
synced 2026-08-29 04:26:20 +00:00
Fix empty decision_id handling: Ensure consistent UUID generation for boundary cases
- Fix add_decision to handle both None and empty string decision_id values - Change from 'decision.decision_id is not None' to 'decision.decision_id' - Ensures empty string decision_id also triggers UUID generation like None - Prevents nodes with empty string keys in the graph - Aligns ContextGraph behavior with Decision model's __post_init__ method - Ensures compliance with PR Rule 3: Robust Error Handling and Edge Case Management - All 62 tests still passing successfully
This commit is contained in:
@@ -944,8 +944,9 @@ class ContextGraph:
|
||||
"""
|
||||
from .decision_models import Decision
|
||||
|
||||
# Handle empty decision ID by generating UUID only if None (preserve empty string)
|
||||
node_id = decision.decision_id if decision.decision_id is not None else str(uuid.uuid4())
|
||||
# Handle empty decision ID by generating UUID for both None and empty string
|
||||
# This ensures consistent behavior with Decision model's __post_init__ method
|
||||
node_id = decision.decision_id if decision.decision_id else str(uuid.uuid4())
|
||||
|
||||
# Handle None metadata
|
||||
metadata = decision.metadata or {}
|
||||
|
||||
Reference in New Issue
Block a user