fix: pipeline LLM 全失败时明确报错而非静默输出空 IR - Closes #15
CI / test (pull_request) Successful in 7s

- step1: 所有 LLM 调用返回空 function_units 时抛出 RuntimeError
- step1: main() 在 _quick_validate 未通过时 sys.exit(1)
- step2: function_units 为空时提前报错终止
- step3: fragments 为空时提前报错终止
- test: test_step1 捕获 SystemExit, test_step2_5/step3 空数据改为 skip

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-31 17:41:16 +08:00
parent af361d7fc7
commit 8069fc2f8a
6 changed files with 49 additions and 5 deletions
@@ -487,6 +487,12 @@ def main():
n_units = len(semantic_index.get("function_units", []))
print(f" 语义索引: {n_units} 个功能单元")
if n_units == 0:
print("错误: 语义索引中无功能单元 (function_units 为空)。")
print(" 请检查 step1_semantic_index 是否正确运行。")
print(" 可能原因: LLM API Key 未配置、Prompt 不兼容、或输入文档格式异常。")
sys.exit(1)
# 2. Extract rules
print(f"\n[2/3] 逐单元提取 IR 规则...")
fragments = extract_all_rules(semantic_index, doc)