fix: rule_signature conditions=None防御 + 0行表格覆盖率 + UT覆盖 - Closes #21
CI / test (pull_request) Successful in 9s

- step3 rule_signature: trigger.conditions=None 时使用 `or []` 防御
- step1 _quick_validate: total_rows=0 时行覆盖率设为 100% 而非 0%
- test_step1: 新增 TestHasSectionContent (10个) + TestQuickValidateEmptySections (2个)
- test_step3: 新增 TestRuleSignature (7个) + TestNormalizeRule (4个)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-01 13:29:25 +08:00
parent 50eb37094a
commit da17b3b3b2
4 changed files with 380 additions and 1 deletions
@@ -114,8 +114,9 @@ def rule_signature(rule: dict) -> str:
trigger = rule.get("trigger") or {}
actions = rule.get("actions") or []
raw_conditions = trigger.get("conditions") or []
conditions = sorted(
trigger.get("conditions", []), key=lambda c: c.get("signal", "")
raw_conditions, key=lambda c: (c or {}).get("signal", "")
)
sorted_actions = sorted(actions, key=lambda a: a.get("description", ""))