fix(reboot): detect public maintenance edge drift
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 3m22s
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 14:50:11 +08:00
parent 7eb2d9beda
commit ff9e086e2e
10 changed files with 421 additions and 12 deletions

View File

@@ -76,6 +76,7 @@ _PROMETHEUS_RUNTIME_COMBINED_QUERY = (
+ '"}'
)
_PUBLIC_MAINTENANCE_BLOCKERS = {
"edge_public_maintenance_live_config_drift",
"public_maintenance_fallback_runtime_readback_missing",
"public_route_raw_5xx_without_maintenance_fallback",
"public_route_unreachable_without_external_l1_fallback",
@@ -1318,6 +1319,12 @@ def apply_public_maintenance_runtime_readback(
readback["public_route_raw_5xx_without_fallback_count"] = _int(
public_maintenance.get("raw_5xx_without_fallback_count")
)
readback["public_maintenance_edge_fallback_ready"] = (
public_maintenance.get("edge_fallback_ready") is True
)
readback["public_maintenance_edge_fallback_runtime_readback_present"] = (
public_maintenance.get("edge_fallback_runtime_readback_present") is True
)
rollups = _dict(payload.setdefault("rollups", {}))
rollups["active_blocker_count"] = active_blocker_count
@@ -1332,6 +1339,12 @@ def apply_public_maintenance_runtime_readback(
rollups["public_route_raw_5xx_without_fallback_count"] = _int(
public_maintenance.get("raw_5xx_without_fallback_count")
)
rollups["public_maintenance_edge_fallback_ready"] = (
public_maintenance.get("edge_fallback_ready") is True
)
rollups["public_maintenance_edge_fallback_runtime_readback_present"] = (
public_maintenance.get("edge_fallback_runtime_readback_present") is True
)
rollups["public_route_unreachable_without_external_fallback_count"] = _int(
public_maintenance.get("route_unreachable_without_external_fallback_count")
)
@@ -1826,6 +1839,12 @@ def _build_payload(scorecard: dict[str, Any], path: Path) -> dict[str, Any]:
"public_route_raw_5xx_without_fallback_count": _int(
public_maintenance.get("raw_5xx_without_fallback_count")
),
"public_maintenance_edge_fallback_ready": (
public_maintenance.get("edge_fallback_ready") is True
),
"public_maintenance_edge_fallback_runtime_readback_present": (
public_maintenance.get("edge_fallback_runtime_readback_present") is True
),
"public_route_unreachable_without_external_fallback_count": _int(
public_maintenance.get(
"route_unreachable_without_external_fallback_count"
@@ -2092,6 +2111,9 @@ def _build_payload(scorecard: dict[str, Any], path: Path) -> dict[str, Any]:
"public_route_raw_5xx_without_fallback_count": rollups[
"public_route_raw_5xx_without_fallback_count"
],
"public_maintenance_edge_fallback_ready": rollups[
"public_maintenance_edge_fallback_ready"
],
"controlled_service_data_backup_readback_status": rollups[
"controlled_service_data_backup_readback_status"
],
@@ -2232,6 +2254,9 @@ def _build_public_maintenance_fallback_readback(value: Any) -> dict[str, Any]:
return {
"runtime_readback_present": False,
"ready": False,
"edge_fallback_runtime_readback_present": False,
"edge_fallback_ready": None,
"edge_fallback_blockers": [],
"target_url_count": 0,
"route_count": 0,
"raw_5xx_without_fallback_count": 0,
@@ -2259,12 +2284,22 @@ def _build_public_maintenance_fallback_readback(value: Any) -> dict[str, Any]:
and "public_route_unreachable_without_external_l1_fallback" not in blockers
):
blockers.append("public_route_unreachable_without_external_l1_fallback")
edge_blockers = _strings(public_maintenance.get("edge_fallback_blockers"))
for blocker in edge_blockers:
if blocker not in blockers:
blockers.append(blocker)
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,
"edge_fallback_runtime_readback_present": (
public_maintenance.get("edge_fallback_runtime_readback_present") is True
),
"edge_fallback_ready": public_maintenance.get("edge_fallback_ready"),
"edge_fallback": _dict(public_maintenance.get("edge_fallback")),
"edge_fallback_blockers": edge_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,
@@ -3317,6 +3352,7 @@ def _reboot_sop_primary_blocker(active_blockers: list[str]) -> str:
"windows99_console_verify_output_truncated",
"public_route_raw_5xx_without_maintenance_fallback",
"public_route_unreachable_without_external_l1_fallback",
"edge_public_maintenance_live_config_drift",
"public_maintenance_fallback_runtime_readback_missing",
"post_start_blocked_not_zero",
"service_green_not_1",