feat(awooop): surface execution backend evidence
All checks were successful
CD Pipeline / tests (push) Successful in 5m49s
Code Review / ai-code-review (push) Successful in 11s
CD Pipeline / build-and-deploy (push) Successful in 4m5s
CD Pipeline / post-deploy-checks (push) Successful in 1m46s

This commit is contained in:
Your Name
2026-05-24 14:35:42 +08:00
parent 17b62da59a
commit dc09dac4d4
5 changed files with 212 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
from __future__ import annotations
import inspect
from datetime import datetime, timedelta, timezone
from datetime import UTC, datetime, timedelta
from types import SimpleNamespace
from src.services.awooop_ansible_audit_service import (
@@ -258,7 +258,7 @@ def test_drift_fingerprint_is_stable_across_item_order() -> None:
def test_drift_repeat_state_counts_matching_fingerprint_only() -> None:
now = datetime(2026, 5, 13, 1, 0, tzinfo=timezone.utc)
now = datetime(2026, 5, 13, 1, 0, tzinfo=UTC)
report = {
"report_id": "drift-now",
"namespace": "awoooi-prod",
@@ -303,7 +303,7 @@ def test_drift_repeat_state_counts_matching_fingerprint_only() -> None:
def test_drift_repeat_state_can_group_semantic_shape_without_values() -> None:
now = datetime(2026, 5, 19, 1, 0, tzinfo=timezone.utc)
now = datetime(2026, 5, 19, 1, 0, tzinfo=UTC)
report = {
"report_id": "drift-now",
"namespace": "awoooi-prod",
@@ -565,11 +565,32 @@ def test_automation_quality_summary_denies_full_claim_when_unverified() -> None:
"applicable": True,
"verdict": "auto_repaired_verified",
"score": 100,
"facts": {
"automation_operation_records": 1,
"effective_execution_records": 1,
"noop_operation_records": 0,
"audit_only_operation_records": 0,
"auto_repair_execution_records": 1,
},
"gates": [
{"name": "verification_recorded", "status": "passed"},
],
"blockers": [],
},
"execution": {
"automation_operation_log": [
{
"operation_type": "playbook_executed",
"status": "success",
}
],
"auto_repair_executions": [{"success": True}],
"ansible": {
"considered": False,
"records": [],
"candidate_catalog": {"candidates": []},
},
},
},
{
"incident": {
@@ -588,12 +609,51 @@ def test_automation_quality_summary_denies_full_claim_when_unverified() -> None:
"applicable": True,
"verdict": "execution_unverified",
"score": 65,
"facts": {
"automation_operation_records": 2,
"effective_execution_records": 0,
"noop_operation_records": 0,
"audit_only_operation_records": 2,
"auto_repair_execution_records": 0,
},
"gates": [
{"name": "verification_recorded", "status": "missing"},
{"name": "learning_recorded", "status": "missing"},
],
"blockers": ["verification_recorded", "learning_recorded"],
},
"execution": {
"automation_operation_log": [
{
"operation_type": "ansible_candidate_matched",
"status": "dry_run",
},
{
"operation_type": "ansible_check_mode_executed",
"status": "dry_run",
},
],
"auto_repair_executions": [],
"ansible": {
"considered": True,
"records": [
{
"operation_type": "ansible_candidate_matched",
"status": "dry_run",
},
{
"operation_type": "ansible_check_mode_executed",
"status": "dry_run",
},
],
"candidate_catalog": {
"candidates": [
{"catalog_id": "ansible:188-ai-web"},
{"catalog_id": "ansible:nginx-sync"},
]
},
},
},
},
],
)
@@ -613,6 +673,20 @@ def test_automation_quality_summary_denies_full_claim_when_unverified() -> None:
"learning_recorded": 1,
"verification_recorded": 1,
}
assert summary["execution_backend_summary"] == {
"operation_records_total": 3,
"effective_execution_records_total": 1,
"noop_operation_records_total": 0,
"audit_only_operation_records_total": 2,
"auto_repair_execution_records_total": 1,
"ansible_considered_total": 1,
"ansible_audit_record_total": 2,
"ansible_candidate_total": 2,
"ansible_check_mode_total": 1,
"ansible_apply_total": 0,
"ansible_rollback_total": 0,
"ansible_pending_check_mode_total": 1,
}
assert summary["examples"][1]["incident_id"] == "INC-GAP"
assert summary["examples"][1]["score_bucket"] == "yellow"