feat(web-ui): expose citation-corroboration badge on halachot (X11)

- db.list_halachot: aggregate corroboration_count (distinct positive sources)
  + corroboration_negative from halacha_citation_corroboration (LEFT JOIN)
- web-ui: CorroborationBadge — 'מתוקף · N ציטוטים' at ≥2 (gold), soft single
  citation, danger badge on negative treatment; native title tooltips
- shown in ExtractedHalachotSection (per-precedent) + halacha review panel

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-01 05:04:31 +00:00
parent 9f2adc4dd0
commit f46bf47d5b
5 changed files with 75 additions and 1 deletions

View File

@@ -3406,9 +3406,23 @@ async def list_halachot(
h.cites, h.confidence, h.quote_verified, h.review_status,
h.reviewer, h.reviewed_at, h.created_at, h.updated_at,
cl.case_number, cl.case_name, cl.court, cl.date AS decision_date,
cl.precedent_level
cl.precedent_level,
COALESCE(cor.corroboration_count, 0)::int AS corroboration_count,
COALESCE(cor.corroboration_negative, false) AS corroboration_negative
FROM halachot h
LEFT JOIN case_law cl ON cl.id = h.case_law_id
LEFT JOIN (
SELECT halacha_id,
count(DISTINCT COALESCE(citing_case_law_id::text,
citing_decision_id::text, source_citation_id::text))
FILTER (WHERE treatment IN ('followed','explained'))
AS corroboration_count,
bool_or(treatment IN
('distinguished','criticized','questioned','overruled'))
AS corroboration_negative
FROM halacha_citation_corroboration
GROUP BY halacha_id
) cor ON cor.halacha_id = h.id
{where_sql}
ORDER BY h.case_law_id, h.halacha_index
LIMIT ${idx} OFFSET ${idx + 1}