feat(awooop): surface telegram callback coverage
All checks were successful
CD Pipeline / tests (push) Successful in 1m21s
Code Review / ai-code-review (push) Successful in 13s
CD Pipeline / build-and-deploy (push) Successful in 3m59s
CD Pipeline / post-deploy-checks (push) Successful in 1m20s

This commit is contained in:
Your Name
2026-05-25 16:56:28 +08:00
parent b7ee1f47ff
commit 449c4ac807
7 changed files with 524 additions and 0 deletions

View File

@@ -23,6 +23,7 @@ from src.services.platform_operator_service import (
_ai_route_policy_order,
_ai_route_repair_evidence_item,
_build_awooop_status_chain,
_callback_reply_audit_summary_from_row,
_callback_reply_event_item,
_callback_reply_summary_matches_status,
_cicd_duration_seconds,
@@ -658,6 +659,30 @@ def test_list_callback_replies_response_preserves_callback_evidence() -> None:
"total": 1,
"page": 1,
"per_page": 20,
"summary": {
"schema_version": "telegram_callback_reply_audit_summary_v1",
"project_id": "awoooi",
"outbound_total": 120,
"outbound_source_envelope_total": 118,
"outbound_source_refs_total": 100,
"outbound_incident_ref_total": 80,
"outbound_failed_total": 1,
"callback_total": 3,
"callback_sent_total": 1,
"callback_fallback_total": 1,
"callback_rescue_total": 0,
"callback_failed_total": 1,
"callback_detail_total": 2,
"callback_history_total": 1,
"callback_snapshot_captured_total": 1,
"callback_snapshot_partial_total": 1,
"callback_snapshot_missing_total": 1,
"callback_incident_total": 2,
"snapshot_status": "not_captured",
"next_action": "press_telegram_detail_or_history_after_rollout",
"latest_outbound_at": datetime(2026, 5, 18, 7, 40, 0),
"latest_callback_at": datetime(2026, 5, 18, 7, 31, 37),
},
})
dumped = response.model_dump(mode="json")
@@ -676,6 +701,42 @@ def test_list_callback_replies_response_preserves_callback_evidence() -> None:
] == "Hermes"
assert dumped["items"][0]["evidence_capture_status"]["status"] == "captured"
assert dumped["items"][0]["run_detail_href"].endswith("project_id=awoooi")
assert dumped["summary"]["outbound_total"] == 120
assert dumped["summary"]["callback_snapshot_missing_total"] == 1
assert dumped["summary"]["snapshot_status"] == "not_captured"
def test_callback_reply_audit_summary_marks_missing_snapshots() -> None:
summary = _callback_reply_audit_summary_from_row(
{
"outbound_total": 5256,
"outbound_source_envelope_total": 5256,
"outbound_source_refs_total": 5000,
"outbound_incident_ref_total": 3200,
"outbound_failed_total": 0,
"callback_total": 2,
"callback_sent_total": 2,
"callback_fallback_total": 0,
"callback_rescue_total": 0,
"callback_failed_total": 0,
"callback_detail_total": 0,
"callback_history_total": 2,
"callback_snapshot_captured_total": 0,
"callback_snapshot_partial_total": 0,
"callback_snapshot_missing_total": 2,
"callback_incident_total": 1,
"latest_outbound_at": datetime(2026, 5, 25, 8, 42, 22),
"latest_callback_at": datetime(2026, 5, 24, 14, 38, 4),
},
project_id="awoooi",
)
assert summary["schema_version"] == "telegram_callback_reply_audit_summary_v1"
assert summary["outbound_total"] == 5256
assert summary["callback_total"] == 2
assert summary["callback_snapshot_missing_total"] == 2
assert summary["snapshot_status"] == "not_captured"
assert summary["next_action"] == "press_telegram_detail_or_history_after_rollout"
@pytest.mark.asyncio