feat(mcp): FU-14 GAP-51 — איחוד אוצר-המילים של תוצאת-תיק (set_outcome SSoT)
הכרעת-יו"ר: קנוני = 3 תוצאות אמיתיות (rejection/partial_acceptance/full_acceptance); betterment_levy יוצא מהיותו "תוצאה" ועובר ל-override לפי practice_area. + עקרון "אנגלית-ב-DB, עברית-ב-UI": מפת-תוויות SSoT אחת. lessons.py: - VALID_OUTCOMES = 3 (הוסר betterment_levy). - OUTCOME_LABELS_HE (SSoT לתצוגה) + LEGACY_OUTCOME_MAP + canonical_outcome(). - PRACTICE_AREA_OVERRIDES["betterment_levy"] מרכז את כל ה-guidance שהיה מפתוח כ-outcome (golden_ratios/opening/summary/discussion/template). - get_lessons_for_outcome(outcome, practice_area) + format_ratios_comment(..., practice_area) מחילים override + מנרמלים legacy. block_writer.py: STRUCTURE_GUIDANCE קנוני + תווית מ-OUTCOME_LABELS_HE + override betterment. workflow.set_outcome: קנוני 3 + מיפוי-legacy סלחני; תווית מ-SSoT. drafting.py: טבלת יחסי-זהב + get_decision_template מודעי-practice_area (override). web-ui case.ts: הסרת betterment_levy מ-expectedOutcomes (הוא practice_area). server.py: docstrings קנוניים. מיגרציה: migrate_gap51_outcomes.py — 9 שורות נורמלו (rejected→rejection וכו'), גיבוי ב-data/audit/. הקוד canonicalize בקריאה ⇒ backward-compatible גם בלי מיגרציה. אומת: py_compile (5 קבצים) + בדיקות-יחידה offline (override/legacy/labels) + אימות-DB. עודכנו X9 §3 + gap-audit (GAP-51 ✅). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -20,7 +20,13 @@ from uuid import UUID
|
||||
|
||||
from legal_mcp import config
|
||||
from legal_mcp.services import db, embeddings, claude_session, audit
|
||||
from legal_mcp.services.lessons import get_content_checklist, get_methodology_summary
|
||||
from legal_mcp.services.lessons import (
|
||||
OUTCOME_LABELS_HE,
|
||||
PRACTICE_AREA_OVERRIDES,
|
||||
canonical_outcome,
|
||||
get_content_checklist,
|
||||
get_methodology_summary,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -270,10 +276,11 @@ BLOCK_PROMPTS = {
|
||||
}
|
||||
|
||||
# Discussion structure by outcome
|
||||
# GAP-51: keyed by canonical outcomes (rejection/partial_acceptance/full_acceptance).
|
||||
STRUCTURE_GUIDANCE = {
|
||||
"rejected": "דחייה — שכבות הגנה (concentric circles): טענה ראשית → נדחית, טענה חלופית → נדחית, חיזוק.",
|
||||
"accepted": "קבלה — נימוק-נימוק: כל נימוק = CREAC מלא, בניית שכנוע הדרגתי.",
|
||||
"partial": "קבלה חלקית — מיפוי מתחים: מה מתקבל ולמה, מה נדחה ולמה, איזון.",
|
||||
"rejection": "דחייה — שכבות הגנה (concentric circles): טענה ראשית → נדחית, טענה חלופית → נדחית, חיזוק.",
|
||||
"full_acceptance": "קבלה — נימוק-נימוק: כל נימוק = CREAC מלא, בניית שכנוע הדרגתי.",
|
||||
"partial_acceptance": "קבלה חלקית — מיפוי מתחים: מה מתקבל ולמה, מה נדחה ולמה, איזון.",
|
||||
}
|
||||
|
||||
|
||||
@@ -327,8 +334,13 @@ async def write_block(
|
||||
appraiser_conflicts_context = await _build_appraiser_conflicts_context(case_id)
|
||||
post_hearing_context = await _build_post_hearing_context(case_id)
|
||||
|
||||
outcome = (decision or {}).get("outcome", "rejected")
|
||||
outcome = canonical_outcome((decision or {}).get("outcome", "rejection"))
|
||||
structure_guidance = STRUCTURE_GUIDANCE.get(outcome, "")
|
||||
if case.get("practice_area") == "betterment_levy":
|
||||
structure_guidance = (
|
||||
structure_guidance + " | היטל השבחה: "
|
||||
+ " ".join(PRACTICE_AREA_OVERRIDES["betterment_levy"]["discussion_rules"])
|
||||
).strip()
|
||||
|
||||
# Content checklist — tells block-yod WHAT topics to cover
|
||||
content_checklist = ""
|
||||
@@ -438,8 +450,8 @@ async def _collect_block_sources(case_id: UUID, block_id: str) -> dict:
|
||||
# ── Context builders ──────────────────────────────────────────────
|
||||
|
||||
def _build_case_context(case: dict, decision: dict | None) -> str:
|
||||
outcome = (decision or {}).get("outcome", "")
|
||||
outcome_heb = {"rejected": "דחייה", "accepted": "קבלה", "partial": "קבלה חלקית"}.get(outcome, "")
|
||||
outcome = canonical_outcome((decision or {}).get("outcome", ""))
|
||||
outcome_heb = OUTCOME_LABELS_HE.get(outcome, "")
|
||||
return f"""- מספר תיק: {case['case_number']}
|
||||
- כותרת: {case.get('title', '')}
|
||||
- עוררים: {', '.join(case.get('appellants', []))}
|
||||
@@ -877,8 +889,13 @@ async def get_block_context(case_id: UUID, block_id: str, instructions: str = ""
|
||||
appraiser_conflicts_context = await _build_appraiser_conflicts_context(case_id)
|
||||
post_hearing_context = await _build_post_hearing_context(case_id)
|
||||
|
||||
outcome = (decision or {}).get("outcome", "rejected")
|
||||
outcome = canonical_outcome((decision or {}).get("outcome", "rejection"))
|
||||
structure_guidance = STRUCTURE_GUIDANCE.get(outcome, "")
|
||||
if case.get("practice_area") == "betterment_levy":
|
||||
structure_guidance = (
|
||||
structure_guidance + " | היטל השבחה: "
|
||||
+ " ".join(PRACTICE_AREA_OVERRIDES["betterment_levy"]["discussion_rules"])
|
||||
).strip()
|
||||
|
||||
# Content checklist + methodology for block-yod
|
||||
content_checklist = ""
|
||||
|
||||
Reference in New Issue
Block a user