OoO
2f5666be08
feat(import): drive staleness gate active alert when DB stale >=3d (critic-approved)
Root cause (debugger 2026-05-02):
- drive_service.move_file 把 import 完的 Excel 搬到「已匯入」 → 工作夾空
- auto_import_from_drive 每 30 分跑一次 list 回空 → 走 line 671-677
silent return {success:True, file_count:0} → daily_sales_snapshot
自 4/27 12:54 後停更 8 天無任何告警
Patch:
Drive 空時加 staleness gate:查 DB MAX(snapshot_date),若距今 >=3 天
即呼叫既有 _send_data_stale_alert(commit dda0a06)發 Telegram 主動催促 BU 上傳。
critic 5 點修訂全照做:
1. session 自管:from database.manager import get_session + try/finally close
(此區段原本沒有 session 變數,在 line 708 才開)
2. 閾值 >=3 天:跨週末跨假期不上傳是常態,避免誤觸
3. 沿用 _send_data_stale_alert 既有 3 字串參數,不客製文案
4. dedupe key = 'upstream_drive':與下游 daily_report/weekly_strategy/
monthly_report 區隔,未來 ai_insights 查詢不混淆告警源
5. logger.error + exc_info=True:staleness 邏輯吞 try/except 不影響主流程
return success,但留 traceback 可觀測
Regression check:
- openclaw_strategist_service 不 import import_service → 無循環 import
- import path 'database.manager' 與 openclaw 既有用法一致(line 31)
- 找到檔案分支完全未動,主流程行為不變
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-03 13:10:55 +08:00
..
2026-04-28 15:26:20 +08:00
2026-05-03 13:10:15 +08:00
2026-04-19 01:21:13 +08:00
2026-05-01 14:02:37 +08:00
2026-04-29 23:41:03 +08:00
2026-04-29 23:57:36 +08:00
2026-04-19 01:21:13 +08:00
2026-04-29 22:56:00 +08:00
2026-05-01 16:34:13 +08:00
2026-04-25 03:30:14 +08:00
2026-05-03 01:55:34 +08:00
2026-04-29 23:41:03 +08:00
2026-05-01 16:34:13 +08:00
2026-04-29 21:35:56 +08:00
2026-05-02 14:34:30 +08:00
2026-05-02 23:44:01 +08:00
2026-05-01 20:56:17 +08:00
2026-04-19 01:21:13 +08:00
2026-04-28 13:57:44 +08:00
2026-04-28 15:37:07 +08:00
2026-04-27 21:28:23 +08:00
2026-05-02 13:07:30 +08:00
2026-04-22 01:12:23 +08:00
2026-05-02 13:09:34 +08:00
2026-05-03 01:54:21 +08:00
2026-05-02 14:39:10 +08:00
2026-04-30 13:59:12 +08:00
2026-04-30 09:33:39 +08:00
2026-05-02 15:01:55 +08:00
2026-04-19 01:21:13 +08:00
2026-04-27 21:11:52 +08:00
2026-05-03 00:03:38 +08:00
2026-05-03 13:10:55 +08:00
2026-04-28 19:42:05 +08:00
2026-04-27 21:28:23 +08:00
2026-05-02 15:01:55 +08:00
2026-04-25 01:42:40 +08:00
2026-04-19 01:21:13 +08:00
2026-04-19 01:21:13 +08:00
2026-05-03 00:03:38 +08:00
2026-04-29 22:48:24 +08:00
2026-04-29 22:37:20 +08:00
2026-04-30 10:24:15 +08:00
2026-04-29 23:10:27 +08:00
2026-05-02 13:04:18 +08:00
2026-05-03 12:29:22 +08:00
2026-04-19 01:21:13 +08:00
2026-04-20 06:09:33 +08:00
2026-04-19 01:21:13 +08:00
2026-04-22 01:12:23 +08:00
2026-05-03 13:10:15 +08:00
2026-05-02 12:00:34 +08:00
2026-04-27 21:28:23 +08:00
2026-05-03 00:03:38 +08:00
2026-04-29 22:48:24 +08:00
2026-05-02 12:01:04 +08:00
2026-04-19 01:21:13 +08:00
2026-04-19 01:21:13 +08:00
2026-04-27 20:34:15 +08:00
2026-04-19 01:21:13 +08:00
2026-05-01 14:20:09 +08:00