fix: harden alerts and backup deployment guard
All checks were successful
CD Pipeline / deploy (push) Successful in 1m4s
All checks were successful
CD Pipeline / deploy (push) Successful in 1m4s
This commit is contained in:
@@ -10,6 +10,20 @@ def test_telegram_html_sanitizer_converts_br_tags_to_newlines():
|
||||
assert _sanitize_telegram_html("第一行<br>第二行", parse_mode=None) == "第一行<br>第二行"
|
||||
|
||||
|
||||
def test_telegram_html_sanitizer_escapes_unsupported_tags_but_keeps_allowed_tags():
|
||||
msg = _sanitize_telegram_html(
|
||||
'<b>Ollama</b> <code>timeout</code> '
|
||||
'<a href="https://mo.wooo.work/health">health</a> '
|
||||
"<httpconnection(host='192.168.0.111', port=11434)>"
|
||||
)
|
||||
|
||||
assert "<b>Ollama</b>" in msg
|
||||
assert "<code>timeout</code>" in msg
|
||||
assert '<a href="https://mo.wooo.work/health">health</a>' in msg
|
||||
assert "<httpconnection" not in msg
|
||||
assert "<httpconnection(host='192.168.0.111', port=11434)>" in msg
|
||||
|
||||
|
||||
def test_send_telegram_with_result_sanitizes_html_payload(monkeypatch):
|
||||
sent_payloads = []
|
||||
|
||||
@@ -247,10 +261,13 @@ def test_triaged_alert_renders_decision_envelope_contract():
|
||||
assert "邊界:price adjustment requires HITL" in msg
|
||||
assert "<b>標的</b>" in msg
|
||||
assert "PChome" in msg
|
||||
assert "<code>match_score</code> / 91%" in msg
|
||||
assert "📊 <b>價格證據</b>" in msg
|
||||
assert "價差:NT$ 120(正值代表 MOMO 較貴)" in msg
|
||||
assert "🧩 <b>比對證據</b>" in msg
|
||||
assert "Match:<code>0.91</code>" in msg
|
||||
assert "identity_v2 + price_alert_exact" in msg
|
||||
assert "✅ <b>人工下一步</b>" in msg
|
||||
assert "動作:<code>human_review</code>" in msg
|
||||
assert "revenue_loss_7d=42000" in msg
|
||||
assert "ai_call_id=123" in msg
|
||||
assert keyboard["inline_keyboard"][0][0]["callback_data"] == "momo:eig:decision_env_001"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user