# LINE / Telegram 驗證變更前後必跑命令清單（短版）

> 給 PR / commit checklist 用。只留最常用、最值得跑的指令。

相關背景：
- `references/line-telegram-verification-lifecycle.md`
- `references/line-telegram-test-map.md`

---

## 0. 改之前先看變更範圍

```bash
git diff --stat -- \
  gateway/user_verification.py \
  gateway/authz_mixin.py \
  plugins/platforms/telegram/adapter.py \
  plugins/platforms/line/adapter.py \
  hermes_cli/web_server.py \
  tests/
```

---

## 1. 最小安全集（小修也建議跑）

```bash
pytest -q \
  tests/gateway/test_verified_email_handoff_guard_helpers.py \
  tests/hermes_cli/test_web_verification_admin.py
```

**適用：**
- 小修驗證邏輯
- 小修 bind / unbind
- 小修 handoff guard
- 只改註解但想確認沒順手弄壞測試檔

---

## 2. 改 LINE 驗證 / quota fallback / DM gate

```bash
pytest -q \
  tests/gateway/test_line_plugin.py \
  tests/gateway/test_verified_email_handoff_guard_helpers.py \
  tests/gateway/test_line_telegram_verification_smoke.py
```

---

## 3. 改 Telegram onboarding / authz / pairing intake

```bash
pytest -q \
  tests/gateway/test_telegram_auth_check.py \
  tests/hermes_cli/test_web_verification_admin.py \
  tests/gateway/test_line_telegram_verification_smoke.py
```

---

## 4. 改 verification store / bind / unbind 核心

```bash
pytest -q \
  tests/hermes_cli/test_web_verification_admin.py \
  tests/gateway/test_verified_email_handoff_guard_helpers.py \
  tests/gateway/test_line_telegram_verification_smoke.py \
  tests/gateway/test_pairing.py \
  tests/gateway/test_pairing_allowlist_bypass.py
```

---

## 5. 大改整條 LINE / Telegram 驗證流程

```bash
pytest -q \
  tests/gateway/test_line_telegram_verification_smoke.py \
  tests/hermes_cli/test_web_verification_admin.py \
  tests/gateway/test_line_plugin.py \
  tests/gateway/test_telegram_auth_check.py \
  tests/gateway/test_verified_email_handoff_guard_helpers.py \
  tests/gateway/test_pairing.py \
  tests/gateway/test_pairing_allowlist_bypass.py
```

---

## 6. 改完後看工作樹，只留你預期的檔案

```bash
git status --short -- \
  gateway/user_verification.py \
  gateway/authz_mixin.py \
  plugins/platforms/telegram/adapter.py \
  plugins/platforms/line/adapter.py \
  hermes_cli/web_server.py \
  tests/ \
  skills/devops/gateway-identity-binding-lifecycle/references/
```

---

## 7. PR 前建議附上的一句話

```text
已跑對應回歸：<貼上你實際跑的 pytest 指令或測試檔清單>
```

不要寫模糊版：
- ❌ 已測試
- ❌ 已驗證
- ❌ 基本正常

請寫可追的版本：
- ✅ `pytest -q tests/gateway/test_line_plugin.py tests/gateway/test_line_telegram_verification_smoke.py`

---

## 超短版：如果你懶得想，先跑這條

```bash
pytest -q \
  tests/gateway/test_line_telegram_verification_smoke.py \
  tests/hermes_cli/test_web_verification_admin.py \
  tests/gateway/test_line_plugin.py \
  tests/gateway/test_telegram_auth_check.py \
  tests/gateway/test_verified_email_handoff_guard_helpers.py
```

這條不是最大全套，但已經能抓到大部分：
- LINE / Telegram onboarding regressions
- verified-email handoff regressions
- unbind / pairing revoke regressions
- adapter gate / authz / smoke path regressions
