Commit Graph

218 Commits

Author SHA1 Message Date
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
8bd44b1131 修復 CD sync 後未 reload
Some checks are pending
CD Pipeline / deploy (push) Waiting to run
2026-04-30 09:02:29 +08:00
OoO
9750093abd fix(db): 重用 DatabaseManager engine pool
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-04-30 09:01:17 +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
d33a59d027 ci(cd): 納入 gunicorn config 變更觸發
Some checks are pending
CD Pipeline / deploy (push) Waiting to run
2026-04-30 00:20:16 +08:00
OoO
1c10bf7d3d fix(gunicorn): 跳過 request-bound proxy 掃描 2026-04-30 00:18:14 +08:00
OoO
8bc0fd7ff6 fix(gunicorn): preload 後重置 SQLAlchemy 連線池
Some checks failed
CD Pipeline / deploy (push) Failing after 9m32s
2026-04-30 00:07:10 +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
162a76b8f9 落地 L2 安全記憶動作
All checks were successful
CD Pipeline / deploy (push) Successful in 1m9s
2026-04-29 23:29:45 +08:00
OoO
5b25f55340 補齊 EventRouter 失敗通知回放
All checks were successful
CD Pipeline / deploy (push) Successful in 1m10s
2026-04-29 23:26:02 +08:00
OoO
d4865983d8 補強 ElephantAlpha 執行與通知閉環
All checks were successful
CD Pipeline / deploy (push) Successful in 1m10s
2026-04-29 23:14:09 +08:00
OoO
78eebfbcfc 加入告警去重與洞察向量回補
All checks were successful
CD Pipeline / deploy (push) Successful in 1m19s
2026-04-29 23:10:27 +08:00
OoO
0c2e9bbced 串接 AI 洞察向量化與漏通知入口
All checks were successful
CD Pipeline / deploy (push) Successful in 1m13s
2026-04-29 23:05:46 +08:00
OoO
f0e044aa48 補齊自癒稽核與 OpenClaw 記憶閉環
All checks were successful
CD Pipeline / deploy (push) Successful in 1m16s
2026-04-29 23:02:06 +08:00
OoO
1c2dc6cd61 補強 AI 自動化閉環與安全降級
All checks were successful
CD Pipeline / deploy (push) Successful in 1m14s
2026-04-29 22:56:00 +08:00
OoO
0875dd8fda 補強 5.5 自癒安全回看
All checks were successful
CD Pipeline / deploy (push) Successful in 1m11s
2026-04-29 22:48:24 +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
880511032a docs(governance): 建立 Codex 專案入口與記憶索引 2026-04-29 22:11:23 +08:00
OoO
4cbd775c1b fix(aiops): 補齊 Elephant Alpha trigger context
All checks were successful
CD Pipeline / deploy (push) Successful in 1m39s
部署閘門修復:補 autonomous engine 的 confidence/max decision 初始化與 _build_trigger_context,避免 scheduler autonomous monitoring 持續噴 AttributeError。
2026-04-29 21:48:41 +08:00
OoO
4d5a995718 chore: 刪除孤兒 AI service 並補齊 env 範例
ADR-017 Phase 3f-5:刪除未被 runtime 引用的 elephant_alpha_decision_router、telegram_ai_integration、watcher_agent;補 .env.example 的 Aider/AutoHeal/NVIDIA/OpenClaw/backup/report/PG sync 等實際讀取變數。
2026-04-29 21:46:24 +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
9528d6c23e fix(stability): 補強 scheduler 例外處理與 vendor 模板路徑
ADR-017 Phase 3f-3:移除 scheduler 裸 except,P1 任務失敗改走 EventRouter notify_failure 同步入口;清理 docker-compose vendor 死 mount;修正 vendor_bp template_folder 指向專案 web/templates。
2026-04-29 21:39:25 +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
38756fca71 fix(routes): 更新 dashboard 根模板首頁 endpoint
ADR-017 Phase 3f-1 dashboard follow-up;移除 app.py 首頁 route 後,根目錄 fallback dashboard.html 也改用 dashboard.index。
2026-04-29 21:13:47 +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
aa56479c66 refactor(routes): 刪除 dashboard brand_assets 重複路由
ADR-017 Phase 3f-1 dashboard/misc sprint
2026-04-29 21:09:26 +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
8be332728e docs: ADR-016 daily_sales cache fingerprint + 4/28-29 history log + CLAUDE.md ADR 索引補 015/016
- 新增 docs/adr/ADR-016:daily_sales cache TTL → TTL+DB fingerprint,棄用
  N-POST broadcast hack(命中率 9.4%),引述 debugger/web-researcher/migration-engineer
  三方共識;殘留 HIGH-2(app.py 43 處 _SALES_PROCESSED_CACHE)列管
