fix: step3 过滤非法 source type + step1 重试质量门控 - Closes #57
CI / test (pull_request) Successful in 11s
CI / test (pull_request) Successful in 11s
- step3 _normalize_rule: 将 function_unit_description 等非法 source type 标准化为 text - step1 覆盖反馈重试: 仅纳入实际提升覆盖率的 retry 结果,避免低质量输出稀释 ensemble - 新增 UT: test_normalize_source_invalid_type Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -511,3 +511,18 @@ class TestNormalizeRule:
|
||||
}
|
||||
normalized = _normalize_rule(rule)
|
||||
assert "section" not in normalized["sources"][0]
|
||||
|
||||
def test_normalize_source_invalid_type(self):
|
||||
"""Invalid source types (LLM hallucinations) are normalized to text."""
|
||||
rule = {
|
||||
"trigger": {"conditions": [{"signal": "x", "operator": "==", "value": "1"}]},
|
||||
"sources": [
|
||||
{"type": "function_unit_description", "text_snippet": "desc",
|
||||
"section": "3.1 功能"},
|
||||
{"type": "unknown_type", "text_snippet": "also invalid"},
|
||||
],
|
||||
}
|
||||
normalized = _normalize_rule(rule)
|
||||
assert normalized["sources"][0]["type"] == "text"
|
||||
assert normalized["sources"][1]["type"] == "text"
|
||||
assert normalized["sources"][0]["section"] == "3.1 功能"
|
||||
|
||||
Reference in New Issue
Block a user