Commit Graph

57 Commits

Author SHA1 Message Date
OoO
d06c7016dc fix(cd): 修復 sync 版本 mount drift 2026-04-30 23:24:54 +08:00
OoO
dd35306399 refactor(openclaw): 抽出選單鍵盤 builders
All checks were successful
CD Pipeline / deploy (push) Successful in 1m46s
2026-04-30 23:17:19 +08:00
OoO
8b4fafdf13 fix(cd): 讓 HUP 熱重載載入新版 app
All checks were successful
CD Pipeline / deploy (push) Successful in 9m40s
2026-04-30 15:17:00 +08:00
OoO
f282ddc18c fix(cd): sync 模式改用 app 熱重載
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-04-30 15:11:57 +08:00
OoO
db3a7e5df1 fix(db): 補齊 action_plans schema drift
All checks were successful
CD Pipeline / deploy (push) Successful in 5m10s
2026-04-30 14:45:40 +08:00
OoO
2b9991096b fix(monitoring): 移除失效 blackbox 目標
All checks were successful
CD Pipeline / deploy (push) Successful in 1m46s
2026-04-30 14:39:33 +08:00
OoO
f30ee955ff fix(monitoring): 恢復 exporter scrape 目標
All checks were successful
CD Pipeline / deploy (push) Successful in 1m41s
2026-04-30 14:35:09 +08:00
OoO
5695ead4dc fix(edm): 修正活動看板排序 endpoint
All checks were successful
CD Pipeline / deploy (push) Successful in 1m42s
2026-04-30 14:29:40 +08:00
OoO
fb9c4ad1b5 refactor(openclaw): 抽出 Telegram API helper
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-04-30 14:24:45 +08:00
OoO
19535a0763 chore(cleanup): 移除 legacy 5888 測試入口
All checks were successful
CD Pipeline / deploy (push) Successful in 1m36s
2026-04-30 14:12:21 +08:00
OoO
c2e38be43d docs(modularization): 建立模組化治理守門
All checks were successful
CD Pipeline / deploy (push) Successful in 1m36s
2026-04-30 14:07:10 +08:00
OoO
89e7f2ccd2 fix(ai): 擴大 ElephantAlpha 暫時性 fallback
All checks were successful
CD Pipeline / deploy (push) Successful in 1m46s
2026-04-30 13:59:12 +08:00
OoO
d8f93df4ec fix(metrics): 輸出 AI 自動化 baseline 指標
All checks were successful
CD Pipeline / deploy (push) Successful in 1m35s
2026-04-30 10:32:43 +08:00
OoO
e73cd6e6a3 fix(stability): 補強 scheduler 例外記錄
All checks were successful
CD Pipeline / deploy (push) Successful in 1m36s
2026-04-30 10:28:37 +08:00
OoO
72fa166729 fix(ai): 遷移 Ollama embedding 至 api embed
All checks were successful
CD Pipeline / deploy (push) Successful in 1m46s
2026-04-30 10:24:15 +08:00
OoO
74d64092bc fix(db): 收斂 DatabaseManager PostgreSQL 連線池
All checks were successful
CD Pipeline / deploy (push) Successful in 1m35s
2026-04-30 10:08:31 +08:00
OoO
91ad98e621 feat(ai): 強化 ElephantAlpha NIM fallback
All checks were successful
CD Pipeline / deploy (push) Successful in 1m48s
2026-04-30 09:33:39 +08:00
OoO
3193f1979d 縮短 CD rebuild 切換停機窗口
Some checks failed
CD Pipeline / deploy (push) Failing after 1m6s
2026-04-30 09:25:49 +08:00
OoO
73561efa7a 強化 CD Gunicorn 掛載與 metrics 降噪
All checks were successful
CD Pipeline / deploy (push) Successful in 9m26s
2026-04-30 09:13:36 +08:00
OoO
5a569d1e05 強化 CD 健康檢查重試
All checks were successful
CD Pipeline / deploy (push) Successful in 1m32s
2026-04-30 08:58:22 +08:00
OoO
9dd5986077 修復 AI 自動化 Prometheus scrape
All checks were successful
CD Pipeline / deploy (push) Successful in 1m26s
2026-04-30 00:24:40 +08:00
OoO
5a61c020e3 新增 AI 自動化 Grafana 儀表板
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-04-30 00:06:24 +08:00
OoO
d5f4fd7198 加入 AI Smoke 每日摘要推播
All checks were successful
CD Pipeline / deploy (push) Successful in 1m15s
2026-04-29 23:57:36 +08:00
OoO
10bbd55f5b 補齊 AI Smoke 趨勢管理
All checks were successful
CD Pipeline / deploy (push) Successful in 1m13s
2026-04-29 23:54:23 +08:00
OoO
81159b5b3d 保存 AI Smoke 趨勢紀錄
All checks were successful
CD Pipeline / deploy (push) Successful in 1m14s
2026-04-29 23:50:44 +08:00
OoO
cde8b0cd3e 新增 AI 自動化 Smoke Dashboard
All checks were successful
CD Pipeline / deploy (push) Successful in 1m16s
2026-04-29 23:46:48 +08:00
OoO
e6a1c9d09f 補齊 AI 自動化可觀測性指標
All checks were successful
CD Pipeline / deploy (push) Successful in 1m15s
2026-04-29 23:41:03 +08:00
OoO
d58e4d0d11 同步四 Agent AI 自動化治理紀錄
All checks were successful
CD Pipeline / deploy (push) Successful in 1m10s
2026-04-29 23:36:23 +08:00
OoO
779b27f676 修復 P0 告警自癒鏈與測試收集
All checks were successful
CD Pipeline / deploy (push) Successful in 9m39s
2026-04-29 22:37:20 +08:00
OoO
53edcc0077 refactor(templates): 統一模板目錄並移除 fallback loader
ADR-017 Phase 3f-4:根目錄模板搬入 templates/,補 trends/login_history,移除 ChoiceLoader 根目錄 fallback,搬移 components,刪除 web/templates 下的空檔/死檔與 compose 舊模板 mount。
2026-04-29 21:44:38 +08:00
OoO
13fa165ee2 refactor(cache): 統一 cache SOT 並啟用 gunicorn preload
ADR-017 Phase 3f-2:新增 services/cache_manager.py,讓 sales/import/export/daily/dashboard 共用同一份 in-memory cache;cache_service 改為相容 shim;Dockerfile/docker-compose 啟用 gunicorn --preload。
2026-04-29 21:35:56 +08:00
OoO
2550ab45b1 refactor(routes): 刪除模組化死碼開關
ADR-017 Phase 3f-1 dead-switch sprint;改為直接註冊 Blueprint,移除 USE_MODULAR_ROUTES/register_blueprints,並加入重複路由啟動自檢。
2026-04-29 21:26:58 +08:00
OoO
d51d8031f5 refactor(routes): 遷移公開系統與 ABC 路由
ADR-017 Phase 3f-1 system sprint;新增無 prefix system_public_bp,保留公開 URL 與 backup CSRF;ABC detail 併入 sales_bp。
2026-04-29 21:22:29 +08:00
OoO
567f138b2d refactor(routes): 搬遷 sales 實作並刪除 app.py 重複路由
ADR-017 Phase 3f-1 sales sprint;sales_bp 改為真實實作,移除 app.py 7 條 sales duplicate route,保留 /growth_analysis Blueprint 版。
2026-04-29 21:16:55 +08:00
OoO
71ea819d06 refactor(routes): 刪除 app.py 首頁重複路由
ADR-017 Phase 3f-1 dashboard sprint;首頁改由 dashboard_bp 接管,並更新 url_for('index') 相容引用。
2026-04-29 21:11:45 +08:00
OoO
8fad8ebff0 refactor(routes): 刪除 app.py edm festival 重複路由
ADR-017 Phase 3f-1 edm sprint
2026-04-29 21:07:16 +08:00
OoO
1f88c2817b refactor(routes): 刪除 app.py import monthly 重複路由
ADR-017 Phase 3f-1 import/monthly sprint
2026-04-29 21:06:00 +08:00
OoO
512f93c6b1 refactor(routes): 刪除 app.py api 重複路由
ADR-017 Phase 3f-1 api sprint
2026-04-29 21:04:56 +08:00
OoO
43a2c5f638 refactor(routes): 刪除 app.py export 重複路由
ADR-017 Phase 3f-1 export sprint
2026-04-29 21:03:54 +08:00
OoO
f4149d4c05 fix(db): 補全 metadata model import 與 realtime sales ORM
ADR-017 Phase 3f-0
2026-04-29 21:00:46 +08:00
OoO
8fefea05da fix(daily_sales): 啟用 bp 版改進邏輯 + import 後跨 worker 清 cache,根除 #24 隱形 bug
All checks were successful
CD Pipeline / deploy (push) Successful in 1m6s
- 從 app.py 刪除 396 行的 /daily_sales、/daily_sales/export、/daily_sales/export_marketing
  三條 @app.route(行 5911-6306),讓 routes/daily_sales_routes.py 的 daily_sales_bp
  生效(first-registered wins,原 app.py 版本 shadow 了 bp)。
