ops(reboot): persist summary evidence and classify warmup routes
Some checks failed
Code Review / ai-code-review (push) Successful in 14s
Ansible / Reboot Recovery Contract / validate (push) Has been cancelled

This commit is contained in:
ogt
2026-06-26 17:55:45 +08:00
parent 1d4b3df5e4
commit 35dba35253
7 changed files with 94 additions and 15 deletions

View File

@@ -106,15 +106,15 @@ def parse_args() -> argparse.Namespace:
return parser.parse_args()
def load_json(path: Path) -> dict[str, Any]:
def load_json(path: Path, label: str = "response_file") -> dict[str, Any]:
try:
payload = json.loads(path.read_text(encoding="utf-8"))
except FileNotFoundError as exc:
raise SystemExit(f"response_file_not_found={path}") from exc
raise SystemExit(f"{label}_not_found={path}") from exc
except json.JSONDecodeError as exc:
raise SystemExit(f"response_json_invalid={exc}") from exc
raise SystemExit(f"{label}_json_invalid={exc}") from exc
if not isinstance(payload, dict):
raise SystemExit("response_json_not_object")
raise SystemExit(f"{label}_json_not_object")
return payload
@@ -146,7 +146,7 @@ def generate_owner_packet(no_color: bool) -> dict[str, Any]:
def load_owner_packet(args: argparse.Namespace) -> dict[str, Any]:
if args.owner_packet_file:
return load_json(args.owner_packet_file)
return load_json(args.owner_packet_file, label="owner_packet_file")
return generate_owner_packet(no_color=args.no_color)
@@ -375,7 +375,7 @@ def evaluate(packet: dict[str, Any], response: dict[str, Any] | None) -> dict[st
def main() -> int:
args = parse_args()
packet = load_owner_packet(args)
response = load_json(args.response_file) if args.response_file else None
response = load_json(args.response_file, label="response_file") if args.response_file else None
result = evaluate(packet, response)
if args.json:

View File

@@ -196,6 +196,9 @@ else
next_required_gates_csv="$(IFS=,; echo "${next_required_gates[*]}")"
fi
summary_file="$ARTIFACT_DIR/summary.txt"
{
cat <<SUMMARY
AWOOOI_POST_REBOOT_READINESS_SUMMARY=1
TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S %Z')
@@ -232,6 +235,7 @@ RUNTIME_ACTION_AUTHORIZED=$runtime_action_authorized
OVERALL_DECLARATION=$overall_declaration
NEXT_REQUIRED_GATES=$next_required_gates_csv
SUMMARY
} | tee "$summary_file"
if [[ "$SHOW_LOGS" -eq 1 ]]; then
for log_file in "$ARTIFACT_DIR"/*.log; do

View File

@@ -18,6 +18,10 @@ RUN_BACKUP=1
RUN_ROUTES=1
RUN_CPU=1
NO_COLOR_FLAG=0
COLD_START_PENDING_BLOCKERS=0
COLD_START_BLOCKED_SUMMARY=""
COLD_START_BLOCKED_LINES=""
ROUTE_SMOKE_BLOCKED=0
PASS_COUNT=0
WARN_COUNT=0
@@ -234,7 +238,10 @@ if [[ "$RUN_COLD_START" -eq 1 ]]; then
cold_blocked="${BASH_REMATCH[1]}"
fi
if [[ "$cold_blocked" -gt 0 ]]; then
blocked "cold-start has blockers: $cold_summary"
COLD_START_PENDING_BLOCKERS="$cold_blocked"
COLD_START_BLOCKED_SUMMARY="$cold_summary"
COLD_START_BLOCKED_LINES="$(grep -E '^BLOCKED ' "$cold_tmp" || true)"
evidence_warn "cold-start blockers pending wrapper retry classification: $cold_summary"
elif [[ "$cold_warn" -gt 0 ]]; then
service_warn "cold-start is warning-only, not blocked: $cold_summary"
elif [[ "$cold_rc" -eq 0 ]]; then
@@ -403,12 +410,24 @@ if [[ "$RUN_ROUTES" -eq 1 ]]; then
fi
;;
*)
ROUTE_SMOKE_BLOCKED=$((ROUTE_SMOKE_BLOCKED + 1))
blocked "${code:-curl_failed} $url attempts=$ROUTE_RETRY_ATTEMPTS"
;;
esac
done
fi
if [[ "$COLD_START_PENDING_BLOCKERS" -gt 0 ]]; then
non_route_cold_blockers="$(printf '%s\n' "$COLD_START_BLOCKED_LINES" | grep -Ev '^BLOCKED public route ' || true)"
if [[ "$RUN_ROUTES" -eq 1 && "$ROUTE_SMOKE_BLOCKED" -eq 0 && -z "$non_route_cold_blockers" ]]; then
evidence_warn "cold-start public-route blockers recovered under wrapper route retry: $COLD_START_BLOCKED_SUMMARY"
printf '%s\n' "$COLD_START_BLOCKED_LINES"
else
blocked "cold-start has blockers: $COLD_START_BLOCKED_SUMMARY"
printf '%s\n' "$COLD_START_BLOCKED_LINES"
fi
fi
if [[ "$RUN_CPU" -eq 1 ]]; then
section "110 CPU / process attribution"
cpu_tmp="$(mktemp -t post-start-cpu.XXXXXX)"