Files
ewoooc/routes
OoO 1c81866541
All checks were successful
CD Pipeline / deploy (push) Successful in 2m29s
fix(ppt): final critic cleanup — Medium-1 OOXML order + Info-1/2 docs
清掉剩餘 critic finding(Medium-1 + Info-1 + Info-2):

Medium-1: _set_run_fonts 違反 OOXML CT_TextCharacterProperties 子元素順序
- 抽出 _insert_rpr_child(rPr, tag) helper:依 ECMA-376 §21.1.2.3 規定
  的順序表(_RPR_CHILD_ORDER)找正確位置插入
- 找第一個排在 target 之後的子元素 → insert 前面;否則 append
- 當前 from-scratch 場景安全;未來改讀模板 .pptx 時也不會踩雷
- 驗證:產生 monthly v3.1,399 個 rPr 全部符合 schema 順序,0 違反

Info-1: cleanup_expired_ppt_cache docstring 補語意說明
- 明確說明 dry_run=True/False 時 deleted_files / deleted_rows / freed_bytes
  欄位語意分別為「將刪除」預估值 vs「已實刪」實際值

Info-2: TEMPLATE_VERSIONS 標記退役 type
- growth / vendor / bcg 三個 type 從未實際落地(依 ADR-014 校正 2026-04-28)
- 加 DEPRECATED 註解,避免後人誤以為已支援

Info-3 SKIP(評估後不做):
- get_template_version import 改放模組頂部會 trigger ppt_generator 模組級
  REPORTS_DIR.mkdir() 副作用,read-only filesystem 環境會掛
- 保留延遲 import 是 graceful degradation 的 intentional 設計

至此 critic 38967ce 審查清單全綠:
- 0 critical, 2 HIGH (3b0b4b3), 4 medium (52c06f6 + 本 commit), 3 info

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 17:39:27 +08:00
..

路由模組說明

app.py 直接註冊所有 Flask BlueprintUSE_MODULAR_ROUTESregister_blueprints()MODULAR_ENDPOINTS 與 duplicate cleanup 開關已在 ADR-017 Phase 3f-1 移除。

啟動防線

app.py 會在啟動時檢查 app.url_map,同一組 (URL, HTTP methods) 不允許被兩個 endpoint 重複註冊;若發現衝突會直接 SystemExit

模組清單

模組 說明 主要路由
dashboard_routes.py 商品看板首頁 /
sales_routes.py 業績分析與 ABC 明細 /sales_analysis, /growth_analysis, /abc_analysis/detail, /api/sales_analysis/*
system_public_routes.py 無 prefix 公開系統頁與監控 /health, /metrics, /ai_automation_smoke, /api/ai-automation/smoke*, /settings, /system_settings, /logs, /api/logs, /api/backup
system_routes.py 內部系統維護 API /api/system/*
edm_routes.py EDM 與節慶儀表板 /edm, /festival
monthly_routes.py 月結分析 /monthly_summary_analysis, /api/monthly_summary_data
daily_sales_routes.py 當日業績 /daily_sales, /daily_sales/export*
api_routes.py 通用任務與查詢 API /api/run_task, /api/history/*
export_routes.py 匯出功能 /api/export/*
import_routes.py 匯入功能 /api/import_excel, /api/import/monthly_summary

新增 route 時請優先放入對應 Blueprint並用本機 app.url_map duplicate check 驗證。 若 route 內開始出現大量資料處理、SQL、AI prompt 或外部 API 呼叫,請依 docs/guides/modularization_governance.md 抽到 services/utils/,不要讓 Blueprint 變成新巨檔。