{
  "evidence_id": "D22_LEASE_HEARTBEAT_RESUME_2026-09-15",
  "task": "[2.4] lease, heartbeat and resume",
  "result": "PASS",
  "verified_at": "2026-09-15",
  "implementation": {
    "file": "/mnt/ssd_projects/apps/mathchast_editor/app/save_internet_core.py",
    "lease": "Exclusive lease.json created with O_EXCL; a second executor cannot acquire the same job.",
    "heartbeat": "Active worker refreshes heartbeat_at and lease_expires_at during control checks.",
    "fencing": "Worker token is checked before heartbeat and release; a stale worker raises LeaseLost and stops.",
    "resume": "Existing status based resume remains available for paused, waiting_network, browser_required and failed jobs.",
    "state_version": "Every atomic job state write increments state_version."
  },
  "deployment": {
    "service": "mathchast-editor-api.service",
    "service_status": "active",
    "api_health": "ok; dispatcher_alive=true",
    "backup": "/mnt/ssd_projects/apps/mathchast_editor/app/save_internet_core.py.pre-lease-20260915"
  },
  "tests": {
    "command": "python -m unittest /tmp/test_d22_runtime.py -v",
    "server2_result": "3 tests passed",
    "cases": [
      "exhausted D22 network events require browser",
      "only one executor acquires a lease and heartbeat advances state_version",
      "expired lease is reclaimed"
    ],
    "compile": "server2 py_compile passed"
  },
  "rollback": "Restore the recorded pre-lease backup and restart mathchast-editor-api.service; preserve job state and receipts."
}
