Your Name
dcf2750b2b
CD Pipeline / build-and-deploy (push) Failing after 1m32s
feat(p1.5): FailoverAlerter 整合點 3+4 + 6 個 testcase 補完
P1.5 收尾(status 文件 line 96-99 指定):
整合點 3 — failover_manager Gemini quota 告警觸發:
- ollama_failover_manager.py: _check_gemini_quota 返回 False 時呼叫
alerter.alert_gemini_quota_exceeded({quota, current_count})
- 從 Redis 讀 ollama:gemini_daily_count:{date} 取 current_count(fail-soft)
- alerter 內 24h dedup(QUOTA_DEDUP_TTL_SEC=86400),每日只發一次
- try/except 包裹:告警失敗 fail-open,不阻斷 routing
整合點 4 — main.py lifespan 注入 Redis client:
- 在 _recovery_svc.start() 之後、yield 之前
- 呼叫 configure_alerter(get_redis()) 替換 singleton 注入 dedup 能力
- try/except 包裹:注入失敗 fail-open(alerter 仍可工作但 dedup 失效)
新測試 (174 行, 6/6 pass):
- test_alert_failover_dedup: 同 to_provider 第二次被 10min dedup ✅
- test_alert_recovery_send: 正常發送 + Markdown 訊息 + 連續 N 次 HEALTHY ✅
- test_no_telegram_chat_id_noop: chat_id 缺時 fail-soft 不 raise ✅
- test_quota_alert_dedup_24h: TTL=86400s,訊息含 quota+count ✅
- test_configure_alerter_replaces_singleton: lifespan 注入後 redis 可用 ✅
- test_dedup_fail_open_when_no_redis: Redis None → 允許送出 ✅
Mock 注意:_send() inline import telegram_gateway/get_settings,
mock target 必須是 src.services.telegram_gateway / src.core.config
而非 alerter module 自己。
回歸:原 37 ollama_failover_manager + 3 lifespan_wiring 測試全綠。
飛輪自主化分數:~75 → 預估 ~80(配額耗盡有告警,運維可見性 +5)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 20:28:29 +08:00
..
2026-04-25 03:29:38 +08:00
2026-04-26 20:19:46 +08:00
2026-03-26 16:06:20 +08:00
2026-04-25 02:33:43 +08:00
2026-04-05 14:45:02 +08:00
2026-03-31 16:25:00 +08:00
2026-04-10 11:22:57 +08:00
2026-04-06 11:49:24 +08:00
2026-04-26 20:18:33 +08:00
2026-04-22 01:33:30 +08:00
2026-04-20 04:13:02 +08:00
2026-04-22 01:41:34 +08:00
2026-04-20 19:40:01 +08:00
2026-04-20 19:40:01 +08:00
2026-04-14 14:39:14 +08:00
2026-04-14 15:10:10 +08:00
2026-04-25 00:14:07 +08:00
2026-03-29 15:27:49 +08:00
2026-04-14 14:39:14 +08:00
2026-03-29 15:27:49 +08:00
2026-04-08 18:17:48 +08:00
2026-04-14 20:43:40 +08:00
2026-03-29 15:48:03 +08:00
2026-04-12 22:50:20 +08:00
2026-04-11 22:05:52 +08:00
2026-04-26 20:28:29 +08:00
2026-03-31 12:16:54 +08:00
2026-04-15 12:44:53 +08:00
2026-04-14 18:43:29 +08:00
2026-04-11 21:33:19 +08:00
2026-04-26 20:17:17 +08:00
2026-04-01 11:11:50 +08:00
2026-04-07 11:17:40 +08:00
2026-03-31 16:16:16 +08:00
2026-03-31 12:20:29 +08:00
2026-04-26 20:18:33 +08:00
2026-03-26 16:06:20 +08:00
2026-04-15 13:08:38 +08:00
2026-04-12 13:32:42 +08:00
2026-03-29 20:49:23 +08:00
2026-04-03 14:00:21 +08:00
2026-04-26 20:18:33 +08:00
2026-04-26 20:18:33 +08:00
2026-04-26 20:18:33 +08:00
2026-04-16 00:13:00 +08:00
2026-04-09 08:55:21 +08:00
2026-04-05 00:14:50 +08:00
2026-04-05 00:14:50 +08:00
2026-03-26 16:06:20 +08:00
2026-04-14 15:19:54 +08:00
2026-04-15 13:08:38 +08:00
2026-04-15 13:08:38 +08:00
2026-03-31 14:17:36 +08:00
2026-03-29 16:23:30 +08:00
2026-03-23 23:51:37 +08:00
2026-04-14 14:39:14 +08:00
2026-04-15 13:08:38 +08:00
2026-04-20 04:23:09 +08:00
2026-04-09 09:01:59 +08:00
2026-04-10 01:12:00 +08:00
2026-04-26 20:17:17 +08:00
2026-04-12 21:08:48 +08:00
2026-04-12 21:20:16 +08:00
2026-03-31 16:16:16 +08:00
2026-04-22 01:27:39 +08:00