diff --git a/docs/memory/claude_inventory_validation_20260513.md b/docs/memory/claude_inventory_validation_20260513.md index 93ed3cf..141487b 100644 --- a/docs/memory/claude_inventory_validation_20260513.md +++ b/docs/memory/claude_inventory_validation_20260513.md @@ -36,6 +36,7 @@ - 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` 必須保持錯開。 +- AutoHeal inline host transition 告警已有 DB transition dedup 守門:`run_host_health_probe()` 只在健康狀態翻轉且 1h 內沒有同方向 transition 時推送。 - CD migration 全範圍冪等已有回歸守門:`.gitea/workflows/cd.yaml` 必須維持 024-099 pattern、`sort | uniq` 與 `for m in $V5_MIGRATIONS` apply loop。 - CD Observability production smoke 已補 timeout 守門:`quick_review.sh --observability-smoke` 必須帶 `--timeout 12`。 - 0-byte `database/momo*.db` 迷惑檔已不存在;真實 SQLite 僅在 `data/momo_database.db`。 diff --git a/tests/test_run_scheduler_embed_consistency.py b/tests/test_run_scheduler_embed_consistency.py index f7186d9..897344c 100644 --- a/tests/test_run_scheduler_embed_consistency.py +++ b/tests/test_run_scheduler_embed_consistency.py @@ -121,6 +121,18 @@ def test_scheduler_observability_wrappers_notify_on_exception(monkeypatch): assert "_notify_scheduler_failure(" in source +def test_host_health_transition_alert_keeps_db_dedup_window(monkeypatch): + run_scheduler = _load_run_scheduler(monkeypatch) + source = inspect.getsource(run_scheduler.run_host_health_probe) + + assert "prev_healthy != rec['healthy']" in source + assert "recent_transition" in source + assert "INTERVAL '1 hour'" in source + assert "INTERVAL '90 minutes'" in source + assert "if recent_transition is None:" in source + assert "_push_host_transition_alert(tr)" in source + + def test_v2_cron_blind_spot_list_has_failure_notifications(monkeypatch): run_scheduler = _load_run_scheduler(monkeypatch)