feat(operations): manual burst control for the halacha drain + permanent supervisor (backend) #235

Merged
chaim merged 1 commits from worktree-halacha-burst-ops into main 2026-06-12 11:12:18 +00:00
Owner

מה ולמה

ה-backend לבקרת burst ידנית של דריינר חילוץ-ההלכות, הניתנת לניהול אינטראקטיבי מ-/operations: היו"ר מפעיל "רוץ ברצף עכשיו" עד מועד נבחר (ברירת-מחדל שבת 18:00 הקרובה, שעון ישראל) או עוצר קודם. בנוסף — המתזמר הקבוע (legal-halacha-supervisor) שאוכף זאת ומנהל את בריאות הדריינר הלילי השוטף.

הרקע: ניצול שארית-המכסה השבועית של Claude לעבודה על ה-backlog (היה 196 תיקים) על-פי דרישה, בלי לבזבז מכסה על ניטור (המתזמר = אפס צריכת-Claude).

שינויים (PR זה — backend בלבד)

  • db (SCHEMA_V37): drain_controls.burst_until + set_drain_burst/get_drain_burst/get_drain_bursts. מקור-אמת יחיד המשותף ל-API (קונטיינר) ולמתזמר (מארח).
  • web: POST /api/operations/drains/{name}/burst (on→until|שבת-18:00, off→NULL) + burst_until ב-snapshot של /operations לכל שירות.
  • scripts: 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 פג-תוקף אוטומטי במועד (לא דולף לשבוע חדש).
  • SCRIPTS.md עודכן.

UI — PR נפרד (אחרי שער Claude Design)

ה-toggle + בורר-מועד ב-/operations שקורא ל-endpoint — ייבנה רק אחרי אישור-עיצוב של חיים (כלל-הברזל).

Invariants

  • G1 — נרמול-במקור: ה-burst חי פעם אחת ב-DB, נקרא ע"י שני פני-השטח.
  • G2 — אין מסלול-בקרה מקביל: שדה-CAPTURE על drain_controls הקיים; מתזמר את הדריינר הקיים, לא יוצר חדש.
  • G12 — אין מגע-Paperclip.
  • §6 — אין בליעת-שגיאות שקטה (כשל ניקוי-burst מדווח כ-note).

בדיקות

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

## מה ולמה ה-backend לבקרת **burst ידנית** של דריינר חילוץ-ההלכות, הניתנת לניהול אינטראקטיבי מ-/operations: היו"ר מפעיל "רוץ ברצף עכשיו" עד מועד נבחר (ברירת-מחדל שבת 18:00 הקרובה, שעון ישראל) או עוצר קודם. בנוסף — המתזמר הקבוע (`legal-halacha-supervisor`) שאוכף זאת ומנהל את בריאות הדריינר הלילי השוטף. הרקע: ניצול שארית-המכסה השבועית של Claude לעבודה על ה-backlog (היה 196 תיקים) על-פי דרישה, בלי לבזבז מכסה על ניטור (המתזמר = אפס צריכת-Claude). ## שינויים (PR זה — backend בלבד) - **db** (`SCHEMA_V37`): `drain_controls.burst_until` + `set_drain_burst`/`get_drain_burst`/`get_drain_bursts`. מקור-אמת יחיד המשותף ל-API (קונטיינר) ולמתזמר (מארח). - **web**: `POST /api/operations/drains/{name}/burst` (`on`→until|שבת-18:00, `off`→NULL) + `burst_until` ב-snapshot של /operations לכל שירות. - **scripts**: `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 פג-תוקף אוטומטי במועד (לא דולף לשבוע חדש). - **SCRIPTS.md** עודכן. ## UI — PR נפרד (אחרי שער Claude Design) ה-toggle + בורר-מועד ב-/operations שקורא ל-endpoint — ייבנה רק אחרי אישור-עיצוב של חיים (כלל-הברזל). ## Invariants - **G1** — נרמול-במקור: ה-burst חי פעם אחת ב-DB, נקרא ע"י שני פני-השטח. - **G2** — אין מסלול-בקרה מקביל: שדה-CAPTURE על `drain_controls` הקיים; מתזמר את הדריינר הקיים, לא יוצר חדש. - **G12** — אין מגע-Paperclip. - **§6** — אין בליעת-שגיאות שקטה (כשל ניקוי-burst מדווח כ-note). ## בדיקות 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](https://claude.com/claude-code)
chaim added 1 commit 2026-06-12 11:11:56 +00:00
feat(operations): manual burst control for the halacha drain + permanent supervisor
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 6s
c7c402e7ef
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).
chaim merged commit d2154020c6 into main 2026-06-12 11:12:18 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ezer-mishpati/legal-ai#235