Fix comparison pipeline event and transaction handling

This commit is contained in:
“Naeel”
2026-08-27 11:23:14 +03:00
parent e5c7c88073
commit 811be85efe
6 changed files with 71 additions and 28 deletions
+12 -2
View File
@@ -77,6 +77,15 @@ def run_pipeline(contract_id, order_ids, build_prompt_fn):
ops = result.get("ops", [])
mode = result.get("mode", "llm")
if mode == "full_replace" and not ops:
yield {
"type": "extract_error",
"supplement_id": sid,
"filename": filename,
"error": "full_replace returned empty ops",
}
continue
# Трансляция target_id ("r1","r2"...) → target_hash (name_hash из current_spec).
# LLM возвращает target_id, а apply_ops() читает target_hash — без этого UPDATE/DELETE уходят в UNRESOLVED.
for _op in ops:
@@ -120,7 +129,7 @@ def run_pipeline(contract_id, order_ids, build_prompt_fn):
}
# Arithmetic check
check_arithmetic(ops)
arithmetic_warnings = check_arithmetic(ops)
yield {
"type": "applied",
@@ -128,6 +137,7 @@ def run_pipeline(contract_id, order_ids, build_prompt_fn):
"filename": filename,
"summary": summary,
"ops": applied_ops,
"arithmetic_warnings": arithmetic_warnings,
}
except Exception as e:
@@ -139,7 +149,7 @@ def run_pipeline(contract_id, order_ids, build_prompt_fn):
}
total_time = round(time.time() - t0, 1)
yield {"type": "complete", "total_time_s": total_time}
yield {"type": "done", "total_time_s": total_time}
def _elements_to_text(ej):