"""Small, fail-closed downstream changes for the pinned upstream source.
Run only inside the disposable build context, from the upstream checkout root.
Upstream changes must be re-reviewed rather than silently patched by regex.
"""
from pathlib import Path
def replace(path, old, new):
file = Path(path)
text = file.read_text()
if text.count(old) != 1:
raise SystemExit(f"Upstream contract changed: {path}: {old[:70]!r}")
file.write_text(text.replace(old, new))
replace('app/index.html', ' ',
' \n ')
replace('app/index.html', '