{
  "schema_version": "backup_restore_drill_approval_package_template_v1",
  "generated_at": "2026-06-05T05:36:00+08:00",
  "source_refs": [
    "docs/evaluations/backup_dr_target_inventory_2026-06-04.json",
    "docs/evaluations/backup_dr_readiness_matrix_2026-06-04.json",
    "docs/evaluations/backup_notification_policy_2026-06-04.json",
    "docs/ai/AI_AGENT_AUTOMATION_WORKLIST_2026-06-04.md",
    "docs/HARD_RULES.md"
  ],
  "program_status": {
    "overall_completion_percent": 100,
    "current_priority": "P1",
    "current_task_id": "P1-105",
    "next_task_id": "P1-106",
    "read_only_mode": true
  },
  "rollups": {
    "total_templates": 6,
    "by_domain": {
      "database_restore": 1,
      "configuration_restore": 1,
      "credential_escrow": 1,
      "k8s_resource_restore": 1,
      "observability_restore": 1,
      "route_reconstruction": 1
    },
    "template_ready_ids": [
      "database_restore_drill_approval_package",
      "configuration_restore_approval_package",
      "credential_escrow_review_package",
      "velero_k8s_restore_drill_package",
      "observability_restore_drill_package",
      "public_route_reconstruction_package"
    ],
    "hitl_required_template_ids": [
      "database_restore_drill_approval_package",
      "configuration_restore_approval_package",
      "credential_escrow_review_package",
      "velero_k8s_restore_drill_package",
      "observability_restore_drill_package",
      "public_route_reconstruction_package"
    ],
    "blocked_source_target_ids": [
      "configs_capture",
      "credential_escrow_markers"
    ],
    "action_required_source_target_ids": [
      "signoz",
      "velero_k8s_resources"
    ]
  },
  "approval_fields": [
    {
      "field_id": "operator_and_window",
      "required": true,
      "description": "列出人工 operator、維護窗口、時區、通訊負責人與批准到期時間。"
    },
    {
      "field_id": "source_backup_ref",
      "required": true,
      "description": "列出備份來源、快照 ID、freshness、integrity 與 offsite 狀態；不得輸出 secret 或 credential 明文。"
    },
    {
      "field_id": "target_environment",
      "required": true,
      "description": "列出演練目標環境、隔離邊界、資料遮罩策略與不得碰觸的 production surface。"
    },
    {
      "field_id": "blast_radius",
      "required": true,
      "description": "列出受影響服務、資料、路由、通知、監控與回滾責任。"
    },
    {
      "field_id": "precheck_evidence",
      "required": true,
      "description": "列出 backup freshness、integrity、offsite、credential escrow、restore dry-run plan 與 observer readiness。"
    },
    {
      "field_id": "abort_and_rollback",
      "required": true,
      "description": "列出演練中止條件、回復步驟、驗證指標與復原後觀察期。"
    },
    {
      "field_id": "post_verification",
      "required": true,
      "description": "列出復原後 smoke、資料一致性、告警靜音恢復、Run / LOGBOOK / evidence 更新。"
    },
    {
      "field_id": "manual_approval",
      "required": true,
      "description": "列出 OpenClaw 仲裁、HITL、資料 owner、credential owner 與必要的維護窗口批准。"
    }
  ],
  "package_templates": [
    {
      "template_id": "database_restore_drill_approval_package",
      "domain": "database_restore",
      "status": "template_ready",
      "owner_agent": "openclaw",
      "purpose": "為 Gitea、AWOOOI PostgreSQL、momo PostgreSQL 與 Langfuse 類資料庫建立 restore drill 批准包，不執行 restore。",
      "source_target_statuses": [
        {
          "target_id": "gitea",
          "readiness": "ready"
        },
        {
          "target_id": "awoooi_postgresql_daily",
          "readiness": "ready"
        },
        {
          "target_id": "momo_postgresql",
          "readiness": "ready"
        },
        {
          "target_id": "langfuse_postgresql",
          "readiness": "ready"
        }
      ],
      "required_evidence": [
        "docs/evaluations/backup_dr_target_inventory_2026-06-04.json",
        "docs/evaluations/backup_dr_readiness_matrix_2026-06-04.json",
        "scripts/backup/backup-gitea.sh",
        "scripts/backup/backup-momo-188-pg.sh"
      ],
      "required_decisions": [
        "是否允許在隔離環境執行資料庫 restore drill",
        "是否需要遮罩資料或改用 sanitized backup",
        "是否需要資料 owner 與維護窗口共同批准"
      ],
      "required_prechecks": [
        "確認 backup freshness 與 integrity evidence 未過期",
        "確認 restore 目標環境與 production database 完全隔離",
        "確認通知政策仍為 failure/action-required escalation"
      ],
      "required_tests": [
        "restore plan schema validation",
        "post-restore smoke checklist",
        "data consistency checklist",
        "rollback evidence checklist"
      ],
      "rollback_requirements": [
        "列出刪除隔離演練環境與保留 evidence 的步驟",
        "列出生產環境未受影響的 verification evidence"
      ],
      "abort_criteria": [
        "backup freshness 或 integrity 失效",
        "目標環境指向 production",
        "operator 無法確認資料遮罩或隔離邊界"
      ],
      "manual_approvals": [
        "OpenClaw arbitration",
        "database owner review",
        "HITL approval"
      ],
      "prohibited_without_approval": [
        "database restore",
        "production connection string use",
        "credential plaintext export",
        "backup execution",
        "schedule change"
      ],
      "evidence_refs": [
        "docs/evaluations/backup_dr_readiness_matrix_2026-06-04.json",
        "docs/evaluations/backup_notification_policy_2026-06-04.json"
      ]
    },
    {
      "template_id": "configuration_restore_approval_package",
      "domain": "configuration_restore",
      "status": "template_ready",
      "owner_agent": "hermes",
      "purpose": "為設定、公開路由與 config capture 缺口建立 restore 批准包；configs_capture blocked 時只能提交修復批准，不可演練 restore。",
      "source_target_statuses": [
        {
          "target_id": "configs_capture",
          "readiness": "blocked"
        },
        {
          "target_id": "public_routes",
          "readiness": "ready"
        }
      ],
      "required_evidence": [
        "docs/evaluations/backup_dr_target_inventory_2026-06-04.json",
        "scripts/backup/backup-public-routes.sh",
        "docs/runbooks/OFFSITE-BACKUP-ESCROW-RUNBOOK.md"
      ],
      "required_decisions": [
        "configs_capture blocked 是否先轉成修復批准包",
        "公開路由重建是否只允許在 staging 或隔離環境驗證",
        "設定來源權威與 owner 是否已確認"
      ],
      "required_prechecks": [
        "確認 config snapshot 不含 secret 明文",
        "確認路由重建計畫不改 production ingress 或 DNS",
        "確認 blocked target 不被標為可 restore"
      ],
      "required_tests": [
        "config diff review",
        "route reconstruction dry plan review",
        "secret redaction checklist"
      ],
      "rollback_requirements": [
        "列出 config restore revert patch",
        "列出 route backup 與現況比對方式"
      ],
      "abort_criteria": [
        "config evidence 含 secret 明文",
        "source authority 未確認",
        "restore target 需要 production 寫入"
      ],
      "manual_approvals": [
        "OpenClaw arbitration",
        "configuration owner review",
        "HITL approval"
      ],
      "prohibited_without_approval": [
        "config write",
        "workflow write",
        "production ingress change",
        "DNS change",
        "輸出 secret 明文"
      ],
      "evidence_refs": [
        "docs/evaluations/backup_dr_target_inventory_2026-06-04.json"
      ]
    },
    {
      "template_id": "credential_escrow_review_package",
      "domain": "credential_escrow",
      "status": "template_ready",
      "owner_agent": "openclaw",
      "purpose": "為 credential escrow marker blocked 狀態建立人工 review 批准包；模板不寫 marker、不讀 secret、不輸出 credential。",
      "source_target_statuses": [
        {
          "target_id": "credential_escrow_markers",
          "readiness": "blocked"
        }
      ],
      "required_evidence": [
        "docs/evaluations/backup_dr_target_inventory_2026-06-04.json",
        "docs/evaluations/backup_dr_readiness_matrix_2026-06-04.json",
        "docs/runbooks/OFFSITE-BACKUP-ESCROW-RUNBOOK.md"
      ],
      "required_decisions": [
        "credential owner 是否確認 escrow marker 來源與保管流程",
        "是否允許建立或更新 redacted marker",
        "是否需要安全負責人與資料 owner 共同批准"
      ],
      "required_prechecks": [
        "確認批准包不得含 token、private key、cookie、authorization header 或 runner token",
        "確認 marker 更新若被批准也必須走獨立執行流程",
        "確認 blocked 狀態不被 UI 或 API 解讀為 ready"
      ],
      "required_tests": [
        "secret redaction checklist",
        "escrow owner checklist",
        "approval payload schema validation"
      ],
      "rollback_requirements": [
        "列出 marker 變更若被批准後的 audit trail 與 revert plan",
        "列出 marker 缺失時的人工 break-glass 聯絡方式"
      ],
      "abort_criteria": [
        "批准包含 credential 明文",
        "credential owner 未確認",
        "嘗試由 Agent 自動寫 marker"
      ],
      "manual_approvals": [
        "OpenClaw arbitration",
        "credential owner review",
        "security owner review",
        "HITL approval"
      ],
      "prohibited_without_approval": [
        "credential marker write",
        "secret read",
        "匯出 secret 明文",
        "break-glass activation",
        "Telegram test notification"
      ],
      "evidence_refs": [
        "docs/evaluations/backup_dr_readiness_matrix_2026-06-04.json",
        "docs/HARD_RULES.md"
      ]
    },
    {
      "template_id": "velero_k8s_restore_drill_package",
      "domain": "k8s_resource_restore",
      "status": "template_ready",
      "owner_agent": "openclaw",
      "purpose": "為 Velero / K8s resource restore drill 建立批准包；velero_k8s_resources 仍為 action_required 時只能提交補證據與演練計畫。",
      "source_target_statuses": [
        {
          "target_id": "velero_k8s_resources",
          "readiness": "action_required"
        },
        {
          "target_id": "harbor_registry",
          "readiness": "ready"
        }
      ],
      "required_evidence": [
        "docs/evaluations/backup_dr_readiness_matrix_2026-06-04.json",
        "k8s/awoooi-prod/",
        "docs/runbooks/OFFSITE-BACKUP-ESCROW-RUNBOOK.md"
      ],
      "required_decisions": [
        "是否允許在非 production namespace 執行 K8s resource restore drill",
        "是否需要先補 Velero backup evidence",
        "是否允許 Harbor registry backup 作為 image restore 證據"
      ],
      "required_prechecks": [
        "確認 namespace、service account、ingress 與 secret 不會指向 production",
        "確認 restore dry plan 只用隔離資源",
        "確認 action_required target 補 evidence 後才可升級"
      ],
      "required_tests": [
        "kubectl dry plan review",
        "namespace isolation checklist",
        "post-restore workload health checklist"
      ],
      "rollback_requirements": [
        "列出刪除演練 namespace 與資源的步驟",
        "列出不影響 production service / ingress 的驗證"
      ],
      "abort_criteria": [
        "restore plan 指向 production namespace",
        "manifest 包含未遮罩 secret",
        "Velero evidence 仍為 action_required 且未被人工接受"
      ],
      "manual_approvals": [
        "OpenClaw arbitration",
        "platform owner review",
        "HITL approval"
      ],
      "prohibited_without_approval": [
        "kubectl apply",
        "velero restore",
        "namespace mutation",
        "secret restore",
        "production routing change"
      ],
      "evidence_refs": [
        "docs/evaluations/backup_dr_readiness_matrix_2026-06-04.json"
      ]
    },
    {
      "template_id": "observability_restore_drill_package",
      "domain": "observability_restore",
      "status": "template_ready",
      "owner_agent": "hermes",
      "purpose": "為 SigNoz / ClickHouse、Prometheus 與 Alertmanager 可觀測性 restore drill 建立批准包；SignOz disruptive guard 必須保留。",
      "source_target_statuses": [
        {
          "target_id": "signoz",
          "readiness": "action_required"
        },
        {
          "target_id": "prometheus_alertmanager",
          "readiness": "ready"
        }
      ],
      "required_evidence": [
        "docs/evaluations/backup_dr_readiness_matrix_2026-06-04.json",
        "docs/evaluations/backup_notification_policy_2026-06-04.json",
        "ops/monitoring/",
        "k8s/monitoring/"
      ],
      "required_decisions": [
        "是否允許 disruptive backup guard 覆蓋的服務進入演練",
        "restore drill 是否需要暫時調整告警靜音與通知策略",
        "Prometheus / Alertmanager evidence 是否足以支持復原驗證"
      ],
      "required_prechecks": [
        "確認 SignOz disruptive guard 已被 operator 看見並接受",
        "確認成功訊息不即時洗版",
        "確認 failure / action-required 仍會升級"
      ],
      "required_tests": [
        "metrics readback checklist",
        "alert route readback checklist",
        "notification suppression checklist"
      ],
      "rollback_requirements": [
        "列出恢復原告警靜音與通知政策的步驟",
        "列出演練後 metrics / alert route readback"
      ],
      "abort_criteria": [
        "演練需要停止 production collector 且未批准",
        "通知政策會發送成功洗版訊息",
        "observer 無法驗證 restore 結果"
      ],
      "manual_approvals": [
        "OpenClaw arbitration",
        "observability owner review",
        "HITL approval"
      ],
      "prohibited_without_approval": [
        "collector stop",
        "ClickHouse restore",
        "Alertmanager route write",
        "Telegram test notification",
        "schedule change"
      ],
      "evidence_refs": [
        "docs/evaluations/backup_notification_policy_2026-06-04.json"
      ]
    },
    {
      "template_id": "public_route_reconstruction_package",
      "domain": "route_reconstruction",
      "status": "template_ready",
      "owner_agent": "openclaw",
      "purpose": "為公開路由、Ingress、Nginx 備份與 DNS 重建建立批准包；模板不改生產路由。",
      "source_target_statuses": [
        {
          "target_id": "public_routes",
          "readiness": "ready"
        }
      ],
      "required_evidence": [
        "scripts/backup/backup-public-routes.sh",
        "docs/evaluations/backup_dr_target_inventory_2026-06-04.json",
        "docs/evaluations/backup_dr_readiness_matrix_2026-06-04.json"
      ],
      "required_decisions": [
        "是否允許在 staging 或 isolated host 重建公開路由",
        "是否需要 DNS / TLS / ingress owner review",
        "是否需要 production traffic freeze window"
      ],
      "required_prechecks": [
        "確認重建目標不接 production traffic",
        "確認 TLS / DNS evidence 不含 private key",
        "確認回滾與 readback 指標已列出"
      ],
      "required_tests": [
        "route diff review",
        "TLS public certificate readback checklist",
        "HTTP smoke checklist",
        "production no-change checklist"
      ],
      "rollback_requirements": [
        "列出路由設定 revert patch",
        "列出 DNS / ingress / Nginx readback 與保留 evidence"
      ],
      "abort_criteria": [
        "計畫會改 production route",
        "TLS private key 或 secret 明文進入批准包",
        "缺少可驗證回滾點"
      ],
      "manual_approvals": [
        "OpenClaw arbitration",
        "route owner review",
        "HITL approval"
      ],
      "prohibited_without_approval": [
        "production routing change",
        "DNS change",
        "TLS private key export",
        "Nginx config write",
        "workflow write"
      ],
      "evidence_refs": [
        "docs/evaluations/backup_dr_target_inventory_2026-06-04.json"
      ]
    }
  ],
  "decision_gate_contract": {
    "openclaw_role": "仲裁 restore drill、escrow review、route reconstruction 與 action-required target 是否可進下一關。",
    "hermes_role": "彙整 runbook、evidence、operator checklist、LOGBOOK 與批准包文字。",
    "nemotron_role": "只可離線檢查 sanitized 演練計畫完整性，不得接觸 production、secret、shadow/canary 或執行權。",
    "hitl_required": true,
    "expires_after": "7 days or any source backup/readiness snapshot change",
    "invalidated_by": [
      "backup freshness evidence expired",
      "readiness matrix changed",
      "credential escrow blocker changed",
      "production topology changed",
      "manual approval window expired"
    ]
  },
  "operation_boundaries": {
    "read_only_template_allowed": true,
    "backup_execution_allowed": false,
    "restore_execution_allowed": false,
    "offsite_sync_execution_allowed": false,
    "credential_marker_write_allowed": false,
    "schedule_change_allowed": false,
    "workflow_write_allowed": false,
    "telegram_test_notification_allowed": false,
    "destructive_prune_allowed": false,
    "secret_plaintext_allowed": false,
    "production_routing_allowed": false,
    "sdk_installation_allowed": false,
    "paid_api_call_allowed": false,
    "shadow_or_canary_allowed": false
  },
  "approval_boundaries": {
    "sdk_installation_allowed": false,
    "paid_api_call_allowed": false,
    "shadow_or_canary_allowed": false,
    "production_routing_allowed": false,
    "destructive_operation_allowed": false,
    "restore_execution_allowed": false,
    "offsite_sync_execution_allowed": false,
    "credential_marker_write_allowed": false
  }
}
