fix: 修复 trigger.operator null + 添加覆盖反馈重试 - Closes #22, Closes #21
CI / test (pull_request) Successful in 7s
CI / test (pull_request) Successful in 7s
#22: _normalize_rule 补充 trigger 级别 operator (AND/OR) 默认值 #21: step1 验证失败时自动生成覆盖反馈并重试一轮 #22: step2 过滤空规则片段,避免污染下游 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -139,6 +139,10 @@ def _normalize_rule(rule: dict) -> dict:
|
||||
|
||||
trigger = rule["trigger"]
|
||||
|
||||
# Ensure trigger-level combining operator (AND/OR) for multi-condition triggers
|
||||
if not trigger.get("operator"):
|
||||
trigger["operator"] = "AND"
|
||||
|
||||
# If trigger has an event, it's event-based (no conditions needed)
|
||||
if trigger.get("event") is not None:
|
||||
return rule
|
||||
@@ -147,7 +151,7 @@ def _normalize_rule(rule: dict) -> dict:
|
||||
if "conditions" not in trigger:
|
||||
trigger["conditions"] = []
|
||||
|
||||
# Fix null operators in conditions
|
||||
# Fix null operators in individual conditions
|
||||
for cond in trigger["conditions"]:
|
||||
if not cond.get("operator"):
|
||||
cond["operator"] = "=="
|
||||
@@ -158,7 +162,6 @@ def _normalize_rule(rule: dict) -> dict:
|
||||
|
||||
# If still no conditions, add a default one
|
||||
if not trigger["conditions"]:
|
||||
trigger["operator"] = "AND"
|
||||
trigger["conditions"] = [{
|
||||
"signal": "system_state",
|
||||
"operator": "==",
|
||||
|
||||
Reference in New Issue
Block a user