fix(awooop): cast outbound sent status timestamp gate
All checks were successful
Code Review / ai-code-review (push) Successful in 11s
CD Pipeline / tests (push) Successful in 1m22s
CD Pipeline / build-and-deploy (push) Successful in 3m30s
CD Pipeline / post-deploy-checks (push) Successful in 1m24s

This commit is contained in:
Your Name
2026-05-13 12:12:07 +08:00
parent 971afafc01
commit e57474adfb
3 changed files with 7 additions and 2 deletions

View File

@@ -523,7 +523,7 @@ async def record_outbound_message(
:redaction_version, CAST(:source_envelope AS jsonb),
:provider_message_id,
:send_status, NOW(),
CASE WHEN :send_status = 'sent' THEN NOW() ELSE NULL END,
CASE WHEN CAST(:send_status AS text) = 'sent' THEN NOW() ELSE NULL END,
:triggered_by_state, :waiting_since
)
RETURNING message_id

View File

@@ -132,5 +132,5 @@ async def test_record_outbound_message_sets_sent_at_for_sent_messages() -> None:
insert_statement = session.statements[-1]
assert "sent_at" in insert_statement
assert "CASE WHEN :send_status = 'sent' THEN NOW() ELSE NULL END" in insert_statement
assert "CASE WHEN CAST(:send_status AS text) = 'sent' THEN NOW() ELSE NULL END" in insert_statement
assert session.param_sets[-1]["send_status"] == "sent"

View File

@@ -7304,4 +7304,9 @@ python -m py_compile src/services/channel_hub.py src/services/telegram_gateway.p
OK
```
**production smoke 途中補修**
- rollback transaction smoke 抓到 asyncpg bind parameter 型別推論問題:`CASE WHEN :send_status = 'sent'` 會被推成 text/varchar ambiguous。
- 已改成 `CASE WHEN CAST(:send_status AS text) = 'sent' THEN NOW() ELSE NULL END`,避免 outbound mirror 在 production 寫入時失敗。
**目前整體進度**:約 69%。