- bp 版改進點:_is_cache_valid() 帶 5 分鐘 TTL、/api/daily_sales/clear_cache 端點、
  完整模板參數(datetime_now / active_page)。
- services/import_service.py process_daily_sales_import return True 前,
  新增跨 gunicorn worker 清 daily_sales cache 邏輯:依 GUNICORN_WORKERS 次數呼叫
  internal /api/daily_sales/clear_cache,避免 4 worker 各持 5 分鐘舊快取
  導致「匯入 15323 筆但當日業績看不到」隱形 bug。

[P7-COMPLETION]
- 方案正確: 雙重佐證(refactor-specialist + web-researcher)確認 Flask first-registered
  wins,刪 app.py 內 route 即可讓 bp 接管;helper 函式(preprocess_daily_sales_data 等)
  為 dead code 但保守保留不影響執行。
- 影響完整: 全 repo grep 確認 _SALES_PROCESSED_CACHE 在 app.py 仍有 30+ 處使用
  (sales_analysis 等其他路由),未動到;helper 函式無外部 caller。
- Regression 風險: 低,bp 版簽名與行為相容;新 cache 清除走 internal HTTP 帶 try/except
  不影響主流程;若 GUNICORN_WORKERS 未設則默認 4 與生產一致。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 21:18:17 +08:00
