fix: step3 _normalize_rule 将 table source 的 null row 转为 0 - Closes #73
CI / test (pull_request) Successful in 8s
CI / test (pull_request) Successful in 8s
LLM 输出 table source 时 row 字段可能为 null,导致 Layer A schema 失败。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -512,6 +512,18 @@ class TestNormalizeRule:
|
||||
normalized = _normalize_rule(rule)
|
||||
assert "section" not in normalized["sources"][0]
|
||||
|
||||
|
||||
def test_normalize_table_source_null_row(self):
|
||||
"""Table source with null row gets row=0 (defensive)."""
|
||||
rule = {
|
||||
"trigger": {"conditions": [{"signal": "x", "operator": "==", "value": "1"}]},
|
||||
"sources": [
|
||||
{"type": "table", "section": "3.1 功能", "row": None},
|
||||
],
|
||||
}
|
||||
normalized = _normalize_rule(rule)
|
||||
assert normalized["sources"][0]["row"] == 0
|
||||
|
||||
def test_normalize_source_invalid_type(self):
|
||||
"""Invalid source types (LLM hallucinations) are normalized to text."""
|
||||
rule = {
|
||||
|
||||
Reference in New Issue
Block a user