feat(missing-precedents): חיפוש-טקסט לפי מראה-מקום בדף פסיקה-חסרה
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 5s

הבעיה: בדף /missing-precedents לא ניתן היה לאתר פסיקה חסרה לפי מספר ההחלטה
החסרה עצמה (למשל 85074). השדה היחיד לחיפוש-תיק עשה get_case_by_number על
מספר ה-ערר שבו צוטטה הפסיקה — ולכן הקלדת מספר-הפסיקה החזירה רשימה ריקה,
למרות שהרשומה קיימת (ערר (ת"א 85074-04-25) ... status=open).

התיקון (הרחבת השדה הקיים, ללא עמוד/שדה חדש — בהנחיית חיים):
- db.list_missing_precedents: פרמטר q חדש — ILIKE על mp.citation +
  mp.case_name + cited-in c.case_number (אינדקס-פרמטר יחיד, additive;
  שאר הקוראים לא נוגעים).
- GET /api/missing-precedents: פרמטר q; case_id/case_number נשארים
  מסננים-מדויקים לקוראים תכנותיים.
- web-ui: התווית "תיק (מספר ערר)" → "מספר תיק", placeholder
  "85074 או 1017-03-26"; השדה שולח q (חיפוש חופשי) במקום case_number.
  Debounce 350ms נשמר.

api:types לא חודש: ה-hook בונה את ה-querystring ידנית וה-response לא
השתנה; חידוש מול prod (שעוד לא נפרס) רק היה מושך drift לא-קשור.

בדיקות: tsc --noEmit נקי, eslint נקי על הקבצים שהשתנו, py_compile נקי.

Invariants: G2 (הרחבת היכולת הקיימת, לא מסלול-חיפוש מקביל), INV-IA1
(שער/דף יחיד לפסיקה-חסרה — בלי עמוד חדש), §6 (ללא בליעת-שגיאות).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-12 07:58:29 +00:00
parent 5272ded4f7
commit b49cde7c24
5 changed files with 40 additions and 16 deletions

View File

@@ -6405,10 +6405,16 @@ async def list_missing_precedents(
status: str | None = None,
case_id: UUID | None = None,
legal_topic: str | None = None,
q: str | None = None,
limit: int = 200,
offset: int = 0,
) -> list[dict]:
"""List missing precedents, joining the cited-in case_number for display."""
"""List missing precedents, joining the cited-in case_number for display.
``q`` is a free-text term matched (ILIKE) across the gap's own מראה-מקום
(``mp.citation``), its case name, and the cited-in appeal case number — so a
chair can find a gap by the missing decision's number (e.g. ``85074``), not
only by the appeal it was cited in."""
pool = await get_pool()
conditions: list[str] = []
params: list = []
@@ -6425,6 +6431,13 @@ async def list_missing_precedents(
conditions.append(f"mp.legal_topic ILIKE ${idx}")
params.append(f"%{legal_topic}%")
idx += 1
if q:
conditions.append(
f"(mp.citation ILIKE ${idx} OR mp.case_name ILIKE ${idx} "
f"OR c.case_number ILIKE ${idx})"
)
params.append(f"%{q}%")
idx += 1
where = f"WHERE {' AND '.join(conditions)}" if conditions else ""
params.append(limit)
params.append(offset)