feat(corroboration): approval_action decision fn + kill-switch (INV-COR2/COR4, X11 Phase 2)

- HALACHA_CORROBORATION_AUTO_APPROVE config (default ON, Dafna validated 2026-06-01)
- approval_action(agg, has_overruled): overruled→demote, corroborated→approve, else None
- 4 offline unit tests; Phase 2 plan + TaskMaster #75

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-01 04:34:23 +00:00
parent 391b025e8a
commit df007784c9
5 changed files with 385 additions and 3 deletions

View File

@@ -52,6 +52,22 @@ def aggregate(links: list[dict], min_cites: int = config.HALACHA_CORROBORATION_M
}
def approval_action(agg: dict, has_overruled: bool) -> str | None:
"""Decide the corroboration→approval action for ONE halacha (INV-COR2/COR4).
- 'demote' : a later court overruled it → back to the chair gate (overruled
outranks any positive count, INV-COR2 strong form).
- 'approve' : corroborated (≥N distinct positives, 0 negatives — INV-COR4).
- None : leave as-is (single source, non-overruled negative, or the
uncorroborated tail — INV-COR5 keeps the chair gate).
"""
if has_overruled:
return "demote"
if agg.get("corroborated"):
return "approve"
return None
_TREATMENT_PROMPT = """אתה משפטן בכיר. נתון ציטוט של פסק/החלטה קודמים בתוך החלטה מאוחרת.
סווג כיצד ההחלטה המאוחרת **מטפלת** בתקדים המצוטט, לפי אחת מהקטגוריות:
- followed — אימצה והחילה את ההלכה.