feat(mcp): FU-14 GAP-45 — extraction_status (חשיפת תור-החילוץ הסמוי)
INV-TOOL4 (visibility / persistence). תור בקשות-החילוץ (metadata/halacha) נשמר
ב-case_law.{metadata,halacha}_extraction_requested_at ומרוקן ע"י
precedent_process_pending — אבל לא היה כלי לראות את עומק-התור.
נוסף:
- db.extraction_queue_status() — count + גיל הבקשה הוותיקה לכל kind (read-only).
- plib.extraction_status() — tool wrapper (envelope _ok/_err).
- רישום extraction_status ב-server.py ליד precedent_process_pending.
- precedent_process_pending קיבל _clamp_limit (עקביות עם GAP-53).
תוספתי, read-only, אפס שבירה. עודכנו X9 (INV-TOOL4 ✅) ו-gap-audit (GAP-45 ✅).
py_compile עבר על 3 קבצי הקוד.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4332,6 +4332,31 @@ async def list_pending_extraction_requests(
|
||||
return out
|
||||
|
||||
|
||||
async def extraction_queue_status() -> dict:
|
||||
"""Pending-extraction queue depth per kind (INV-TOOL4 visibility / GAP-45).
|
||||
|
||||
Surfaces the otherwise-hidden queue that ``process_pending_extractions``
|
||||
drains: how many case_law rows still carry a metadata/halacha extraction
|
||||
request, and the age of the oldest one. Read-only — does not drain.
|
||||
"""
|
||||
pool = await get_pool()
|
||||
async with pool.acquire() as conn:
|
||||
meta = await conn.fetchrow(
|
||||
"SELECT COUNT(*) AS n, MIN(metadata_extraction_requested_at) AS oldest "
|
||||
"FROM case_law WHERE metadata_extraction_requested_at IS NOT NULL"
|
||||
)
|
||||
hal = await conn.fetchrow(
|
||||
"SELECT COUNT(*) AS n, MIN(halacha_extraction_requested_at) AS oldest "
|
||||
"FROM case_law WHERE halacha_extraction_requested_at IS NOT NULL"
|
||||
)
|
||||
|
||||
def _fmt(r: dict) -> dict:
|
||||
oldest = r["oldest"]
|
||||
return {"pending": r["n"], "oldest_request": oldest.isoformat() if oldest else None}
|
||||
|
||||
return {"metadata": _fmt(meta), "halacha": _fmt(hal)}
|
||||
|
||||
|
||||
async def clear_extraction_request(
|
||||
case_law_id: UUID, kind: str = "metadata",
|
||||
) -> None:
|
||||
|
||||
Reference in New Issue
Block a user