fix: [bug] step2 IR extraction 生成缺少 section 字段的 source - 来自 #18 e2e - Closes #53 #55

Merged
pzhang_zywl merged 1 commits from dev/issue-53-fix-source-section into main 2026-06-02 15:47:51 +08:00
Owner

Summary

  • step3 _normalize_rule: 为 table/text 类型的 source 补齐缺失的 section 字段
  • 推断策略: 优先从同规则其他 source 获取 → 从 rule path 首段获取
  • logic_tree 类型 source 不受影响(不需要 section)
  • 新增 4 个 UT

Root Cause

step2 LLM prompt 未强制要求 source 携带 section 字段,step2 _check_rule_fields
不验证 source,step3 _normalize_rule 只处理 trigger/conditions。
缺失 section 的 source 直到 acceptance test 的 Layer A schema 验证才被拦截。

Test

  • pytest: 106 passed, 1 pre-existing failure (test_step2_precondition_fields)
  • 4 new UT for source section normalization

Closes #53


[da-0602-1321]

## Summary - step3 `_normalize_rule`: 为 table/text 类型的 source 补齐缺失的 `section` 字段 - 推断策略: 优先从同规则其他 source 获取 → 从 rule path 首段获取 - logic_tree 类型 source 不受影响(不需要 section) - 新增 4 个 UT ## Root Cause step2 LLM prompt 未强制要求 source 携带 section 字段,step2 `_check_rule_fields` 不验证 source,step3 `_normalize_rule` 只处理 trigger/conditions。 缺失 section 的 source 直到 acceptance test 的 Layer A schema 验证才被拦截。 ## Test - [x] pytest: 106 passed, 1 pre-existing failure (test_step2_precondition_fields) - [x] 4 new UT for source section normalization Closes #53 --- [da-0602-1321]
pzhang_zywl added 1 commit 2026-06-02 15:47:17 +08:00
LLM 生成的 source 有时缺少 section 字段,导致 Layer A schema 验证失败。
在 _normalize_rule 中添加防御性处理:从兄弟 source 或 rule path 推断 section。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
pzhang_zywl merged commit a8ba8d4b4a into main 2026-06-02 15:47:51 +08:00
Sign in to join this conversation.