#!/usr/bin/env python3 """ASME clause-KB backlinks: resolve clause-id mentions in each clause doc -> clause_links. dst resolved to the clause doc of the same parent (top-level code); sub-code mention -> anchor; unresolved (cross-standard / material spec not split) -> dangling (dst_doc_id NULL). Idempotent per parent. Usage: python3 asme_backlinks_persist.py [--commit] """ import asyncio, os, re, sys MENTION_RE = re.compile(r'(?