test(telegram): require verified delivery receipts
This commit is contained in:
@@ -744,7 +744,13 @@ async def test_controlled_result_pending_reservation_never_resends_provider(
|
||||
return None
|
||||
|
||||
def json(self) -> dict:
|
||||
return {"ok": True, "result": {"message_id": 456}}
|
||||
return {
|
||||
"ok": True,
|
||||
"result": {
|
||||
"message_id": 456,
|
||||
"chat": {"id": "sre-chat"},
|
||||
},
|
||||
}
|
||||
|
||||
class _Client:
|
||||
def __init__(self) -> None:
|
||||
@@ -849,6 +855,11 @@ async def test_no_write_result_reuses_durable_suppression_without_provider_send(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
gateway = TelegramGateway()
|
||||
monkeypatch.setattr(
|
||||
telegram_gateway_module.settings,
|
||||
"SRE_GROUP_CHAT_ID",
|
||||
"sre-chat",
|
||||
)
|
||||
gateway._initialized = True
|
||||
client = AsyncMock()
|
||||
gateway._http_client = client
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import inspect
|
||||
import json
|
||||
from uuid import uuid4
|
||||
|
||||
from src.services.channel_hub import (
|
||||
@@ -20,6 +20,7 @@ from src.services.channel_hub import (
|
||||
mirror_inbound_event,
|
||||
record_outbound_message,
|
||||
)
|
||||
from src.services.telegram_gateway import _telegram_destination_binding
|
||||
|
||||
_FAKE_SECRET_SHAPED_VALUE = "1234567890:" + "abcdefghijklmnopqrstuvwxyzABCDEFGH"
|
||||
|
||||
@@ -54,11 +55,33 @@ async def test_send_telegram_interim_uses_gateway_mirror_path(monkeypatch) -> No
|
||||
"inbound_message_id": inbound_message_id,
|
||||
}
|
||||
)
|
||||
destination_binding = _telegram_destination_binding(chat_id)
|
||||
destination_alias = "verified_inbound_chat"
|
||||
return {
|
||||
"ok": True,
|
||||
"result": {"message_id": 42},
|
||||
"result": {
|
||||
"message_id": 42,
|
||||
"chat": {"id": chat_id},
|
||||
},
|
||||
"_awooop_delivery_status": "sent",
|
||||
"_awooop_provider_send_performed": True,
|
||||
"_awoooi_canonical_route_receipt": {
|
||||
"schema_version": "telegram_canonical_egress_receipt_v1",
|
||||
"decision": "allowed",
|
||||
"provider_send_performed": True,
|
||||
"sender_bot_alias": "tsenyang_bot",
|
||||
"destination_alias": destination_alias,
|
||||
"destination_binding": destination_binding,
|
||||
},
|
||||
"_awoooi_delivery_context": {
|
||||
"schema_version": "telegram_delivery_context_v1",
|
||||
"sender_bot_alias": "tsenyang_bot",
|
||||
"destination_alias": destination_alias,
|
||||
"destination_binding": destination_binding,
|
||||
"payload_destination_binding": destination_binding,
|
||||
"provider_destination_binding": destination_binding,
|
||||
"destination_binding_verified": True,
|
||||
},
|
||||
}
|
||||
|
||||
monkeypatch.setattr(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Telegram 監控告警路由總帳
|
||||
|
||||
> 狀態:`source_policy_ready_runtime_not_applied`
|
||||
> 狀態:`source_policy_ready_runtime_not_applied`
|
||||
> 真相邊界:本表把「已證明現況」、「建議目的地」、「目前阻擋」、「source risk」與「receipt 強度」分開。建議不等於 live route;alias 不是 numeric chat ID;本變更沒有送 Telegram、讀 token/chat ID、改 runtime route 或部署。
|
||||
|
||||
## 判讀規則
|
||||
|
||||
Reference in New Issue
Block a user