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:
2026-06-19 05:37:07 +00:00
parent 1f9268356e
commit 75f40cc778
2 changed files with 28 additions and 18 deletions

View File

@@ -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)))