OoO
e6768408e1 refactor(app.py): 抽出 /api/test_url + /brand_assets 至 misc_routes Blueprint
All checks were successful
CD Pipeline / deploy (push) Successful in 1m5s
- 新增 routes/misc_routes.py(40 行,2 routes:POST /api/test_url, GET /brand_assets)
- app.py 7012 → 6986(-26 行)
- requests 改為模組頂層 import(移除函數內 import 異味)
- 註冊位置貼齊 category_bp 後方

Phase 3e route handlers Blueprint 化第二棒,收納雜項小型 routes
2026-04-28 21:10:01 +08:00
OoO
8fce73bd4b refactor(app.py): 抽出 /api/categories CRUD 至 category_routes Blueprint
All checks were successful
CD Pipeline / deploy (push) Successful in 1m9s
- 新增 routes/category_routes.py(46 行,3 routes:POST/PUT/DELETE)
- app.py 7053 → 7012(-41 行)
- 沿用 services.json_storage.load_categories/save_categories
- 註冊位置貼齊 system_bp 後方

Phase 3e route handlers Blueprint 化首棒,邊界最小、無共用狀態
2026-04-28 21:04:40 +08:00
ooo
c91dc273f0 refactor(p1-01f): JSON 持久化抽到 services/json_storage.py
All checks were successful
CD Pipeline / deploy (push) Successful in 1m9s
- load_categories / save_categories / load_scheduler_stats 三個函數搬出
- CATEGORIES_JSON_PATH / SCHEDULER_STATS_PATH 常數同步搬移
- app.py 改 import 維持原呼叫路徑

