fix(reboot): expose windows99 verify collection packet
All checks were successful
CD Pipeline / workflow-shape (push) Successful in 0s
CD Pipeline / cancel-stale-cd (push) Has been skipped
CD Pipeline / tests (push) Successful in 59s
CD Pipeline / build-and-deploy (push) Successful in 4m50s
CD Pipeline / post-deploy-checks (push) Successful in 1m49s

This commit is contained in:
ogt
2026-07-02 15:07:55 +08:00
parent 8fbb7756a6
commit 6813710d04
6 changed files with 332 additions and 4 deletions

View File

@@ -91,6 +91,10 @@ def _build_payload(scorecard: dict[str, Any], path: Path) -> dict[str, Any]:
active_blockers=active_blockers,
)
)
windows99_verify_collection = _build_windows99_verify_collection_packet(
windows99=windows99,
host_boot_detection=host_boot_detection,
)
blocked_by_fresh_reboot_window_only = active_blockers == [
"host_boot_observation_older_than_target_window"
]
@@ -180,6 +184,19 @@ def _build_payload(scorecard: dict[str, Any], path: Path) -> dict[str, Any]:
"windows99_vmware_powered_off_count": len(
_strings(windows99.get("powered_off_aliases"))
),
"windows99_verify_collection_status": windows99_verify_collection["status"],
"windows99_verify_collection_can_collect_no_secret": (
windows99_verify_collection["can_collect_no_secret_verify"] is True
),
"windows99_verify_collection_blocker_count": len(
_strings(windows99_verify_collection.get("collection_blockers"))
),
"windows99_host99_reachable": (
windows99_verify_collection["host99_reachable"] is True
),
"windows99_host99_uptime_known": (
windows99_verify_collection["host99_uptime_known"] is True
),
}
return {
"schema_version": _API_SCHEMA_VERSION,
@@ -250,6 +267,12 @@ def _build_payload(scorecard: dict[str, Any], path: Path) -> dict[str, Any]:
"windows99_update_no_auto_reboot_ready": rollups[
"windows99_update_no_auto_reboot_ready"
],
"windows99_verify_collection_status": rollups[
"windows99_verify_collection_status"
],
"windows99_verify_collection_can_collect_no_secret": rollups[
"windows99_verify_collection_can_collect_no_secret"
],
},
"reboot_sop_progress": sop_progress,
"controlled_service_data_backup_readback": (
@@ -259,6 +282,7 @@ def _build_payload(scorecard: dict[str, Any], path: Path) -> dict[str, Any]:
"post_reboot_readiness": post_reboot_readiness,
"stockplatform_data_freshness": stockplatform,
"windows99_vmware_autostart": windows99,
"windows99_verify_collection": windows99_verify_collection,
"source_controls": source_controls,
"active_blockers": active_blockers,
"required_checks": required_checks,
@@ -382,6 +406,98 @@ def _build_controlled_service_data_backup_readback(
}
def _build_windows99_verify_collection_packet(
*,
windows99: dict[str, Any],
host_boot_detection: dict[str, Any],
) -> dict[str, Any]:
host99 = _host_row_by_alias(host_boot_detection, "99")
host99_reachable = host99.get("reachable") is True
host99_uptime_known = bool(host99) and _int(host99.get("uptime_seconds")) >= 0
readback_present = windows99.get("readback_present") is True
verify_ready = windows99.get("verify_ready") is True
collection_blockers: list[str] = []
if not host99_reachable:
collection_blockers.append("windows99_host_not_reachable_for_verify_collection")
if not readback_present:
collection_blockers.append("windows99_vmware_autostart_readback_missing")
for blocker in _strings(windows99.get("blockers")):
if blocker not in collection_blockers:
collection_blockers.append(blocker)
if not host99_uptime_known:
collection_blockers.append("windows99_uptime_unknown")
return {
"schema_version": "windows99_vmware_verify_collection_packet_v1",
"status": (
"ready_windows99_vmware_verify_readback_green"
if verify_ready
else (
"blocked_windows99_verify_output_missing_host_reachable"
if host99_reachable and not readback_present
else "blocked_windows99_verify_collection_not_ready"
)
),
"target_host_alias": "99",
"target_host": "192.168.0.99",
"host99_reachable": host99_reachable,
"host99_uptime_known": host99_uptime_known,
"readback_present": readback_present,
"verify_ready": verify_ready,
"can_collect_no_secret_verify": host99_reachable and not verify_ready,
"required_vm_aliases": _strings(windows99.get("required_vm_aliases"))
or ["111", "112", "120", "121", "188"],
"expected_no_secret_output_fields": [
"VMRUN_PRESENT",
"VMX alias=<alias> present=<0|1>",
"VMWARE_SERVICE name=<name> ok=<0|1>",
"VMWARE_AUTOSTART_TASK name=AWOOOI-Start-VMware-VMs ok=<0|1>",
"WINDOWS_UPDATE_POLICY name=<name> ok=<0|1>",
"VM_POWER alias=<alias> running=<0|1>",
"VMWARE_AUTOSTART_CONFIG_READY",
"VMWARE_AUTOSTART_POWER_READY",
"WINDOWS_UPDATE_NO_AUTO_REBOOT_READY",
"VMWARE_AUTOSTART_VERIFY_READY",
],
"no_secret_verify_command": (
"powershell -ExecutionPolicy Bypass -File "
".\\windows99-vmware-autostart.ps1 -Mode Verify"
),
"post_verifier": (
"rerun_reboot_auto_recovery_slo_scorecard_with_"
"windows99_vmware_file_no_secret_no_reboot"
),
"collection_blockers": collection_blockers,
"safe_collection_channels": [
"authorized_windows99_console_verify_stdout_only",
"existing_management_channel_verify_mode_only",
"committed_no_secret_artifact_file_then_scorecard_rerun",
],
"forbidden_actions": [
"windows_password_or_secret_collection",
"host_reboot",
"vm_power_change",
"windows_update_policy_apply",
"manual_registry_edit",
"service_restart",
"github_api",
],
}
def _host_row_by_alias(
host_boot_detection: dict[str, Any],
alias: str,
) -> dict[str, Any]:
rows = host_boot_detection.get("host_rows")
if not isinstance(rows, list):
return {}
for item in rows:
if isinstance(item, dict) and str(item.get("alias") or "") == alias:
return item
return {}
def _build_reboot_sop_progress(
*,
scorecard: dict[str, Any],