fix(ops): ייבוש backlog-רפאים של חילוץ-מטא — נרמול-במקור של metadata_extraction_status (G1)
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 9s
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 9s
מונה "ממתין (בקלוג)" ב-/operations הציג 140 פריטים תקועים שהדריינר (Gemini, כל 15 דק') דיווח עליהם total_pending=0 — אי-התאמה בין שתי הגדרות-תור: ה-UI סופר status='pending' (ברירת-מחדל של העמודה), בעוד הדריינר סורק רק metadata_extraction_requested_at IS NOT NULL. שורות שקיבלו מטא במסלול אחר (internal דטרמיניסטי, cited_only חסר-טקסט) נשארו על ברירת-המחדל 'pending' לנצח. פילוח ה-140: 82 internal_committee (מטא דטרמיניסטי, מחוץ לצנרת-Gemini) · 31 cited_only (אין טקסט לחלץ) · 27 external_upload (כבר מלאים). תיקון-במקור (G1 — נרמול במקור, לא תיקון-בקריאה): - db.create_internal_committee_decision: INSERT + ON CONFLICT קובעים metadata_extraction_status='completed' ישירות → שורות פנימיות לא נכנסות שוב למצב-הרפאים. - scripts/reconcile_metadata_status.py: נרמול חד-פעמי/re-runnable של שורות קיימות (internal/external מלא→completed · external חסר→requeue · cited_only→skipped). הורץ: 82+27→completed, 31→skipped, pending=0. - web-ui /operations: התווית "ממתין (בקלוג)" → "ממתין" (הסרת המילה הלועזית) + tooltip מדויק; הערת operations.ts מעודכנת. Invariants: מקיים G1 (normalize-at-source) ו-INV-IA (מונה-אמת/מקור-אמת-יחיד). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3401,12 +3401,20 @@ async def create_internal_committee_decision(
|
||||
subject_tags, summary, full_text,
|
||||
source_kind, source_type, document_id,
|
||||
extraction_status, halacha_extraction_status,
|
||||
metadata_extraction_status,
|
||||
practice_area, appeal_subtype, is_binding, proceeding_type, content_hash
|
||||
) VALUES (
|
||||
$1, $2, $3, $4, $5, $6,
|
||||
$7, $8, $9,
|
||||
'internal_committee', 'appeals_committee', $10,
|
||||
'processing', 'pending',
|
||||
-- Internal committee decisions carry deterministic metadata
|
||||
-- computed from the case record (see app.py uniform-citation
|
||||
-- builder); the Gemini metadata extractor is tuned for EXTERNAL
|
||||
-- rulings and returns no_metadata for these. Settle the metadata
|
||||
-- status to 'completed' at the source so these rows never linger
|
||||
-- as phantom 'pending' backlog the drain can never clear.
|
||||
'completed',
|
||||
$11, $12, $13, $14, $15
|
||||
)
|
||||
ON CONFLICT (case_number, proceeding_type)
|
||||
@@ -3428,6 +3436,8 @@ async def create_internal_committee_decision(
|
||||
document_id = COALESCE(EXCLUDED.document_id, case_law.document_id),
|
||||
extraction_status = 'processing',
|
||||
halacha_extraction_status = 'pending',
|
||||
-- Keep metadata settled on re-upsert (deterministic, never Gemini).
|
||||
metadata_extraction_status = 'completed',
|
||||
content_hash = EXCLUDED.content_hash
|
||||
RETURNING *
|
||||
""",
|
||||
|
||||
Reference in New Issue
Block a user