收緊模組化治理掃描範圍

This commit is contained in:
OoO
2026-05-13 12:12:27 +08:00
parent 86fc9c94c7
commit ec93d09c18
2 changed files with 9 additions and 2 deletions

View File

@@ -7,7 +7,7 @@
- Python 總量:約 97,677 行(排除 `venv/``backups/``__pycache__/``.claude/worktrees/`)。
- 最大壓力區:`services/` 約 39,444 行、`routes/` 約 28,362 行。
- `app.py` 目前約 1,227 行,功能定位應固定為 bootstrap / Blueprint registration / startup guard不再承接新 route。
- 目前工作樹仍有 23 個 Python 檔案達到或超過 800 行;這些不是禁止修 bug而是禁止繼續塞新功能。
- 目前工作樹仍有 24 個 Python 檔案達到或超過 800 行;這些不是禁止修 bug而是禁止繼續塞新功能。
- 2026-05-05 追記Phase 38→56 觀測台戰役讓 `routes/admin_observability_routes.py``run_scheduler.py` 進入大檔治理清單;後續觀測台功能應先抽 query/action service不再把新 SQL 與 L2 mutation 直接塞回 route。
- 2026-05-06 追記跨平台市場情報模組啟動前必須先把新增爬蟲、排程、DB schema、UI route 全部隔離在 `market_*` / `services/market_intel/` / `routes/market_intel_routes.py`,不可塞回既有大檔。
@@ -35,6 +35,7 @@
| 867 | `services/token_report_service.py` | P2 token report service | query / aggregation / chart payload / notification formatting |
| 852 | `services/import_service.py` | P2 import service | validators / import writers / report builders |
| 832 | `routes/export_routes.py` | P2 Export flow | export command/router glue / file path / download orchestration |
| 818 | `routes/daily_sales_routes.py` | P2 Daily Sales Blueprint | route glue / export helpers / daily query and formatting service |
| 813 | `services/ollama_service.py` | P2 Ollama client | host health / request client / fallback policy / response parsing |
| 805 | `services/competitor_price_feeder.py` | P2 competitor price feeder | crawler scheduling / price normalization / cache strategy |
| 805 | `routes/bot_api_routes.py` | P2 Bot API Blueprint | route glue / bot action service |

View File

@@ -7,11 +7,17 @@ GUIDE = ROOT / "docs/guides/modularization_governance.md"
def _python_line_counts():
ignored_parts = {".git", "venv", "backups", "__pycache__", ".pytest_cache"}
ignored_parts = {".git", ".venv", "venv", "backups", "tests", "__pycache__", ".pytest_cache"}
ignored_prefixes = {
("docs", "design"),
("docs", "design_audit_frontend"),
}
for path in ROOT.rglob("*.py"):
parts = path.relative_to(ROOT).parts
if any(part in ignored_parts for part in parts):
continue
if parts[:2] in ignored_prefixes:
continue
if len(parts) >= 2 and parts[0] == ".claude" and parts[1] == "worktrees":
continue
with path.open(encoding="utf-8", errors="ignore") as handle: