fix(reboot): promote collected windows99 runtime 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) Successful in 58s
CD Pipeline / post-deploy-checks (push) Has been cancelled
CD Pipeline / build-and-deploy (push) Has been cancelled

This commit is contained in:
Your Name
2026-07-03 10:23:53 +08:00
parent 81cb38cc27
commit 647d811631
3 changed files with 116 additions and 1 deletions

View File

@@ -103,6 +103,15 @@ _WINDOWS99_COLLECTOR_BLOCKERS_BY_STATUS = {
"blocked_remote_verify_output_invalid": "windows99_remote_verify_output_invalid",
"blocked_remote_verify_command_failed": "windows99_remote_verify_command_failed",
}
_WINDOWS99_COLLECTED_VERIFY_STATUS = "collected_windows99_vmware_verify_stdout"
_WINDOWS99_MISSING_VMX_NEXT_SAFE_ACTION = (
"restore_windows99_missing_vmx_source_for_aliases_then_rerun_no_secret_"
"collector_and_scorecard_no_vm_power_change"
)
_WINDOWS99_POWERED_OFF_NEXT_SAFE_ACTION = (
"build_windows99_vmware_autostart_check_mode_package_for_powered_off_aliases_"
"then_rerun_no_secret_collector_no_vm_power_change"
)
def load_latest_reboot_auto_recovery_slo_scorecard(
@@ -1054,8 +1063,12 @@ def _apply_prometheus_metric_active_blockers(
primary_blocker=primary_blocker,
)
primary_action = _dict(action_matrix.get("primary_blocker_action"))
runtime_next_safe_action = _windows99_collected_runtime_next_safe_action(
metric_readback
)
next_safe_action = str(
primary_action.get("next_safe_action")
runtime_next_safe_action
or primary_action.get("next_safe_action")
or _dict(payload.get("reboot_sop_progress")).get("next_safe_action")
or payload.get("next_safe_action")
or ""
@@ -1066,6 +1079,8 @@ def _apply_prometheus_metric_active_blockers(
payload["primary_blocker"] = primary_blocker
payload["current_phase"] = current_phase
payload["eta_or_wait_reason"] = eta_or_wait_reason
if runtime_next_safe_action:
payload["safe_next_step"] = runtime_next_safe_action
payload["next_safe_action"] = next_safe_action
payload["can_claim_all_services_recovered_within_target"] = can_claim_slo
payload["blocked_by_fresh_reboot_window_only"] = active_blockers == [
@@ -1098,6 +1113,7 @@ def _apply_prometheus_metric_active_blockers(
"telegram_active_blocker_alert_required_count": action_matrix[
"telegram_alert_required_count"
],
"safe_next_step": payload.get("safe_next_step", ""),
"next_safe_action": next_safe_action,
"blocked_by_fresh_reboot_window_only": payload[
"blocked_by_fresh_reboot_window_only"
@@ -1129,6 +1145,28 @@ def _apply_prometheus_metric_active_blockers(
)
def _windows99_collected_runtime_next_safe_action(
metric_readback: dict[str, Any],
) -> str:
if metric_readback.get("readback_present") is not True:
return ""
if (
metric_readback.get("windows99_no_secret_collector_readback_present")
is not True
):
return ""
if (
str(metric_readback.get("windows99_no_secret_collector_status") or "")
!= _WINDOWS99_COLLECTED_VERIFY_STATUS
):
return ""
if _strings(metric_readback.get("windows99_missing_vmx_aliases")):
return _WINDOWS99_MISSING_VMX_NEXT_SAFE_ACTION
if _strings(metric_readback.get("windows99_powered_off_aliases")):
return _WINDOWS99_POWERED_OFF_NEXT_SAFE_ACTION
return ""
def _path_from_env(name: str) -> Path | None:
value = os.environ.get(name, "").strip()
return Path(value) if value else None
@@ -2565,6 +2603,10 @@ def _active_blocker_action_row(
"restore_windows99_no_secret_management_channel_or_collect_local_"
"console_verify_readback_then_rerun_reboot_scorecard_no_reboot"
)
elif blocker == "windows99_vmware_vmx_missing":
next_safe_action = _WINDOWS99_MISSING_VMX_NEXT_SAFE_ACTION
elif blocker == "windows99_vmware_guest_power_not_ready":
next_safe_action = _WINDOWS99_POWERED_OFF_NEXT_SAFE_ACTION
elif blocker in {
"windows99_console_clipboard_unreliable",
"windows99_console_focus_unreliable",