feat(halachot): Phase 6 — deprecate equivalent_halachot writes post-V41
- halacha_batch_reconcile.py --link now exits with error (V41 freezes equivalent_halachot; equivalences live in canonical_id instead) - link_equivalent_halachot emits DeprecationWarning (callers ≥ Python 3.2) - SCRIPTS.md already marks --link as deprecated; no further doc change needed Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5936,11 +5936,21 @@ def _equiv_order(a: UUID, b: UUID) -> tuple[UUID, UUID]:
|
|||||||
async def link_equivalent_halachot(
|
async def link_equivalent_halachot(
|
||||||
a: UUID, b: UUID, *, cosine: float = 0.0, note: str = "", created_by: str = "",
|
a: UUID, b: UUID, *, cosine: float = 0.0, note: str = "", created_by: str = "",
|
||||||
) -> bool:
|
) -> 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
|
Idempotent (symmetric UNIQUE). Returns False and does nothing if a == b or
|
||||||
the two belong to the SAME precedent (parallel authority is cross-precedent
|
the two belong to the SAME precedent."""
|
||||||
by definition; within-precedent sameness is the dedup/cluster concern)."""
|
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:
|
if a == b:
|
||||||
return False
|
return False
|
||||||
pool = await get_pool()
|
pool = await get_pool()
|
||||||
|
|||||||
@@ -93,20 +93,20 @@ async def main(args: argparse.Namespace) -> int:
|
|||||||
w.writerows(pairs)
|
w.writerows(pairs)
|
||||||
print(f"\nreport: {out}", flush=True)
|
print(f"\nreport: {out}", flush=True)
|
||||||
|
|
||||||
if args.link and pairs:
|
if args.link:
|
||||||
# #84.2 — record each pair as parallel authority (equivalent_halachot).
|
# V41 (canonical_halachot): equivalent_halachot is FROZEN — no new links.
|
||||||
# Non-destructive: links only, never merges/deletes. Idempotent.
|
# Use backfill_canonical_halachot.py --apply instead.
|
||||||
linked = 0
|
print(
|
||||||
for p in pairs:
|
"\nERROR: --link is deprecated since V41 (canonical_halachot model).\n"
|
||||||
if await db.link_equivalent_halachot(
|
" equivalent_halachot is read-only and frozen post-backfill.\n"
|
||||||
p["id_a"], p["id_b"], cosine=p["cosine"],
|
" Cross-precedent dedup is now handled by the canonical model:\n"
|
||||||
note="cross-precedent parallel authority (halacha_batch_reconcile)",
|
" mcp-server/.venv/bin/python scripts/backfill_canonical_halachot.py --apply\n"
|
||||||
created_by="batch_reconcile",
|
" Exiting without writing any links.",
|
||||||
):
|
flush=True,
|
||||||
linked += 1
|
)
|
||||||
print(f"linked {linked}/{len(pairs)} pairs as equivalent_halachot", flush=True)
|
return 1
|
||||||
elif pairs:
|
if pairs:
|
||||||
print("(review-only — pass --link to record them as equivalent_halachot)", flush=True)
|
print("(review-only — pair report saved above)", flush=True)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
@@ -118,6 +118,6 @@ if __name__ == "__main__":
|
|||||||
ap.add_argument("--include-pending", action="store_true",
|
ap.add_argument("--include-pending", action="store_true",
|
||||||
help="also scan pending_review halachot (default: approved/published only)")
|
help="also scan pending_review halachot (default: approved/published only)")
|
||||||
ap.add_argument("--link", action="store_true",
|
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()
|
args = ap.parse_args()
|
||||||
sys.exit(asyncio.run(main(args)))
|
sys.exit(asyncio.run(main(args)))
|
||||||
|
|||||||
Reference in New Issue
Block a user