feat(halachot): Phase 5+6 — canonical panel UI + equivalent_halachot deprecation #300
@@ -5936,11 +5936,21 @@ def _equiv_order(a: UUID, b: UUID) -> tuple[UUID, UUID]:
|
||||
async def link_equivalent_halachot(
|
||||
a: UUID, b: UUID, *, cosine: float = 0.0, note: str = "", created_by: str = "",
|
||||
) -> bool:
|
||||
"""Record that two halachot (different precedents) state the same principle.
|
||||
"""[DEPRECATED since V41] Record a parallel-authority link in equivalent_halachot.
|
||||
|
||||
The canonical_halachot model (V41) supersedes this table — cross-precedent
|
||||
equivalence is now expressed via halachot.canonical_id. This function is kept
|
||||
for historical callers only; no new code should call it. Use
|
||||
``create_canonical_halacha`` + ``nearest_canonical_halacha`` instead.
|
||||
|
||||
Idempotent (symmetric UNIQUE). Returns False and does nothing if a == b or
|
||||
the two belong to the SAME precedent (parallel authority is cross-precedent
|
||||
by definition; within-precedent sameness is the dedup/cluster concern)."""
|
||||
the two belong to the SAME precedent."""
|
||||
import warnings
|
||||
warnings.warn(
|
||||
"link_equivalent_halachot is deprecated since V41 (canonical_halachot). "
|
||||
"Use create_canonical_halacha / nearest_canonical_halacha instead.",
|
||||
DeprecationWarning, stacklevel=2,
|
||||
)
|
||||
if a == b:
|
||||
return False
|
||||
pool = await get_pool()
|
||||
|
||||
@@ -93,20 +93,20 @@ async def main(args: argparse.Namespace) -> int:
|
||||
w.writerows(pairs)
|
||||
print(f"\nreport: {out}", flush=True)
|
||||
|
||||
if args.link and pairs:
|
||||
# #84.2 — record each pair as parallel authority (equivalent_halachot).
|
||||
# Non-destructive: links only, never merges/deletes. Idempotent.
|
||||
linked = 0
|
||||
for p in pairs:
|
||||
if await db.link_equivalent_halachot(
|
||||
p["id_a"], p["id_b"], cosine=p["cosine"],
|
||||
note="cross-precedent parallel authority (halacha_batch_reconcile)",
|
||||
created_by="batch_reconcile",
|
||||
):
|
||||
linked += 1
|
||||
print(f"linked {linked}/{len(pairs)} pairs as equivalent_halachot", flush=True)
|
||||
elif pairs:
|
||||
print("(review-only — pass --link to record them as equivalent_halachot)", flush=True)
|
||||
if args.link:
|
||||
# V41 (canonical_halachot): equivalent_halachot is FROZEN — no new links.
|
||||
# Use backfill_canonical_halachot.py --apply instead.
|
||||
print(
|
||||
"\nERROR: --link is deprecated since V41 (canonical_halachot model).\n"
|
||||
" equivalent_halachot is read-only and frozen post-backfill.\n"
|
||||
" Cross-precedent dedup is now handled by the canonical model:\n"
|
||||
" mcp-server/.venv/bin/python scripts/backfill_canonical_halachot.py --apply\n"
|
||||
" Exiting without writing any links.",
|
||||
flush=True,
|
||||
)
|
||||
return 1
|
||||
if pairs:
|
||||
print("(review-only — pair report saved above)", flush=True)
|
||||
return 0
|
||||
|
||||
|
||||
@@ -118,6 +118,6 @@ if __name__ == "__main__":
|
||||
ap.add_argument("--include-pending", action="store_true",
|
||||
help="also scan pending_review halachot (default: approved/published only)")
|
||||
ap.add_argument("--link", action="store_true",
|
||||
help="record found pairs as equivalent_halachot (parallel authority, #84.2)")
|
||||
help="[DEPRECATED since V41] refused at runtime — use backfill_canonical_halachot.py")
|
||||
args = ap.parse_args()
|
||||
sys.exit(asyncio.run(main(args)))
|
||||
|
||||
Reference in New Issue
Block a user