- docs/memory/history_logs.md 新增 4/28-29 條目:app.py -10.8%、4 個改進版死碼揭發、
  cache 機制重構、hook 9 PoC 強化、12 Agent 並行作戰實踐
- CLAUDE.md 補上 ADR-015/016 索引項

Memory(個人 auto-memory,未入 repo)同步:
- feedback_flask_blueprint_shadow.md(first-registered wins)
- feedback_cache_invalidation_pattern.md(DB fingerprint vs N-POST)
- feedback_agent_dispatch_order.md(critic 必須先於 fullstack)
- feedback_cloud_vs_local_automation.md(LAN 專案禁雲端 routine)
- project_phase3e_refactor_progress.md(11 commits 戰果)
2026-04-29 19:56:48 +08:00
OoO
136e65b400 chore(hooks): momo-db 守門 9 PoC 強化(vuln-verifier 補丁)
All checks were successful
CD Pipeline / deploy (push) Successful in 1m8s
回應 vuln-verifier 對前版規則 3e 的 8/9 PoC 繞過警告。

新增/強化擋點:
- psql -f / heredoc / 重定向:hook 看不到 SQL 內容 → 一律擋
- multi-statement: ; 後接內容(去 -- 與 /* */ 註解後判斷)→ 擋
- writable CTE: WITH ... DELETE/INSERT/UPDATE → 擋
- /run/secrets, /proc/*/environ → 擋
- pg_read_file / pg_read_binary_file / lo_export / lo_import → 擋
- COPY ... FROM PROGRAM → 擋
- VACUUM FULL / REINDEX / REFRESH MATERIALIZED / CLUSTER 加入寫入黑名單
- env 加 (?!\\s+\\w+=) lookahead,避免誤殺 env VAR=value
- alias/function 包裝 docker exec:警告(無法靜態判斷後續呼叫)
- 白名單 prefix 不收 WITH(防 writable CTE 漏網),改收 SELECT/EXPLAIN/SHOW/VALUES/TABLE

settings.json: 累積本輪 session 的 read-only 工具放行(py_compile、python3)。
2026-04-29 09:12:26 +08:00
OoO
3971fd4020 fix(daily_sales): cache 失效改 DB fingerprint + clear_cache 加 @login_required
All checks were successful
CD Pipeline / deploy (push) Successful in 1m12s
回應 critic 對 8fefea0 的 4 個 HIGH finding(debugger/web-researcher/migration-engineer 三方共識):

HIGH-3 修復:
- /api/daily_sales/clear_cache 加 @login_required,避免外部 DoS 攻擊清快取

HIGH-4 修復(核心):
- 新增 _get_data_fingerprint(engine):SELECT MAX(snapshot_date), COUNT(*) FROM daily_sales_snapshot
- _is_cache_valid 改雙閘:TTL(保險絲)+ DB fingerprint(強一致)
- 三個 cache 寫入點同步記錄 fingerprint
- 移除 services/import_service.py 的 4-worker N-POST hack(命中率僅 9.4%,
  coupon collector 機率:4!/4^4 = 0.094)
- 資料寫入後指紋自動跳號,4 worker 下次 request 各自偵測失效並重載 → 強一致

附帶修:
- 統一 export/export_marketing 兩處 cache 寫入結構(補 timestamp/fingerprint),
  解決 db-expert 標記的「export 端點 cache 缺 timestamp 導致主看板每次都重讀」瑕疵

未處理(留待後續):
- HIGH-2: app.py 仍有 43 處 _SALES_PROCESSED_CACHE(sales_analysis 等其他路由的獨立 cache)
  待後續 P9 統一抽 services/cache_manager.py

[P7-COMPLETION]
方案: critic + debugger + web-researcher + migration-engineer 四方共識的方案 B
影響: routes/daily_sales_routes.py + services/import_service.py 兩檔
Regression: 每 request 多 1 次 SELECT MAX/COUNT(< 5ms),其餘行為等價
2026-04-29 09:10:23 +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
333fc159ae fix: CodeReview Gemini 模型從已下架 preview 換成 gemini-2.5-flash
All checks were successful
CD Pipeline / deploy (push) Successful in 1m6s
services/code_review_pipeline_service.py:41 OPENCLAW_MODEL 預設值
gemini-2.5-flash-preview-05-20 已被 Google 下架(404 not found),
改為穩定 GA 版本 gemini-2.5-flash。

驗證:直接 API 測試
- gemini-2.5-flash → 200 
- gemini-2.5-flash-preview-05-20 → 404 

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 21:01:44 +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