feat(awooop): expose ansible runtime readiness
Some checks failed
CD Pipeline / tests (push) Failing after 51s
CD Pipeline / build-and-deploy (push) Has been skipped
CD Pipeline / post-deploy-checks (push) Has been skipped
Code Review / ai-code-review (push) Successful in 12s

This commit is contained in:
Your Name
2026-05-24 15:01:51 +08:00
parent 4874f2b649
commit 1322216f73
6 changed files with 79 additions and 2 deletions

View File

@@ -9,8 +9,10 @@ from __future__ import annotations
import asyncio
import json
import shutil
from datetime import UTC, date, datetime, timedelta
from decimal import Decimal
from pathlib import Path
from typing import Any
from uuid import UUID
@@ -705,6 +707,41 @@ def _execution_backend_summary(records: list[dict[str, Any]]) -> dict[str, Any]:
return summary
def _ansible_runtime_readiness() -> dict[str, Any]:
playbook_roots = [
Path("/app/infra/ansible"),
Path.cwd() / "infra" / "ansible",
]
playbook_root = next((path for path in playbook_roots if path.exists()), None)
playbook_paths = (
sorted((playbook_root / "playbooks").glob("*.yml"))
if playbook_root is not None and (playbook_root / "playbooks").exists()
else []
)
inventory_path = playbook_root / "inventory" / "hosts.yml" if playbook_root is not None else None
binary_path = shutil.which("ansible-playbook")
blockers: list[str] = []
if not binary_path:
blockers.append("ansible_playbook_binary_missing")
if playbook_root is None:
blockers.append("ansible_playbook_catalog_missing")
if inventory_path is None or not inventory_path.exists():
blockers.append("ansible_inventory_missing")
if not playbook_paths:
blockers.append("ansible_playbooks_missing")
return {
"ansible_playbook_binary_present": bool(binary_path),
"ansible_playbook_binary_path": binary_path,
"playbook_root_present": playbook_root is not None,
"playbook_root": str(playbook_root) if playbook_root is not None else None,
"inventory_present": bool(inventory_path and inventory_path.exists()),
"playbook_count": len(playbook_paths),
"can_run_check_mode": not blockers,
"blockers": blockers,
}
def summarize_automation_quality_records(
*,
project_id: str,
@@ -810,6 +847,7 @@ def summarize_automation_quality_records(
"by_verdict": by_verdict,
"gate_failures": failing_gates,
"execution_backend_summary": _execution_backend_summary(records),
"ansible_runtime": _ansible_runtime_readiness(),
"examples": examples[:25],
"production_claim": {
"can_claim_full_auto_repair": evaluated_total > 0 and verified_total == evaluated_total,