821cf12ade
Append CR when executing quick commands (fixes trim stripping saved \r) and allow optional dedicated Telegram bot for server offline alerts only. Co-authored-by: Cursor <cursoragent@cursor.com>
37 lines
1.5 KiB
Markdown
37 lines
1.5 KiB
Markdown
# 子机离线告警独立 Telegram — 验证报告
|
||
|
||
**日期**: 2026-06-13
|
||
|
||
## 验证结果
|
||
|
||
| 项 | 方式 | 结果 |
|
||
|----|------|------|
|
||
| 通道路由单测 | `pytest tests/test_telegram_offline_channel.py` | **PASS** 4/4 |
|
||
| 配置与白名单 | Python import `MUTABLE_KEYS` / `resolve_offline_*` | **PASS** |
|
||
| API 路由注册 | FastAPI `telegram/offline/*` | **PASS** |
|
||
| 本地门控 | `bash scripts/local_verify.sh` | **PASS** 26/26 + ruff |
|
||
| 前端构建 | `npm run build` | **PASS**(含 `SettingsPage-*.js`) |
|
||
| 构建产物 API 路径 | `telegram/offline/test` 等 | **PASS** |
|
||
| 真实 Telegram 发送 | 未执行 | **SKIP**(需生产/本地 Bot 凭据) |
|
||
| 子机离线边沿 E2E | 未执行 | **SKIP**(需可 SSH 子机 + Agent) |
|
||
|
||
## 路由清单(已注册)
|
||
|
||
- `POST /api/settings/telegram/offline/test`
|
||
- `GET /api/settings/telegram/offline/chats`
|
||
- `POST /api/settings/telegram/offline/reveal-token`
|
||
- `PUT /api/settings/telegram_offline_bot_token`
|
||
- `PUT /api/settings/telegram_offline_chat_id`
|
||
|
||
## 路由逻辑(单测覆盖)
|
||
|
||
1. 专用 Token+Chat 均配置 → 离线告警走专用 Bot
|
||
2. 未配置专用 → 回退默认 `TELEGRAM_BOT_TOKEN` / `TELEGRAM_CHAT_ID`
|
||
3. 仅配置一半专用 → 回退默认(避免半配发不出去)
|
||
|
||
## 手动终验(部署后)
|
||
|
||
1. **设置** → 配置离线专用 Bot + Chat ID →「测试离线通道」收到消息。
|
||
2. 停一台子机 Agent → 离线通知进**专用群**(非默认群)。
|
||
3. 清空离线专用配置 → 离线通知回默认群。
|