From 546c63fdeeb21b1710ffcc6328d613b1687e9e65 Mon Sep 17 00:00:00 2001 From: OoO Date: Wed, 13 May 2026 11:26:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=88=E4=BD=8F=20V2=20silent=20failure=20?= =?UTF-8?q?=E4=BF=AE=E8=A3=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/memory/claude_inventory_validation_20260513.md | 3 +++ tests/test_phase3f_cleanup_contracts.py | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/docs/memory/claude_inventory_validation_20260513.md b/docs/memory/claude_inventory_validation_20260513.md index 5ec7cbc..e286f63 100644 --- a/docs/memory/claude_inventory_validation_20260513.md +++ b/docs/memory/claude_inventory_validation_20260513.md @@ -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` 移出誤入的本地變更 diff --git a/tests/test_phase3f_cleanup_contracts.py b/tests/test_phase3f_cleanup_contracts.py index b879cd3..41a517f 100644 --- a/tests/test_phase3f_cleanup_contracts.py +++ b/tests/test_phase3f_cleanup_contracts.py @@ -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")