feat(awooop): surface telegram source ref gaps
All checks were successful
CD Pipeline / tests (push) Successful in 1m20s
Code Review / ai-code-review (push) Successful in 11s
CD Pipeline / build-and-deploy (push) Successful in 4m13s
CD Pipeline / post-deploy-checks (push) Successful in 1m47s

This commit is contained in:
Your Name
2026-05-25 19:06:10 +08:00
parent d0084a5f44
commit 9b802aa7c6
7 changed files with 86 additions and 0 deletions

View File

@@ -109,6 +109,8 @@ class CallbackReplyAuditSummary(BaseModel):
outbound_source_envelope_total: int
outbound_source_refs_total: int
outbound_incident_ref_total: int
outbound_reply_markup_total: int = 0
outbound_reply_markup_missing_incident_ref_total: int = 0
outbound_failed_total: int
callback_total: int
callback_sent_total: int

View File

@@ -487,6 +487,16 @@ async def _fetch_callback_reply_audit_summary(
'[]'::jsonb
) <> '[]'::jsonb
) AS outbound_incident_ref_total,
COUNT(*) FILTER (
WHERE source_envelope #>> '{reply_markup,present}' = 'true'
) AS outbound_reply_markup_total,
COUNT(*) FILTER (
WHERE source_envelope #>> '{reply_markup,present}' = 'true'
AND COALESCE(
source_envelope #> '{source_refs,incident_ids}',
'[]'::jsonb
) = '[]'::jsonb
) AS outbound_reply_markup_missing_incident_ref_total,
COUNT(*) FILTER (
WHERE send_status = 'failed'
) AS outbound_failed_total,
@@ -607,6 +617,12 @@ def _callback_reply_audit_summary_from_row(
row.get("outbound_source_refs_total")
),
"outbound_incident_ref_total": outbound_incident_refs,
"outbound_reply_markup_total": _safe_int(
row.get("outbound_reply_markup_total")
),
"outbound_reply_markup_missing_incident_ref_total": _safe_int(
row.get("outbound_reply_markup_missing_incident_ref_total")
),
"outbound_failed_total": _safe_int(row.get("outbound_failed_total")),
"callback_total": callback_total,
"callback_sent_total": _safe_int(row.get("callback_sent_total")),