# -*- coding: utf-8 -*- """Native-confirm gate (drill F-11; alert added v0.126.4) — native confirm()/prompt()/alert() dialogs are OS-modals that block browser automation (CDP freezes) and are banned from the UI; consequential actions use the inline felhomConfirm helper (layout.html) or the .confirm-overlay dialog; error/info surfaces use showAlert (layout.html modal). alert() joined the ban after the 0.87.0 wizard leg: a decommission error path alert() froze the automation exactly like F-11 predicted (the operator had to click the OS-modal away). Run from controller/: python scripts/native_confirm_gate.py Exit 1 if any native confirm(/prompt(/alert( call remains in the templates. """ import io, os, re, sys ROOTS = [ os.path.join("internal", "web", "templates"), os.path.join("internal", "setup", "templates"), ] # A bare confirm(/prompt(/alert( CALL with an argument: not preceded by an identifier character, # so felhomConfirm(, showAlert( and onRestoreConfirmChange( never match. window.confirm( / # window.alert( still match ('.' is not an identifier character). NATIVE = re.compile(r"(?