守住 V2 silent failure 修補
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
- `app.py` 的 `SYSTEM_VERSION` 已從 `config.py` import,app 內只留版本註解。
|
||||
- V2 提到的 `app.py` 死 import 與 `scheduler.py import schedule` 已不成立;`app.py` 仍使用 `schedule.run_pending()` 等呼叫。
|
||||
- `tests/test_phase3f_cleanup_contracts.py` 已補 guard:V2 點名的舊 app imports 不得回來,且 `app.py` 的 active `schedule` 用法不可被誤刪。
|
||||
- V2 點名的 3 個 silent failure 點位已不是 `except: pass`:OpenClaw 趨勢圖暫存檔清理與 Notification public_url 讀取失敗都會記 log,並由 `tests/test_phase3f_cleanup_contracts.py` 守住。
|
||||
- Cron 盲區清單多數已補 `_notify_scheduler_failure()`;ROI 月報已避開 09:00 改 09:05,AI smoke 已是 09:10。
|
||||
- V2 指出的 9 個 cron 盲區已補回歸守門:8 個 `run_scheduler.py` wrapper 必須呼叫 `_notify_scheduler_failure()`,`scheduler.py::run_promo_event_task` 必須呼叫 `notify_failure()`。
|
||||
- 09:00 排程衝突已有回歸守門:`daily_report=09:00`、`roi_monthly_report=09:05`、`ai_smoke_daily_summary=09:10` 必須保持錯開。
|
||||
@@ -104,3 +105,5 @@
|
||||
- `2e2b775` 守住 V2 import 清理狀態
|
||||
- `58ba95b` 守住月結匯入 append 路徑
|
||||
- `4079f1c` 守住 CD migration 全範圍執行
|
||||
- `81aa424` 守住 Observability smoke timeout
|
||||
- `dc99bab` 移出誤入的本地變更
|
||||
|
||||
@@ -81,6 +81,15 @@ def test_scheduler_does_not_silently_swallow_exceptions():
|
||||
assert not re.search(r"except(?: Exception)?[^\n]*:\n\s+pass(?:\s|#|$)", scheduler_source)
|
||||
|
||||
|
||||
def test_v2_flagged_silent_exception_sites_stay_logged():
|
||||
openclaw_source = (ROOT / "routes" / "openclaw_bot_routes.py").read_text(encoding="utf-8")
|
||||
notification_source = (ROOT / "services" / "notification_manager.py").read_text(encoding="utf-8")
|
||||
|
||||
assert "trend chart temp cleanup failed" in openclaw_source
|
||||
assert "trend agg chart temp cleanup failed" in openclaw_source
|
||||
assert "[Notification] 讀取 public_url 設定失敗" in notification_source
|
||||
|
||||
|
||||
def test_v2_flagged_imports_are_removed_or_active():
|
||||
app_source = (ROOT / "app.py").read_text(encoding="utf-8")
|
||||
scheduler_source = (ROOT / "scheduler.py").read_text(encoding="utf-8")
|
||||
|
||||
Reference in New Issue
Block a user