Files
felhom.eu/scripts/hub_confirm_gate.py
T
admin 970616b72b
gates / gates (push) Failing after 11m41s
New apps 2026-10-10: Grocy and LubeLogger on the website; Monica stopped
The catalogue side is app-catalog-felhom.eu b7f0f7c. Here: the evidence, the
website, the register and the operator's view.

Website
- Two cards in the Otthon & Eletmod / Home & Lifestyle section of BOTH apps
  pages, with assets: grocy-logo.svg is grocy's own icon with its single fill
  made white like the other logos, lubelogger-logo.png is the app's own icon
  with its dark background dropped and the mark made white (the rule
  SparkyFitness's PNG follows), and six screenshots of each app's own UI with a
  household's own data, taken headless on the bench from the published template.
- The app count moved 56 -> 58 in 15 places per language set, both languages,
  and the open-source tile 49 -> 51. Checked by asking the same patterns for the
  new number afterwards. marketing/facebook/COPY.md still says 56 and is NOT
  changed: the post it carries is already scheduled.

Evidence
- documentation/audits/new-apps-2026-10-10/ — FIT.md (checklist group 0 for all
  three, with the Hungarian-UI column), the bench and box transcripts, the
  memory samples, the screenshots and the gate runs.

Register: 137 -> 139 rows, 2 opened, 0 closed.
- R-926 after a remove-keeping-backups and restore, nobody has checked what the
  app page shows for an after_install app's generated password. Measured here:
  LubeLogger is safe (its login is derived from the environment at every start,
  the new password signs in, the data is back); grocy's install password still
  signs in from the restored database but the deployed environment no longer
  carries ADMIN_PASSWORD at all. Seven apps are in the class.
- R-927 Monica, stopped at checklist 0.2 with the measurements, waiting on the
  operator.

Gate scripts: the same console trap in nineteen of them and in repo_gates.py
itself, where it ABORTED THE WHOLE RUNNER at the first gate — printing a
non-ASCII character on this workstation's cp1250 console raised
UnicodeEncodeError before the gate had decided anything, and reuse_refs_check.py
died while printing a NOTE. All now reconfigure their own streams. Red-proof
that the remaining script-test failures are not mine: test_due_checks_gate.py
fails the same 5 of 42 with the change reverted.
2026-10-10 12:34:05 +02:00

64 lines
2.8 KiB
Python

# -*- coding: utf-8 -*-
"""Hub native-confirm gate (take-two F-16, the hub sibling of drill F-11) — native confirm()/
prompt() dialogs are OS-modals that freeze browser automation (CDP) and are banned from the hub
UI; consequential buttons use the inline felhomConfirm helper (templates/inline_confirm.html).
The danger-zone typed-confirm flow does not use native dialogs either.
Run from the repo root: python scripts/hub_confirm_gate.py
Exit 1 if any native confirm(/prompt( call remains in hub templates.
"""
import io, os, re, sys
# A gate's own console must not decide its verdict. These scripts quote back Hungarian copy, file
# paths and arrow characters; a Windows console here is cp1250, and printing one of them raised
# UnicodeEncodeError *before the gate had decided anything* — reuse_refs_check.py died while printing
# a NOTE, which the runner then reported as a failure (2026-10-10). Same trap class as
# poster_facts_gate.py's, which was found by its own red-proof.
for _stream in (sys.stdout, sys.stderr):
try:
_stream.reconfigure(encoding="utf-8", errors="replace")
except (AttributeError, ValueError, OSError): # pragma: no cover - old Python, or a pipe
pass
ROOT = os.path.join("hub", "internal", "web", "templates")
# A bare confirm(/prompt( CALL with an argument: not preceded by an identifier character, so felhomConfirm(
# never matches. window.confirm( still matches ('.' is not an identifier char).
NATIVE = re.compile(r"(?<![A-Za-z0-9_$])(?:confirm|prompt)\(\s*[^)\s]")
def templates():
"""Every .html under ROOT, AT ANY DEPTH.
Was `os.listdir(ROOT)`, which is one level only. There are no subdirectories today, so the gate
was green and correct — and would have stayed green the moment anyone added `templates/partials/`,
which is an ordinary thing to do. Measured 2026-09-01 by planting a template with a native
`confirm()` in a new `partials/` directory: the gate passed it (AUDIT-gate-decoys, R-421).
"""
out = []
for dirpath, _dirs, names in os.walk(ROOT):
for fn in sorted(names):
if fn.endswith(".html"):
out.append(os.path.join(dirpath, fn))
return sorted(out)
def main():
total = 0
for path in templates():
rel = os.path.relpath(path, ROOT)
for lineno, line in enumerate(io.open(path, encoding="utf-8"), 1):
if NATIVE.search(line):
total += 1
print("%s:%d %s" % (rel, lineno, line.strip()[:120].encode('ascii', 'backslashreplace').decode()))
if total:
print("HUB CONFIRM GATE FAILED: %d native confirm()/prompt() call(s) remain" % total)
sys.exit(1)
print("hub confirm gate OK — no native confirm()/prompt() in hub templates (%d scanned, any depth)"
% len(templates()))
if __name__ == "__main__":
main()