Files
legal-ai/mcp-server/tests/test_principles_terminology.py
Chaim 4ca907b97f
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 4s
Lint — undefined names / undefined-names (pull_request) Successful in 11s
feat(principles): retroactive cull (Phase C) + source-derived terminology (Phase D, #152)
Phase C — scripts/cull_principles.py: re-adjudicates every existing 'original'
principle with the SAME panel regime (panel_keep_score → classify → apply_cap),
reversible (CSV backup + rejected canonical recoverable), usage-throttled.
panel_extraction.panel_keep_score + apply_cap (shared, G2). Dry-run on 3
decisions: 37→15 survive.

Phase D — services/principles.py: source-derived label הלכה (binding court) /
כלל פרשני (committee) / עיקרון (persuasive); umbrella עקרונות משפטיים. Wired into
canonical_halacha_get/list (principle_class+principle_label). UI string changes
deferred to the Claude Design gate. spec INV-LRN7; SCRIPTS.md; 7 new tests; 428 green.

Phase E needs no new code — synthesis already targets pending_synthesis, which the
cull leaves only on survivors (rejected canonicals → 'rejected').

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 11:14:59 +00:00

28 lines
1.1 KiB
Python

"""Terminology mapping — הלכה / כלל פרשני / עיקרון by source (#152, Phase D)."""
from __future__ import annotations
from legal_mcp.services import principles as pr
def test_binding_higher_court_is_halacha():
assert pr.label("external_upload", True) == "הלכה"
assert pr.principle_class("external_upload", True) == pr.CLASS_HALACHA
def test_committee_is_interpretive_rule():
# the appeals committee applies law — never makes a הלכה
assert pr.label("internal_committee", True) == "כלל פרשני"
assert pr.label("internal_committee", False) == "כלל פרשני"
assert pr.principle_class("internal_committee", False) == pr.CLASS_INTERPRETIVE_RULE
def test_non_binding_external_is_principle():
assert pr.label("external_upload", False) == "עיקרון"
assert pr.label(None, None) == "עיקרון"
def test_label_for_class_roundtrip():
for sk, binding in [("external_upload", True), ("internal_committee", False), (None, False)]:
cls = pr.principle_class(sk, binding)
assert pr.label_for_class(cls) == pr.label(sk, binding)