fix(reboot): expose public maintenance fallback in api scorecard
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 37s
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 37s
CD Pipeline / build-and-deploy (push) Has been skipped
CD Pipeline / post-deploy-checks (push) Has been skipped
This commit is contained in:
@@ -173,11 +173,17 @@ def _build_payload(scorecard: dict[str, Any], path: Path) -> dict[str, Any]:
|
||||
host_boot_detection = _dict(scorecard.get("host_boot_detection"))
|
||||
post_reboot_readiness = _dict(scorecard.get("post_reboot_readiness"))
|
||||
stockplatform = _dict(scorecard.get("stockplatform_data_freshness"))
|
||||
public_maintenance = _build_public_maintenance_fallback_readback(
|
||||
scorecard.get("public_maintenance_fallback")
|
||||
)
|
||||
windows99 = _dict(scorecard.get("windows99_vmware_autostart"))
|
||||
windows99_management = _dict(scorecard.get("windows99_management_channel"))
|
||||
windows99_ssh_batch = _dict(windows99_management.get("ssh_batch"))
|
||||
source_controls = _dict(scorecard.get("source_controls"))
|
||||
active_blockers = _strings(scorecard.get("active_blockers"))
|
||||
active_blockers = _unique_strings(
|
||||
_strings(scorecard.get("active_blockers"))
|
||||
+ _strings(public_maintenance.get("blockers"))
|
||||
)
|
||||
required_checks = {
|
||||
"source_controls_present": all(source_controls.values()),
|
||||
"required_hosts_observed": not _strings(host_boot_detection.get("missing_hosts")),
|
||||
@@ -196,6 +202,9 @@ def _build_payload(scorecard: dict[str, Any], path: Path) -> dict[str, Any]:
|
||||
"host_188_service_green": post_reboot_readiness.get("host_188_service_green") is True,
|
||||
"stockplatform_freshness_ok": stockplatform.get("freshness_status") == "ok",
|
||||
"stockplatform_ingestion_ok": stockplatform.get("ingestion_status") in {"ok", "unknown"},
|
||||
"public_maintenance_fallback_runtime_ready": (
|
||||
public_maintenance.get("ready") is True
|
||||
),
|
||||
"fresh_reboot_window_observed": not _strings(host_boot_detection.get("stale_hosts")),
|
||||
"can_claim_slo": scorecard.get("can_claim_all_services_recovered_within_target")
|
||||
is True,
|
||||
@@ -291,6 +300,23 @@ def _build_payload(scorecard: dict[str, Any], path: Path) -> dict[str, Any]:
|
||||
"required"
|
||||
)
|
||||
is True,
|
||||
"public_maintenance_runtime_readback_present": (
|
||||
public_maintenance.get("runtime_readback_present") is True
|
||||
),
|
||||
"public_maintenance_fallback_ready": (
|
||||
public_maintenance.get("ready") is True
|
||||
),
|
||||
"public_route_raw_5xx_without_fallback_count": _int(
|
||||
public_maintenance.get("raw_5xx_without_fallback_count")
|
||||
),
|
||||
"public_route_unreachable_without_external_fallback_count": _int(
|
||||
public_maintenance.get(
|
||||
"route_unreachable_without_external_fallback_count"
|
||||
)
|
||||
),
|
||||
"public_maintenance_fallback_route_count": _int(
|
||||
public_maintenance.get("maintenance_fallback_route_count")
|
||||
),
|
||||
"controlled_service_data_backup_readback_present": (
|
||||
controlled_service_data_backup_readback["readback_present"] is True
|
||||
),
|
||||
@@ -438,6 +464,15 @@ def _build_payload(scorecard: dict[str, Any], path: Path) -> dict[str, Any]:
|
||||
"readiness_percent": readiness_percent,
|
||||
"blocked_by_fresh_reboot_window_only": blocked_by_fresh_reboot_window_only,
|
||||
"latest_verify_only_metric_present": latest_verify_only_metric_present,
|
||||
"public_maintenance_runtime_readback_present": rollups[
|
||||
"public_maintenance_runtime_readback_present"
|
||||
],
|
||||
"public_maintenance_fallback_ready": rollups[
|
||||
"public_maintenance_fallback_ready"
|
||||
],
|
||||
"public_route_raw_5xx_without_fallback_count": rollups[
|
||||
"public_route_raw_5xx_without_fallback_count"
|
||||
],
|
||||
"controlled_service_data_backup_readback_status": rollups[
|
||||
"controlled_service_data_backup_readback_status"
|
||||
],
|
||||
@@ -477,6 +512,7 @@ def _build_payload(scorecard: dict[str, Any], path: Path) -> dict[str, Any]:
|
||||
"host_boot_detection": host_boot_detection,
|
||||
"post_reboot_readiness": post_reboot_readiness,
|
||||
"stockplatform_data_freshness": stockplatform,
|
||||
"public_maintenance_fallback": public_maintenance,
|
||||
"windows99_vmware_autostart": windows99,
|
||||
"windows99_verify_collection": windows99_verify_collection,
|
||||
"windows99_management_channel": windows99_management,
|
||||
@@ -499,6 +535,66 @@ def _build_payload(scorecard: dict[str, Any], path: Path) -> dict[str, Any]:
|
||||
}
|
||||
|
||||
|
||||
def _build_public_maintenance_fallback_readback(value: Any) -> dict[str, Any]:
|
||||
public_maintenance = _dict(value)
|
||||
if not public_maintenance:
|
||||
return {
|
||||
"runtime_readback_present": False,
|
||||
"ready": False,
|
||||
"target_url_count": 0,
|
||||
"route_count": 0,
|
||||
"raw_5xx_without_fallback_count": 0,
|
||||
"route_unreachable_without_external_fallback_count": 0,
|
||||
"maintenance_fallback_route_count": 0,
|
||||
"raw_5xx_without_fallback_urls": [],
|
||||
"route_unreachable_without_external_fallback_urls": [],
|
||||
"maintenance_fallback_urls": [],
|
||||
"routes": [],
|
||||
"blockers": ["public_maintenance_fallback_runtime_readback_missing"],
|
||||
}
|
||||
|
||||
raw_5xx_count = _int(public_maintenance.get("raw_5xx_without_fallback_count"))
|
||||
unreachable_count = _int(
|
||||
public_maintenance.get("route_unreachable_without_external_fallback_count")
|
||||
)
|
||||
blockers = _strings(public_maintenance.get("blockers"))
|
||||
if (
|
||||
raw_5xx_count
|
||||
and "public_route_raw_5xx_without_maintenance_fallback" not in blockers
|
||||
):
|
||||
blockers.append("public_route_raw_5xx_without_maintenance_fallback")
|
||||
if (
|
||||
unreachable_count
|
||||
and "public_route_unreachable_without_external_l1_fallback" not in blockers
|
||||
):
|
||||
blockers.append("public_route_unreachable_without_external_l1_fallback")
|
||||
|
||||
return {
|
||||
"runtime_readback_present": True,
|
||||
"schema_version": str(public_maintenance.get("schema_version") or "unknown"),
|
||||
"generated_at": str(public_maintenance.get("generated_at") or ""),
|
||||
"ready": public_maintenance.get("ready") is True and not blockers,
|
||||
"target_url_count": _int(public_maintenance.get("target_url_count")),
|
||||
"route_count": _int(public_maintenance.get("route_count")),
|
||||
"raw_5xx_without_fallback_count": raw_5xx_count,
|
||||
"route_unreachable_without_external_fallback_count": unreachable_count,
|
||||
"maintenance_fallback_route_count": _int(
|
||||
public_maintenance.get("maintenance_fallback_route_count")
|
||||
),
|
||||
"raw_5xx_without_fallback_urls": _strings(
|
||||
public_maintenance.get("raw_5xx_without_fallback_urls")
|
||||
),
|
||||
"route_unreachable_without_external_fallback_urls": _strings(
|
||||
public_maintenance.get("route_unreachable_without_external_fallback_urls")
|
||||
),
|
||||
"maintenance_fallback_urls": _strings(
|
||||
public_maintenance.get("maintenance_fallback_urls")
|
||||
),
|
||||
"routes": _list_of_dicts(public_maintenance.get("routes")),
|
||||
"blockers": _unique_strings(blockers),
|
||||
}
|
||||
|
||||
|
||||
def _build_controlled_service_data_backup_readback(
|
||||
*,
|
||||
post_reboot_readiness: dict[str, Any],
|
||||
@@ -893,6 +989,12 @@ def _strings(value: Any) -> list[str]:
|
||||
return [str(item) for item in value if item is not None]
|
||||
|
||||
|
||||
def _list_of_dicts(value: Any) -> list[dict[str, Any]]:
|
||||
if not isinstance(value, list):
|
||||
return []
|
||||
return [item for item in value if isinstance(item, dict)]
|
||||
|
||||
|
||||
def _unique_strings(values: list[str]) -> list[str]:
|
||||
seen: set[str] = set()
|
||||
unique: list[str] = []
|
||||
|
||||
Reference in New Issue
Block a user