docs(modularization): 建立模組化治理守門
All checks were successful
CD Pipeline / deploy (push) Successful in 1m36s
All checks were successful
CD Pipeline / deploy (push) Successful in 1m36s
This commit is contained in:
@@ -112,3 +112,15 @@ Phase 3e(4/28-29)完成 app.py 7,386→6,590 行(-10.8%),但**僅完
|
||||
- 模板僅存 `templates/` + `web/templates/vendor_stockout/`
|
||||
- gunicorn `--preload` 啟用、cache 跨 worker 一致
|
||||
- scheduler 7 處 except 全改、docker-compose mount 全清
|
||||
|
||||
## 2026-04-30 補充決策:模組化治理守門
|
||||
|
||||
Phase 3f 已陸續完成 DB metadata、路由註冊、cache、scheduler、模板與 orphan cleanup 的多個收斂項目,但 line-count 盤點仍顯示 15 個 Python 檔案超過 800 行。為避免後續功能開發再次把 route / service 寫成巨檔,本 ADR 補充以下守門規則:
|
||||
|
||||
1. `app.py` 只保留 Flask app bootstrap、Blueprint registration、啟動自檢、版本與全域設定;不得新增 route 或商業邏輯。
|
||||
2. `routes/` 必須保持 thin controller,重複邏輯需抽到 `services/` 或 `utils/`。
|
||||
3. 超過 800 行的 Python 檔案列入 `docs/memory/code_modularization_inventory_20260430.md`,只能做安全修補、bugfix、或往外抽模組;新增功能應先拆分。
|
||||
4. 新增 Python 檔案超過 600 行需提出拆分理由;超過 800 行需同步更新 inventory 與測試。
|
||||
5. `tests/test_modularization_governance.py` 是守門測試:新巨檔沒有被盤點會失敗。
|
||||
|
||||
詳細操作規則以 `docs/guides/modularization_governance.md` 為準。
|
||||
|
||||
Reference in New Issue
Block a user