fix(appraiser-facts): route extraction through analyst wakeup (was silent 0)
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m38s
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m38s
The "חלץ עובדות שמאיות" UI button hit POST /api/cases/{n}/extract-appraiser-facts
which called appraiser_facts_extractor inline — that shells out to the local
`claude` CLI, which is absent in the Coolify container, so every doc errored,
the per-doc try/except swallowed it, and the response was "completed, 0 facts".
Refactored the endpoint to wake the legal-analyst of the correct company via
Paperclip (same pattern as wake_curator_for_final), and surface
extraction_failed instead of "completed" when every doc errored.
This commit is contained in:
@@ -250,8 +250,19 @@ async def extract_appraiser_facts(case_id: UUID) -> dict:
|
||||
|
||||
conflicts = await db.detect_appraiser_conflicts(case_id)
|
||||
|
||||
# Don't swallow extractor failures: if every appraisal errored and no
|
||||
# facts were extracted, surface that as a distinct status instead of
|
||||
# the misleading "completed, 0 facts" we used to return — the caller
|
||||
# (and the UI) need to know that nothing actually ran.
|
||||
all_errored = (
|
||||
total_facts == 0
|
||||
and by_doc
|
||||
and all(d.get("status") == "error" for d in by_doc)
|
||||
)
|
||||
status = "extraction_failed" if all_errored else "completed"
|
||||
|
||||
return {
|
||||
"status": "completed",
|
||||
"status": status,
|
||||
"appraisal_count": len(appraisals),
|
||||
"total_facts": total_facts,
|
||||
"conflicts": conflicts,
|
||||
|
||||
Reference in New Issue
Block a user