feat(operations): manual burst control for the halacha drain + permanent supervisor (backend) #235
Reference in New Issue
Block a user
Delete Branch "worktree-halacha-burst-ops"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
מה ולמה
ה-backend לבקרת burst ידנית של דריינר חילוץ-ההלכות, הניתנת לניהול אינטראקטיבי מ-/operations: היו"ר מפעיל "רוץ ברצף עכשיו" עד מועד נבחר (ברירת-מחדל שבת 18:00 הקרובה, שעון ישראל) או עוצר קודם. בנוסף — המתזמר הקבוע (
legal-halacha-supervisor) שאוכף זאת ומנהל את בריאות הדריינר הלילי השוטף.הרקע: ניצול שארית-המכסה השבועית של Claude לעבודה על ה-backlog (היה 196 תיקים) על-פי דרישה, בלי לבזבז מכסה על ניטור (המתזמר = אפס צריכת-Claude).
שינויים (PR זה — backend בלבד)
SCHEMA_V37):drain_controls.burst_until+set_drain_burst/get_drain_burst/get_drain_bursts. מקור-אמת יחיד המשותף ל-API (קונטיינר) ולמתזמר (מארח).POST /api/operations/drains/{name}/burst(on→until|שבת-18:00,off→NULL) +burst_untilב-snapshot של /operations לכל שירות.halacha_drain_supervisor.py+legal-halacha-supervisor.config.cjs— pm2 cron (*/15, אפס Claude): מצית דריינר בטל · restart ל-run תקוע (liveness לפי checkpoints-per-chunk, לא mtime-לוג שמתעדכן רק בסיום תיק ~10 דק') · backoff ב-429 עד האיפוס (מגודר-טריות) · מאמת staging. קוראburst_untilמה-DB; ה-burst פג-תוקף אוטומטי במועד (לא דולף לשבוע חדש).UI — PR נפרד (אחרי שער Claude Design)
ה-toggle + בורר-מועד ב-/operations שקורא ל-endpoint — ייבנה רק אחרי אישור-עיצוב של חיים (כלל-הברזל).
Invariants
drain_controlsהקיים; מתזמר את הדריינר הקיים, לא יוצר חדש.בדיקות
py_compile נקי על db.py/app.py/supervisor.py ·
node --checkעל ה-config · המתזמר נבדק חי על המארח (מצב ביניים file-based) — מזהה rate-limit/תקיעה/staging נכון. אחרי merge: deploy Coolify מריץ SCHEMA_V37, ואז החלפת המתזמר ל-DB-based + re-point pm2.🤖 Generated with Claude Code
The halacha-extraction backlog needs to be worked off the chair's leftover weekly Claude quota on demand. This adds a MANUAL, time-boxed "burst" — run the drain continuously now until a chosen deadline (default the upcoming Saturday 18:00 IL), managed interactively from /operations — plus the permanent health-supervisor that enforces it. Backend (this PR; deploys via Coolify + host pm2): - db: drain_controls.burst_until (SCHEMA_V37) + set_drain_burst/get_drain_burst/ get_drain_bursts. Single source of truth shared by the container-side /operations API and the host-side supervisor. - web: POST /api/operations/drains/{name}/burst (on→until|next-Sat-18:00, off→NULL), and burst_until surfaced per-service in the /operations snapshot. - scripts/halacha_drain_supervisor.py + legal-halacha-supervisor.config.cjs: pm2 cron (*/15, zero Claude quota) — re-triggers idle drain, restarts a HUNG run (liveness = per-chunk checkpoints, NOT log mtime), backs off on 429 until the parsed reset (fresh-gated), verifies crash-safe staging. Reads burst_until from the DB; burst auto-expires at the deadline (never bleeds into a fresh week). UI (separate follow-up PR, after Claude Design approval): the /operations toggle + date-picker that calls the burst endpoint. Invariants: G1 (normalize at source — burst lives once in the DB, read by both surfaces), G2 (no parallel control path — CAPTURE field on the existing drain_controls + orchestrates the existing drain, not a new one), G12 (no Paperclip touch), §6 (no silent error-swallow — burst-clear failure is surfaced as a note).