Merge pull request 'refactor(cases): צמצום תפריט-סטטוס 17→10 + מקור-אמת יחיד (UI-B1/G2)' (#287) from worktree-status-trim into main
This commit was merged in pull request #287.
This commit is contained in:
@@ -9,10 +9,18 @@ from uuid import UUID
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
# Core case lifecycle — kept in sync with STATUS_ORDER in tools/cases.py and the
|
||||
# frontend SSoT web-ui/src/lib/api/case-status.ts. Trimmed from 17 → 10 (the
|
||||
# decorative mid-stage markers that no pipeline code ever set were removed).
|
||||
class CaseStatus(str, enum.Enum):
|
||||
NEW = "new"
|
||||
IN_PROGRESS = "in_progress"
|
||||
PROCESSING = "processing"
|
||||
DOCUMENTS_READY = "documents_ready"
|
||||
OUTCOME_SET = "outcome_set"
|
||||
DIRECTION_APPROVED = "direction_approved"
|
||||
QA_REVIEW = "qa_review"
|
||||
DRAFTED = "drafted"
|
||||
EXPORTED = "exported"
|
||||
REVIEWED = "reviewed"
|
||||
FINAL = "final"
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ def _clamp_limit(limit: int, hard_max: int = _MAX_LIMIT) -> int:
|
||||
|
||||
@mcp.tool()
|
||||
async def case_list(status: str = "", limit: int = 50) -> str:
|
||||
"""רשימת תיקי ערר. סינון אופציונלי לפי סטטוס (new/in_progress/drafted/reviewed/final)."""
|
||||
"""רשימת תיקי ערר. סינון אופציונלי לפי סטטוס (new/processing/documents_ready/outcome_set/direction_approved/qa_review/drafted/exported/reviewed/final)."""
|
||||
return await cases.case_list(status, _clamp_limit(limit))
|
||||
|
||||
|
||||
|
||||
@@ -271,10 +271,8 @@ async def case_list(status: str = "", limit: int = 50) -> str:
|
||||
"""רשימת תיקי ערר עם אפשרות סינון לפי סטטוס.
|
||||
|
||||
Args:
|
||||
status: סינון לפי סטטוס (new, processing, proofread, documents_ready, analyst_verified,
|
||||
research_complete, outcome_set, direction_pending, direction_approved,
|
||||
analysis_enriched, ready_for_writing, drafted, qa_passed, qa_failed,
|
||||
exported, done). ריק = הכל
|
||||
status: סינון לפי סטטוס (new, processing, documents_ready, outcome_set,
|
||||
direction_approved, qa_review, drafted, exported, reviewed, final). ריק = הכל
|
||||
limit: מספר תוצאות מקסימלי
|
||||
"""
|
||||
cases = await db.list_cases(status=status or None, limit=limit)
|
||||
@@ -327,7 +325,7 @@ async def case_update(
|
||||
|
||||
Args:
|
||||
case_number: מספר תיק הערר
|
||||
status: סטטוס חדש (new, in_progress, drafted, reviewed, final)
|
||||
status: סטטוס חדש (new, processing, documents_ready, outcome_set, direction_approved, qa_review, drafted, exported, reviewed, final)
|
||||
title: כותרת חדשה
|
||||
subject: נושא חדש
|
||||
notes: הערות חדשות
|
||||
@@ -343,12 +341,13 @@ async def case_update(
|
||||
"""
|
||||
from datetime import date as date_type
|
||||
|
||||
# Ordered workflow statuses — regression protection
|
||||
# Ordered core lifecycle — regression protection (forward-only).
|
||||
# Single source of truth, mirrored by web-ui/src/lib/api/case-status.ts and
|
||||
# models.CaseStatus. Trimmed from 17 → 10 (decorative statuses removed).
|
||||
STATUS_ORDER = [
|
||||
"new", "uploading", "processing", "documents_ready",
|
||||
"analyst_verified", "research_complete", "outcome_set",
|
||||
"brainstorming", "direction_approved", "analysis_enriched", "ready_for_writing",
|
||||
"drafting", "qa_review", "drafted",
|
||||
"new", "processing", "documents_ready",
|
||||
"outcome_set", "direction_approved",
|
||||
"qa_review", "drafted",
|
||||
"exported", "reviewed", "final",
|
||||
]
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ def _suggest_next_steps(case: dict, docs: list, has_draft: bool) -> list[str]:
|
||||
|
||||
if docs and not has_draft:
|
||||
steps.append("התחל ניסוח טיוטת החלטה (/draft-decision)")
|
||||
elif has_draft and case["status"] in ("new", "in_progress"):
|
||||
elif has_draft and case["status"] == "new":
|
||||
steps.append("סקור ועדכן את הטיוטה")
|
||||
steps.append("עדכן סטטוס ל-drafted")
|
||||
|
||||
@@ -191,8 +191,10 @@ async def set_outcome(
|
||||
outcome_reasoning=reasoning,
|
||||
)
|
||||
|
||||
# Update case status
|
||||
await db.update_case(case_id, status="in_progress", expected_outcome=outcome)
|
||||
# Update case status — aligned with the web /set-outcome endpoint:
|
||||
# reasoning given → direction is set; no reasoning → outcome only (brainstorm next).
|
||||
new_status = "direction_approved" if reasoning else "outcome_set"
|
||||
await db.update_case(case_id, status=new_status, expected_outcome=outcome)
|
||||
|
||||
outcome_hebrew = OUTCOME_LABELS_HE.get(outcome, outcome)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user