feat(missing-precedents): bridge cited-by-chair + decision number; open/closed tabs; single-line citation
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 4s
Lint — undefined names / undefined-names (pull_request) Successful in 11s

Implements the chair-approved redesign of /missing-precedents (Claude Design
card 09). The "צוטט ע״י" and "תיק" columns were empty for ~98% of rows because
the corpus-decision reliance lives in precedent_internal_citations (keyed to
case_law), a different system than missing_precedents (keyed to cases).

Backend (G2 — read-time bridge, no stored duplication):
- list_missing_precedents: new cited_by_chairs / cited_by_decisions columns,
  resolved from the citation graph by normalized docket number (same
  normalization the relinker uses). For an open gap cited by committee
  decisions, surfaces the chair(s) (e.g. דפנה תמיר) + the deciding case numbers.

Frontend (matches approved mockup):
- "צוטט ע״י" shows the chair chip (bridge) with priority over the generic
  discovery-source chips; "תיק" shows the deciding decision number(s) + "+N".
- Status filter reduced to פתוח / נסגר (removed הועלה, לא-רלוונטי, הכל).
- "פסיקה" column collapses to a single line when case_name is empty — fixes the
  duplicated-citation two-row rendering.
- Lifecycle note simplified to open → closed.

Verified: bridge SQL returns chair+decisions on live data; tsc --noEmit clean;
py_compile clean.

Follow-up (data, separate): LLM backfill of legal_topic (נושא); create
missing_precedents rows for the 28 graph-cited rulings not yet tracked.

Invariants: G2 (single source of truth — bridge derived at read, no duplicated
column) · INV-AH context (closing source gaps).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-20 12:28:38 +00:00
parent 086913ce8d
commit a18ed8ffb7
4 changed files with 86 additions and 15 deletions

View File

@@ -7915,7 +7915,33 @@ _MP_PROVENANCE_COLS = """,
WHERE pic.cited_case_law_id = mp.linked_case_law_id
AND COALESCE(src.case_number, '') <> ''
) AS cited_by_precedents,
substring(mp.notes from 'מס''?\\s*([0-9]+)') AS yomon_number"""
substring(mp.notes from 'מס''?\\s*([0-9]+)') AS yomon_number,
-- Bridge to the corpus citation graph (G2: read-time, no stored
-- duplication). For an OPEN gap (no linked_case_law_id yet) find
-- which committee DECISIONS cite this ruling, matched on the
-- normalized docket number (same normalization the relinker uses:
-- strip to digits/dashes, slash->dash). Surfaces "צוטט ע\"י <יו\"ר>"
-- + the deciding case number in the UI.
(SELECT array_agg(DISTINCT src.chair_name ORDER BY src.chair_name)
FROM precedent_internal_citations picc
JOIN case_law src ON src.id = picc.source_case_law_id
AND src.source_kind = 'internal_committee'
WHERE split_part(mp.citation_norm, '|', 2) <> ''
AND regexp_replace(replace(picc.cited_case_number, '/', '-'),
'[^0-9-]', '', 'g')
= split_part(mp.citation_norm, '|', 2)
AND COALESCE(src.chair_name, '') <> ''
) AS cited_by_chairs,
(SELECT array_agg(DISTINCT src.case_number ORDER BY src.case_number)
FROM precedent_internal_citations picd
JOIN case_law src ON src.id = picd.source_case_law_id
AND src.source_kind = 'internal_committee'
WHERE split_part(mp.citation_norm, '|', 2) <> ''
AND regexp_replace(replace(picd.cited_case_number, '/', '-'),
'[^0-9-]', '', 'g')
= split_part(mp.citation_norm, '|', 2)
AND COALESCE(src.case_number, '') <> ''
) AS cited_by_decisions"""
async def list_missing_precedents(