fix(api): surface Work Item handoff in Telegram cards
This commit is contained in:
@@ -1337,6 +1337,53 @@ async def test_build_inline_keyboard_hides_approval_for_no_action() -> None:
|
||||
} in buttons
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_build_inline_keyboard_links_work_item_for_no_action_handoff() -> None:
|
||||
"""NO_ACTION 卡片要直接開 owner review Work Item,不能只丟給人工找頁面。"""
|
||||
gateway = TelegramGateway()
|
||||
|
||||
keyboard = await gateway._build_inline_keyboard(
|
||||
approval_id="approval-no-repair-work-item",
|
||||
include_auto_tuning=False,
|
||||
incident_id="INC-20260625-977E5F",
|
||||
suggested_action=(
|
||||
"DRAFT_READY - REPAIR_CANDIDATE_OWNER_REVIEW_REQUIRED: "
|
||||
"PlayBook 只有觀察或診斷步驟"
|
||||
),
|
||||
repair_candidate_work_item_href=(
|
||||
"/awooop/work-items?project_id=awoooi"
|
||||
"&incident_id=INC-20260625-977E5F"
|
||||
"&work_item_id=repair-candidate-draft%3Aawoooi%3AINC-20260625-977E5F"
|
||||
),
|
||||
)
|
||||
buttons = [
|
||||
button
|
||||
for row in keyboard["inline_keyboard"]
|
||||
for button in row
|
||||
]
|
||||
button_texts = {button["text"] for button in buttons}
|
||||
|
||||
assert "✅ 批准" not in button_texts
|
||||
assert "❌ 拒絕" not in button_texts
|
||||
assert {
|
||||
"text": "🧾 Work Item",
|
||||
"url": (
|
||||
"https://awoooi.wooo.work/zh-TW/awooop/work-items"
|
||||
"?project_id=awoooi&incident_id=INC-20260625-977E5F"
|
||||
"&work_item_id=repair-candidate-draft%3Aawoooi%3AINC-20260625-977E5F"
|
||||
),
|
||||
} in buttons
|
||||
assert "🧰 處置包" in button_texts
|
||||
assert "🔄 重診" in button_texts
|
||||
assert {
|
||||
"text": "🧭 Runs",
|
||||
"url": (
|
||||
"https://awoooi.wooo.work/zh-TW/awooop/runs"
|
||||
"?project_id=awoooi&incident_id=INC-20260625-977E5F"
|
||||
),
|
||||
} in buttons
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_send_request_strips_awooop_callback_metadata_before_telegram_api(monkeypatch):
|
||||
"""AwoooP truth-chain metadata must be mirrored, not sent to Telegram Bot API."""
|
||||
|
||||
Reference in New Issue
Block a user