守住 V2 silent failure 修補

This commit is contained in:
OoO
2026-05-13 11:26:30 +08:00
parent dc99babdc6
commit 546c63fdee
2 changed files with 12 additions and 0 deletions

View File

@@ -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")