#!/usr/bin/env python3 """Regenerate app.databus._generated.provider_chains. Phase 3B of AUDIT-2026-Q3.md. The generated file is checked into git so dev installs work offline. Re-run this script only when the chain topology changes (new data type, new provider, etc.). """ from pathlib import Path SOURCE = Path("app/databus/provider_chains.py") TARGET = Path("app/databus/_generated/provider_chains.py") def main(): TARGET.parent.mkdir(parents=True, exist_ok=True) content = SOURCE.read_text() header = ( '"""\n' "AUTO-GENERATED by scripts/generate_provider_chains.py - DO NOT EDIT.\n" "\n" "Phase 3B of AUDIT-2026-Q3.md.\n" "Source: app/databus/provider_chains.py (legacy shim).\n" '"""\n' ) body = content.split('"""', 2)[2] if '"""' in content else content TARGET.write_text(header + body) print("wrote {} ({} bytes)".format(TARGET, TARGET.stat().st_size)) if __name__ == "__main__": main()