"""n8n — pre-op seed hooks (Phase 1e HC3). The orchestrator runs these BEFORE the op; the matching test_.py asserts post-op (assertion-only). n8n state lives in the persistent /home/node/.n8n volume (sqlite + config); the marker there is read back via exec_in_app (not HTTP-served).""" import os import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..", "runner")) from harness import lifecycle # noqa: E402 MARKER = "/home/node/.n8n/ci-marker.txt" def _write(domain, val): lifecycle.exec_in_app(domain, ["sh", "-c", f"echo {val} > {MARKER}"]) def pre_upgrade(domain, meta): _write(domain, "upgrade-survives") def pre_backup(domain, meta): _write(domain, "original") def pre_restore(domain, meta): _write(domain, "mutated") # diverge so a successful restore is observable