feat(awooop): summarize callback capture in runs list
This commit is contained in:
@@ -270,6 +270,12 @@ def test_run_callback_reply_summary_marks_latest_fallback() -> None:
|
||||
assert summary["latest_incident_id"] == "INC-20260513-79ED5E"
|
||||
assert summary["latest_provider_message_id"] == "101"
|
||||
assert summary["needs_human"] is False
|
||||
assert summary["capture_status"] == "not_captured"
|
||||
assert summary["capture_not_captured"] == 2
|
||||
assert summary["latest_capture_missing"] == [
|
||||
"awooop_status_chain",
|
||||
"km_stale_completion_summary",
|
||||
]
|
||||
|
||||
|
||||
def test_run_callback_reply_summary_marks_failed_as_human_attention() -> None:
|
||||
@@ -291,6 +297,54 @@ def test_run_callback_reply_summary_marks_failed_as_human_attention() -> None:
|
||||
assert summary["status"] == "failed"
|
||||
assert summary["failed"] == 1
|
||||
assert summary["needs_human"] is True
|
||||
assert summary["capture_status"] == "not_captured"
|
||||
|
||||
|
||||
def test_run_callback_reply_summary_counts_capture_statuses() -> None:
|
||||
summary = _run_callback_reply_summary([
|
||||
SimpleNamespace(
|
||||
source_envelope={
|
||||
"callback_reply": {
|
||||
"status": "callback_reply_sent",
|
||||
"action": "detail",
|
||||
"incident_id": "INC-20260513-79ED5E",
|
||||
},
|
||||
"awooop_status_chain": {
|
||||
"schema_version": "awooop_status_chain_callback_reply_snapshot_v1",
|
||||
},
|
||||
"km_stale_completion_summary": {
|
||||
"schema_version": (
|
||||
"km_stale_owner_review_callback_reply_snapshot_v1"
|
||||
),
|
||||
},
|
||||
},
|
||||
sent_at=datetime(2026, 5, 18, 6, 3, 0),
|
||||
queued_at=datetime(2026, 5, 18, 6, 3, 0),
|
||||
provider_message_id="102",
|
||||
),
|
||||
SimpleNamespace(
|
||||
source_envelope={
|
||||
"callback_reply": {
|
||||
"status": "callback_reply_sent",
|
||||
"action": "history",
|
||||
"incident_id": "INC-20260513-79ED5E",
|
||||
},
|
||||
"awooop_status_chain": {
|
||||
"schema_version": "awooop_status_chain_callback_reply_snapshot_v1",
|
||||
},
|
||||
},
|
||||
sent_at=datetime(2026, 5, 18, 6, 4, 0),
|
||||
queued_at=datetime(2026, 5, 18, 6, 4, 0),
|
||||
provider_message_id="103",
|
||||
),
|
||||
])
|
||||
|
||||
assert summary["capture_status"] == "partial"
|
||||
assert summary["capture_captured"] == 1
|
||||
assert summary["capture_partial"] == 1
|
||||
assert summary["capture_not_captured"] == 0
|
||||
assert summary["latest_capture_status"] == "partial"
|
||||
assert summary["latest_capture_missing"] == ["km_stale_completion_summary"]
|
||||
|
||||
|
||||
def test_run_callback_reply_summary_marks_no_callback() -> None:
|
||||
@@ -305,6 +359,7 @@ def test_run_callback_reply_summary_marks_no_callback() -> None:
|
||||
|
||||
assert summary["status"] == "no_callback"
|
||||
assert summary["total"] == 0
|
||||
assert summary["capture_status"] == "no_callback"
|
||||
|
||||
|
||||
def test_list_runs_response_preserves_callback_reply_summary() -> None:
|
||||
@@ -336,6 +391,18 @@ def test_list_runs_response_preserves_callback_reply_summary() -> None:
|
||||
"latest_incident_id": "INC-20260513-79ED5E",
|
||||
"latest_at": "2026-05-18T07:31:37",
|
||||
"latest_provider_message_id": "telegram_callback_reply:failed",
|
||||
"capture_status": "not_captured",
|
||||
"capture_captured": 0,
|
||||
"capture_partial": 0,
|
||||
"capture_not_captured": 1,
|
||||
"latest_capture_status": "not_captured",
|
||||
"latest_capture_missing": [
|
||||
"awooop_status_chain",
|
||||
"km_stale_completion_summary",
|
||||
],
|
||||
"latest_capture_next_action": (
|
||||
"press_telegram_detail_or_history_after_rollout"
|
||||
),
|
||||
},
|
||||
}
|
||||
],
|
||||
@@ -347,6 +414,9 @@ def test_list_runs_response_preserves_callback_reply_summary() -> None:
|
||||
dumped = response.model_dump(mode="json")
|
||||
assert dumped["runs"][0]["callback_reply_summary"]["status"] == "failed"
|
||||
assert dumped["runs"][0]["callback_reply_summary"]["needs_human"] is True
|
||||
assert dumped["runs"][0]["callback_reply_summary"]["capture_status"] == (
|
||||
"not_captured"
|
||||
)
|
||||
|
||||
|
||||
def test_callback_reply_event_item_surfaces_run_link_and_human_flag() -> None:
|
||||
|
||||
Reference in New Issue
Block a user