守住月結匯入 append 路徑
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
- Scheduler 觀測任務:BGE-M3 embedding consistency 不一致、host health probe、AI error spike、觀測台日報與 cleanup 例外都已接 `_notify_scheduler_failure()`。
|
||||
- AutoHeal Telegram inline:`obs_heal` 已用 `_CURRENT_USER_ID_CTX` 記錄實際 Telegram user,webhook request 開頭會清空 stale user context。
|
||||
- 匯入檔名日期 helper:`routes/import_routes.py` 已改用 `utils.text_helpers.extract_snapshot_date_from_filename()` 單一來源,並用真實日期解析拒絕 `20261399` 這類不可能日期。
|
||||
- `monthly_summary_analysis` 匯入已守住「刪同年月後 append」路徑,`tests/test_import_service_sql_params.py` 會防止該月結匯入區塊退回整表 `if_exists='replace'`。
|
||||
- ROI 月報 feedback 區塊:反饋趨勢查詢失敗仍不阻擋月報,但已改為 warning + stack,避免完全靜默。
|
||||
- Elephant Alpha short-circuit:`log_ai_call` 遙測失敗仍不阻擋省成本 return,但已改為 warning + stack。
|
||||
- Claude cost throttle:成本節流檢查失敗仍維持 Claude 可用,但已改為 warning + stack,避免成本保護失效無跡可查。
|
||||
@@ -98,3 +99,4 @@
|
||||
- `eb6886e` 同步 scheduler 排程摘要
|
||||
- `b24241f` 守住 migration blocker 修補
|
||||
- `6c86839` 守住盤點誤判依賴
|
||||
- `2e2b775` 守住 V2 import 清理狀態
|
||||
|
||||
@@ -15,3 +15,13 @@ def test_import_service_does_not_interpolate_date_values_into_in_clauses():
|
||||
|
||||
assert "join([f\"'{d}'\"" not in source
|
||||
assert "join([f\"'{d}'\" for d in" not in source
|
||||
|
||||
|
||||
def test_monthly_summary_import_does_not_replace_entire_table():
|
||||
source = Path("routes/import_routes.py").read_text(encoding="utf-8")
|
||||
start = source.index("DELETE FROM monthly_summary_analysis WHERE year = :y AND month = :m")
|
||||
end = source.index("月份總表資料匯入成功", start)
|
||||
monthly_import_block = source[start:end]
|
||||
|
||||
assert "if_exists='append'" in monthly_import_block
|
||||
assert "if_exists='replace'" not in monthly_import_block
|
||||
|
||||
Reference in New Issue
Block a user