fix(api): expose reboot slo safe next step
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Failing after 17s
CD Pipeline / build-and-deploy (push) Has been skipped
CD Pipeline / post-deploy-checks (push) Has been skipped
Some checks failed
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Failing after 17s
CD Pipeline / build-and-deploy (push) Has been skipped
CD Pipeline / post-deploy-checks (push) Has been skipped
This commit is contained in:
@@ -62,18 +62,24 @@ def _build_payload(scorecard: dict[str, Any], path: Path) -> dict[str, Any]:
|
||||
completed_check_count / max(len(required_checks), 1) * 100
|
||||
)
|
||||
recovery_gate = _dict(stockplatform.get("controlled_recovery_gate"))
|
||||
safe_next_step = str(scorecard.get("safe_next_step") or "")
|
||||
can_claim_slo = (
|
||||
scorecard.get("can_claim_all_services_recovered_within_target") is True
|
||||
)
|
||||
return {
|
||||
"schema_version": _API_SCHEMA_VERSION,
|
||||
"generated_at": str(scorecard.get("generated_at") or ""),
|
||||
"priority": "P0-006",
|
||||
"scope": "reboot_auto_recovery_slo_scorecard",
|
||||
"status": str(scorecard.get("status") or "unknown"),
|
||||
"safe_next_step": safe_next_step,
|
||||
"can_claim_all_services_recovered_within_target": can_claim_slo,
|
||||
"readback": {
|
||||
"workplan_id": "P0-006",
|
||||
"workplan_title": "主機重啟自動偵測、自動觸發與 10 分鐘恢復 SLO",
|
||||
"source_scorecard_ref": f"docs/operations/{path.name}",
|
||||
"target_minutes": _int(scorecard.get("target_minutes")),
|
||||
"safe_next_step": str(scorecard.get("safe_next_step") or ""),
|
||||
"safe_next_step": safe_next_step,
|
||||
},
|
||||
"host_boot_detection": host_boot_detection,
|
||||
"post_reboot_readiness": post_reboot_readiness,
|
||||
@@ -85,10 +91,7 @@ def _build_payload(scorecard: dict[str, Any], path: Path) -> dict[str, Any]:
|
||||
"readiness_percent": readiness_percent,
|
||||
"completed_check_count": completed_check_count,
|
||||
"required_check_count": len(required_checks),
|
||||
"can_claim_all_services_recovered_within_target": scorecard.get(
|
||||
"can_claim_all_services_recovered_within_target"
|
||||
)
|
||||
is True,
|
||||
"can_claim_all_services_recovered_within_target": can_claim_slo,
|
||||
"observed_host_count": len(_strings(host_boot_detection.get("observed_hosts"))),
|
||||
"missing_host_count": len(_strings(host_boot_detection.get("missing_hosts"))),
|
||||
"unreachable_host_count": len(
|
||||
|
||||
Reference in New Issue
Block a user