refactor(cases): צמצום תפריט-סטטוס 17→10 + מקור-אמת יחיד (UI-B1/G2)
תפריט הסטטוס-הידני הכיל 17 סטטוסים שמתוכם ~9 דקורציה טהורה — שלבי-ביניים שאף קוד בפייפליין לא קבע ושום לוגיקה לא הסתעפה לפיהם, עם רשימות כפולות לא-עקביות ב-6+ קבצים (UI-B1) ו-exported כסטטוס-רפאים (באג agent-audit). הליבה (10): new, processing, documents_ready, outcome_set, direction_approved, qa_review, drafted, exported, reviewed, final. - SSoT חדש web-ui/src/lib/api/case-status.ts (רשימה/שלבים/תוויות/statusLabel); כל הצרכנים (badge/changer/timeline/guide/donut/kpi/compose) מייבאים משם. - statusLabel() מבטיח תווית עברית תמיד — גם לערך-מורשת (נפילה עברית, לא סלאג). - בקאנד: STATUS_ORDER 10, models.CaseStatus מיושר, set_outcome קובע outcome_set/direction_approved (במקום in_progress) כמו endpoint ה-web. - exported מוקשח אחרי export-DOCX מוצלח (forward-only); widget "נכשל ב-QA" עודכן ל-qa_review (הסטטוס שנקבע בפועל בכשל-QA). - scripts/backfill_case_status_trim.py: מיפוי שורות-מורשת לסטטוס-הליבה הקודם. Invariants: UI-B1 (מקור-אמת יחיד) ✅ · G2 (אין מסלול מקביל) ✅ · GAP-42 (חלקי). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
15
web/app.py
15
web/app.py
@@ -3806,6 +3806,14 @@ async def api_export_docx(case_number: str, background_tasks: BackgroundTasks):
|
||||
|
||||
data = envelope_unwrap(parsed) # success payload: {path, active_draft_path, message}
|
||||
|
||||
# Mark the case 'exported' (forward-only — case_update's STATUS_ORDER won't
|
||||
# override a later 'reviewed'/'final'). Previously the status stayed at
|
||||
# drafted/reviewed after a successful export (agent-audit-2026-05-17 bug).
|
||||
try:
|
||||
await cases_tools.case_update(case_number, status="exported")
|
||||
except Exception:
|
||||
logger.warning("export-docx: failed to set status=exported for %s", case_number, exc_info=True)
|
||||
|
||||
# Notify the Paperclip plugin to attach the final-decision document.
|
||||
docx_filename = (
|
||||
data.get("filename")
|
||||
@@ -5741,14 +5749,15 @@ async def api_chair_pending():
|
||||
"href": "/feedback", "sample": [{"text": (r["feedback_text"] or "")[:120], "source": r["case_number"]} for r in cf_sample],
|
||||
})
|
||||
|
||||
# 4) תיקים שנכשלו ב-QA
|
||||
# 4) תיקים שנכשלו ב-QA — בכשל-QA הסטטוס שנקבע בפועל הוא qa_review
|
||||
# (api_run_qa: pass→drafted, fail→qa_review). הסטטוס qa_failed הוסר.
|
||||
qa_rows = await conn.fetch(
|
||||
"SELECT case_number, coalesce(title,'') AS title FROM cases WHERE status='qa_failed' ORDER BY updated_at DESC")
|
||||
"SELECT case_number, coalesce(title,'') AS title FROM cases WHERE status='qa_review' ORDER BY updated_at DESC")
|
||||
# Single failed case → link straight to it; multiple → home dashboard
|
||||
# (the donut/table surface them). Each sample row links to its own case.
|
||||
qa_href = f"/cases/{qa_rows[0]['case_number']}" if len(qa_rows) == 1 else "/"
|
||||
categories.append({
|
||||
"key": "qa_failed", "label": "תיקים שנכשלו ב-QA",
|
||||
"key": "qa_review", "label": "תיקים שנכשלו ב-QA",
|
||||
"description": "תיקים שבדיקת-האיכות חסמה — דורשים התייחסותך לפני המשך.",
|
||||
"count": len(qa_rows), "severity": "high" if qa_rows else "ok", "href": qa_href,
|
||||
"sample": [{"text": r["case_number"], "source": r["title"],
|
||||
|
||||
Reference in New Issue
Block a user