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