fix(ops): harden reboot API warmup evidence flow
Some checks failed
Code Review / ai-code-review (push) Successful in 13s
E2E Health Check / e2e-health (push) Successful in 31s
Ansible / Reboot Recovery Contract / validate (push) Has been cancelled

This commit is contained in:
ogt
2026-06-26 23:59:06 +08:00
parent fe74d8616e
commit 89b9e67a41
7 changed files with 74 additions and 15 deletions

View File

@@ -30,6 +30,11 @@ def parse_args() -> argparse.Namespace:
type=Path,
help="Use an existing post-reboot-next-gate-dispatch output file.",
)
parser.add_argument(
"--summary-file",
type=Path,
help="Pass an existing readiness summary file to the delegated dispatch checklist.",
)
parser.add_argument(
"--output",
type=Path,
@@ -43,8 +48,10 @@ def parse_args() -> argparse.Namespace:
return parser.parse_args()
def run_dispatch(no_color: bool) -> str:
def run_dispatch(no_color: bool, summary_file: Path | None) -> str:
cmd = [str(DISPATCH_SCRIPT)]
if summary_file:
cmd.extend(["--summary-file", str(summary_file)])
if no_color:
cmd.append("--no-color")
completed = subprocess.run(
@@ -65,7 +72,7 @@ def run_dispatch(no_color: bool) -> str:
def load_dispatch(args: argparse.Namespace) -> str:
if args.dispatch_file:
return args.dispatch_file.read_text(encoding="utf-8")
return run_dispatch(no_color=args.no_color)
return run_dispatch(no_color=args.no_color, summary_file=args.summary_file)
def split_csv(value: str) -> list[str]:

View File

@@ -97,6 +97,11 @@ def parse_args() -> argparse.Namespace:
type=Path,
help="Use an existing owner packet JSON instead of generating one.",
)
parser.add_argument(
"--summary-file",
type=Path,
help="Generate owner packets from an existing readiness summary file.",
)
parser.add_argument("--json", action="store_true", help="Print machine-readable JSON.")
parser.add_argument(
"--no-color",
@@ -118,8 +123,10 @@ def load_json(path: Path, label: str = "response_file") -> dict[str, Any]:
return payload
def generate_owner_packet(no_color: bool) -> dict[str, Any]:
def generate_owner_packet(no_color: bool, summary_file: Path | None) -> dict[str, Any]:
cmd = [str(OWNER_PACKET_GENERATOR)]
if summary_file:
cmd.extend(["--summary-file", str(summary_file)])
if no_color:
cmd.append("--no-color")
completed = subprocess.run(
@@ -147,7 +154,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, label="owner_packet_file")
return generate_owner_packet(no_color=args.no_color)
return generate_owner_packet(no_color=args.no_color, summary_file=args.summary_file)
def as_list(value: Any) -> list[Any]:

View File

@@ -22,6 +22,7 @@ COLD_START_PENDING_BLOCKERS=0
COLD_START_BLOCKED_SUMMARY=""
COLD_START_BLOCKED_LINES=""
ROUTE_SMOKE_BLOCKED=0
AWOOOI_API_ROUTE_OK=0
STOCK_EOD_WINDOW_PENDING=0
STOCK_EOD_CLASSIFICATION="not_evaluated"
STOCK_EOD_NEXT_ACTION="not_evaluated"
@@ -469,6 +470,9 @@ if [[ "$RUN_ROUTES" -eq 1 ]]; then
done
case "$code" in
2*|3*)
if [[ "$url" == "https://awoooi.wooo.work/api/v1/health" && "$code" == 2* ]]; then
AWOOOI_API_ROUTE_OK=1
fi
if [[ "$attempt" -gt 1 ]]; then
evidence_warn "$code $url recovered_after_attempt=$attempt"
else
@@ -485,8 +489,13 @@ 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 && "$AWOOOI_API_ROUTE_OK" -eq 1 ]]; then
non_route_cold_blockers="$(
printf '%s\n' "$non_route_cold_blockers" | grep -Ev '^BLOCKED AWOOOI API not reachable$|^BLOCKED AWOOI API not reachable$' || true
)"
fi
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"
evidence_warn "cold-start route/API warmup 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"