行數變化: app.py 7,070 → 7,053 (-17)
2026-04-28 19:42:05 +08:00
ooo
f114c209ce refactor(p1-01e): repair_database_schema 抽到 database/schema_repair.py
All checks were successful
CD Pipeline / deploy (push) Successful in 1m7s
- 80 行 schema 修復邏輯抽出,搭配 _ensure_column helper 去除 7 個 promo_products 欄位重複碼塊
- app.py 改為 from database.schema_repair import repair_database_schema 維持原呼叫
- 行為 100% 對齊(含 SQLite WAL 啟用、products.created_at 補資料)

行數變化: app.py 7,151 → 7,070 (-81)
2026-04-28 15:51:44 +08:00
ooo
17cb012be7 refactor(p1-01c): 整併 utils/security 與 utils/validators 重複實作
All checks were successful
CD Pipeline / deploy (push) Successful in 1m6s
發現 utils/validators.py 已存在且完整重複 utils/security.py 的 9 個函數。
不收拾的話會繼續腐爛 — 立刻整併為單一權威來源。

變更:
- utils/security.py 增加 safe_read_sql(取自 validators.py 較完整版本,含 limit + params)
- utils/security.py ALLOWED_TABLES 取兩份聯集(補上 monthly_summary_analysis,
  realtime_sales_daily),避免破壞既有呼叫者
- utils/validators.py 改為純 re-export shim(保 from utils.validators import 不破)
- app.py 移除原 safe_read_sql 重複定義(35 行),改 import utils.security

routes/import_routes.py 不變(它 from utils.validators 走得到 re-export,等下輪統一)。

行數變化: app.py 7,187 → 7,151 (-36)
2026-04-28 15:48:41 +08:00
ooo
0a3f6cb22d refactor(p1-01b): app.py 文字/顏色/數字工具抽到 utils/text_helpers.py
All checks were successful
CD Pipeline / deploy (push) Successful in 1m7s
- slugify, get_color_for_string, extract_snapshot_date_from_filename, number_format
- @app.template_filter('number_format') 保留為 Jinja 註冊薄殼,實作走 utils
- app.py: 7,206 → 7,187 (-19)
2026-04-28 15:44:15 +08:00
ooo
f7a5f8505f refactor(p1-01a): app.py 安全工具抽到 utils/security.py
All checks were successful
CD Pipeline / deploy (push) Successful in 1m8s
從 app.py 抽出純驗證邏輯 (~180 行) 到 utils/security.py:
- ALLOWED_TABLES 白名單常數
- validate_table_name / validate_column_names (SQL injection 防護)
- safe_join (路徑遍歷防護)
- ALLOWED_UPLOAD_EXTENSIONS / ALLOWED_MIME_TYPES
- secure_filename_unicode / allowed_file / validate_upload_file (上傳驗證)

app.py 保留 from utils.security import * 維持 backward compat,
讓 tests/test_path_traversal.py、tests/test_sql_security.py、
tests/test_file_upload.py 不需修改即可繼續使用 from app import xxx。

行數變化: app.py 7,386 → 7,206 (-180)
2026-04-28 15:42:44 +08:00
ooo
841e136425 refactor(app.py): find_col 去重 — 改用 utils/df_helpers.py 共用實作
All checks were successful
CD Pipeline / deploy (push) Successful in 1m7s
- 移除 app.py 第 803 行的重複 find_col 定義(與 routes/daily_sales_routes.py 重複,已抽至 utils)
- 改為 from utils.df_helpers import find_col
2026-04-28 15:39:17 +08:00
ogt
b9fe98f591 refactor: centralize config — HERMES_URL, SSH params, validate_critical_config()
- config.py: add HERMES_URL (default 192.168.0.111:11434), SSH jump params, validate_critical_config()
- services/hermes_analyst_service.py: remove hardcoded HERMES_URL, import from config
- app.py: call validate_critical_config() on startup, log warnings for optional missing vars

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-27 21:27:47 +08:00