From cbafd30ec7caa0b278650674164bdd572f43ecad Mon Sep 17 00:00:00 2001 From: Peter Zhang <18501667167@qq.com> Date: Tue, 2 Jun 2026 16:57:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20acceptance=20test=20=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=20IR=20=E6=97=B6=E5=BA=94=E7=94=A8=20=5Fnormalize=5Frule=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A7=20IR=20=E6=96=87=E4=BB=B6=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=20schema=20=E9=97=AE=E9=A2=98=20-=20Closes=20#57?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ir_data fixture 在加载 ir_final.json 后对每条 rule 调用 _normalize_rule, 确保旧 pipeline 输出也能受益于最新的防御性修复(非法 source type、 缺失 section 字段等)。 Co-Authored-By: Claude Opus 4.7 --- tests/acceptance/conftest.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/conftest.py b/tests/acceptance/conftest.py index 892f48a..45662aa 100644 --- a/tests/acceptance/conftest.py +++ b/tests/acceptance/conftest.py @@ -140,9 +140,19 @@ def ir_path(request) -> str: @pytest.fixture(scope="session") def ir_data(ir_path: str) -> dict: - """Load the IR JSON data.""" + """Load the IR JSON data, normalizing each rule for defensive schema fixes.""" with open(ir_path, "r", encoding="utf-8") as f: - return json.load(f) + data = json.load(f) + + # Apply normalize to every rule so old IR files benefit from latest fixes + # (invalid source types, missing section fields, trigger nulls, etc.) + sys.path.insert(0, str(_PROJECT_ROOT / "skills" / "ir_generation_skill")) + from step3_merge_and_audit import _normalize_rule + rules = data.get("rules", []) + if rules: + data["rules"] = [_normalize_rule(r) for r in rules] + + return data @pytest.fixture(scope="session") -- 2.52.0