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
@@ -987,10 +987,17 @@ def main():
semantic_index = load_semantic_index()
path_enum = load_path_enumeration()
total_fragments = len(fragments)
if total_fragments == 0 and not autocomplete_fragments:
print("错误: 无 IR 片段可合并 (fragments 和 autocomplete_fragments 均为空)。")
print(" 请检查 step2_ir_extraction 是否正确运行。")
print(" 可能原因: step1 未生成 function_units,或 step2 提取失败。")
sys.exit(1)
feature_name = semantic_index.get("feature_name", "行车娱乐限制")
feature_id = "DRL-001"
print(f" 功能: {feature_name} ({feature_id})")
print(f" 主片段: {len(fragments)}")
print(f" 主片段: {total_fragments}")
if autocomplete_fragments:
print(f" 自动补全片段: {len(autocomplete_fragments)}")