fix(reboot): surface windows99 collector readback
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 57s
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 07:30:45 +08:00
parent 374d4e491c
commit b338a7ab54
8 changed files with 605 additions and 2 deletions

View File

@@ -3069,6 +3069,25 @@ def _enrich_from_current_readbacks(
state["windows99_verify_collection_post_verifier"] = str(
windows99_verify_collection.get("post_verifier") or ""
)
state["windows99_no_secret_collector_readback_present"] = bool(
windows99_verify_collection.get("no_secret_collector_readback_present")
is True
)
state["windows99_no_secret_collector_status"] = str(
windows99_verify_collection.get("no_secret_collector_status") or "unknown"
)
state["windows99_no_secret_collector_ssh_batchmode_auth_ready"] = bool(
windows99_verify_collection.get(
"no_secret_collector_ssh_batchmode_auth_ready"
)
is True
)
state["windows99_no_secret_collector_safe_next_step"] = str(
windows99_verify_collection.get("no_secret_collector_safe_next_step") or ""
)
state["windows99_available_collection_channels"] = _strings(
windows99_verify_collection.get("available_collection_channels")
)
state["windows99_management_readback_present"] = bool(
windows99_management.get("readback_present") is True
)
@@ -3292,6 +3311,21 @@ def _enrich_from_current_readbacks(
evidence["windows99_verify_collection_host99_uptime_known"] = bool(
windows99_verify_collection.get("host99_uptime_known") is True
)
evidence["windows99_no_secret_collector_readback_present"] = state[
"windows99_no_secret_collector_readback_present"
]
evidence["windows99_no_secret_collector_status"] = state[
"windows99_no_secret_collector_status"
]
evidence["windows99_no_secret_collector_ssh_batchmode_auth_ready"] = state[
"windows99_no_secret_collector_ssh_batchmode_auth_ready"
]
evidence["windows99_no_secret_collector_safe_next_step"] = state[
"windows99_no_secret_collector_safe_next_step"
]
evidence["windows99_available_collection_channels"] = state[
"windows99_available_collection_channels"
]
evidence["windows99_management_readback_present"] = state[
"windows99_management_readback_present"
]
@@ -3845,6 +3879,22 @@ def _set_rollups_and_summary(
"windows99_verify_collection_host99_uptime_known": (
state.get("windows99_verify_collection_host99_uptime_known") is True
),
"windows99_no_secret_collector_readback_present": (
state.get("windows99_no_secret_collector_readback_present") is True
),
"windows99_no_secret_collector_status": str(
state.get("windows99_no_secret_collector_status") or "unknown"
),
"windows99_no_secret_collector_ssh_batchmode_auth_ready": (
state.get("windows99_no_secret_collector_ssh_batchmode_auth_ready")
is True
),
"windows99_no_secret_collector_safe_next_step": str(
state.get("windows99_no_secret_collector_safe_next_step") or ""
),
"windows99_available_collection_channels": _strings(
state.get("windows99_available_collection_channels")
),
"windows99_management_readback_present": (
state.get("windows99_management_readback_present") is True
),
@@ -3943,6 +3993,22 @@ def _set_rollups_and_summary(
"windows99_verify_collection_post_verifier": str(
state.get("windows99_verify_collection_post_verifier") or ""
),
"windows99_no_secret_collector_readback_present": (
state.get("windows99_no_secret_collector_readback_present") is True
),
"windows99_no_secret_collector_status": str(
state.get("windows99_no_secret_collector_status") or "unknown"
),
"windows99_no_secret_collector_ssh_batchmode_auth_ready": (
state.get("windows99_no_secret_collector_ssh_batchmode_auth_ready")
is True
),
"windows99_no_secret_collector_safe_next_step": str(
state.get("windows99_no_secret_collector_safe_next_step") or ""
),
"windows99_available_collection_channels": _strings(
state.get("windows99_available_collection_channels")
),
"windows99_management_readback_present": (
state.get("windows99_management_readback_present") is True
),

View File

@@ -1234,6 +1234,7 @@ def _build_payload(scorecard: dict[str, Any], path: Path) -> dict[str, Any]:
windows99 = _dict(scorecard.get("windows99_vmware_autostart"))
windows99_management = _dict(scorecard.get("windows99_management_channel"))
windows99_ssh_batch = _dict(windows99_management.get("ssh_batch"))
windows99_collector = _dict(scorecard.get("windows99_vmware_verify_collector"))
source_controls = _dict(scorecard.get("source_controls"))
active_blockers = _unique_strings(
_strings(scorecard.get("active_blockers"))
@@ -1302,6 +1303,8 @@ def _build_payload(scorecard: dict[str, Any], path: Path) -> dict[str, Any]:
windows99_verify_collection = _build_windows99_verify_collection_packet(
windows99=windows99,
host_boot_detection=host_boot_detection,
windows99_management=windows99_management,
windows99_collector=windows99_collector,
)
blocked_by_fresh_reboot_window_only = active_blockers == [
"host_boot_observation_older_than_target_window"
@@ -1436,6 +1439,36 @@ def _build_payload(scorecard: dict[str, Any], path: Path) -> dict[str, Any]:
"windows99_verify_collection_blocker_count": len(
_strings(windows99_verify_collection.get("collection_blockers"))
),
"windows99_no_secret_collector_readback_present": (
windows99_verify_collection.get("no_secret_collector_readback_present")
is True
),
"windows99_no_secret_collector_status": str(
windows99_verify_collection.get("no_secret_collector_status") or "unknown"
),
"windows99_no_secret_collector_ssh_batchmode_auth_ready": (
windows99_verify_collection.get(
"no_secret_collector_ssh_batchmode_auth_ready"
)
is True
),
"windows99_no_secret_collector_port_22_open": (
windows99_verify_collection.get("no_secret_collector_port_22_open")
is True
),
"windows99_no_secret_collector_remote_verify_attempted": (
windows99_verify_collection.get(
"no_secret_collector_remote_verify_attempted"
)
is True
),
"windows99_no_secret_collector_safe_next_step": str(
windows99_verify_collection.get("no_secret_collector_safe_next_step")
or ""
),
"windows99_available_collection_channels": _strings(
windows99_verify_collection.get("available_collection_channels")
),
"windows99_host99_reachable": (
windows99_verify_collection["host99_reachable"] is True
),
@@ -1584,6 +1617,21 @@ def _build_payload(scorecard: dict[str, Any], path: Path) -> dict[str, Any]:
"windows99_verify_collection_can_collect_no_secret": rollups[
"windows99_verify_collection_can_collect_no_secret"
],
"windows99_no_secret_collector_readback_present": rollups[
"windows99_no_secret_collector_readback_present"
],
"windows99_no_secret_collector_status": rollups[
"windows99_no_secret_collector_status"
],
"windows99_no_secret_collector_ssh_batchmode_auth_ready": rollups[
"windows99_no_secret_collector_ssh_batchmode_auth_ready"
],
"windows99_no_secret_collector_safe_next_step": rollups[
"windows99_no_secret_collector_safe_next_step"
],
"windows99_available_collection_channels": rollups[
"windows99_available_collection_channels"
],
"windows99_remote_execution_channel_ready": rollups[
"windows99_remote_execution_channel_ready"
],
@@ -1605,6 +1653,7 @@ def _build_payload(scorecard: dict[str, Any], path: Path) -> dict[str, Any]:
"stockplatform_data_freshness": stockplatform,
"public_maintenance_fallback": public_maintenance,
"windows99_vmware_autostart": windows99,
"windows99_vmware_verify_collector": windows99_collector,
"windows99_verify_collection": windows99_verify_collection,
"windows99_management_channel": windows99_management,
"source_controls": source_controls,
@@ -1794,12 +1843,26 @@ def _build_windows99_verify_collection_packet(
*,
windows99: dict[str, Any],
host_boot_detection: dict[str, Any],
windows99_management: dict[str, Any] | None = None,
windows99_collector: dict[str, Any] | None = None,
) -> dict[str, Any]:
windows99_management = windows99_management or {}
windows99_collector = windows99_collector or {}
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
local_console_reachable = (
windows99_management.get("local_console_channel_reachable") is True
)
console_channels = _strings(windows99_management.get("console_collection_channels"))
collector_present = windows99_collector.get("readback_present") is True
collector_status = str(windows99_collector.get("status") or "unknown")
collector_ssh_ready = (
windows99_collector.get("ssh_batchmode_auth_ready") is True
or collector_status == "collected_windows99_vmware_verify_stdout"
)
collection_blockers: list[str] = []
if not host99_reachable:
collection_blockers.append("windows99_host_not_reachable_for_verify_collection")
@@ -1808,8 +1871,19 @@ def _build_windows99_verify_collection_packet(
for blocker in _strings(windows99.get("blockers")):
if blocker not in collection_blockers:
collection_blockers.append(blocker)
for blocker in _strings(windows99_collector.get("blockers")):
if blocker not in collection_blockers:
collection_blockers.append(blocker)
if not host99_uptime_known:
collection_blockers.append("windows99_uptime_unknown")
available_channels: list[str] = []
if local_console_reachable:
available_channels.extend(console_channels or ["local_console"])
if collector_ssh_ready:
available_channels.append("no_secret_ssh_batchmode_verify_collector")
if readback_present:
available_channels.append("committed_no_secret_artifact_file")
available_channels = _unique_strings(available_channels)
return {
"schema_version": "windows99_vmware_verify_collection_packet_v1",
@@ -1828,7 +1902,29 @@ def _build_windows99_verify_collection_packet(
"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,
"can_collect_no_secret_verify": (
host99_reachable
and not verify_ready
and (
local_console_reachable
or collector_ssh_ready
or not collector_present
)
),
"available_collection_channels": available_channels,
"no_secret_collector_readback_present": collector_present,
"no_secret_collector_status": collector_status,
"no_secret_collector_safe_next_step": str(
windows99_collector.get("safe_next_step") or ""
),
"no_secret_collector_ssh_batchmode_auth_ready": collector_ssh_ready,
"no_secret_collector_port_22_open": (
windows99_collector.get("port_22_open") is True
),
"no_secret_collector_remote_verify_attempted": (
windows99_collector.get("remote_verify_attempted") is True
),
"no_secret_collector": windows99_collector,
"required_vm_aliases": _strings(windows99.get("required_vm_aliases"))
or ["111", "112", "120", "121", "188"],
"expected_no_secret_output_fields": [