perf(runtime): isolate workers and compress web assets
Some checks failed
CD Pipeline / deploy (push) Has been cancelled

This commit is contained in:
ogt
2026-07-11 09:48:41 +08:00
parent 6e65ef00bb
commit 0c85209ea1
21 changed files with 1124 additions and 436 deletions

View File

@@ -121,7 +121,7 @@
|---:|---|---|---|
| 44888 | `services/pchome_mapping_backlog_service.py` | P0 gate 巨型 service | 立即停止新增 closeout package拆 policy、executor、verifier、receipt、reporter |
| 14289 | `services/ai_automation_smoke_service.py` | P0 smoke 巨型 service | 拆 family registry、collectors、health projection、metrics adapter |
| 9442 | `routes/openclaw_bot_routes.py` | P0 巨型 Blueprint | route、command、report、scheduler hook 分離 |
| 9383 | `routes/openclaw_bot_routes.py` | P0 巨型 Blueprint、拆分進行中 | scheduler hook 已移到 `services/openclaw_bot/scheduled_jobs.py`;下一步拆 report、command |
| 7641 | `routes/ai_routes.py` | P0 巨型 Blueprint | PChome growth、AI automation、recommendation route extension 分離 |
| 5865 | `services/marketplace_product_matcher.py` | P0 matcher 巨型 service | identity、variant、unit、scoring、explanation 分離 |
| 5513 | `services/ppt_generator.py` | P0 報表巨型 service | orchestration、slides、charts、registry 分離 |
@@ -142,9 +142,9 @@
| 1417 | `services/telegram_templates.py` | P1 templates | decision、incident、report renderer 分離 |
| 1409 | `services/import_service.py` | P1 import | acquisition、validation、writer、verifier 分離 |
| 1394 | `services/telegram_bot_service.py` | P1 bot | command、formatter、client 分離 |
| 1370 | `run_scheduler.py` | P1 scheduler entry | registration、catchup、observability wrappers 分離 |
| 1440 | `run_scheduler.py` | P1 scheduler entry、拆分進行中 | OpenClaw timed-job registry 已外移;下一步拆 task registration 與 runtime startup |
| 1306 | `routes/system_public_routes.py` | P1 public routes | health、metrics、public projection 分離 |
| 1290 | `app.py` | P1 bootstrap | app factory 與 startup guards 分離 |
| 1269 | `app.py` | P1 bootstrap、拆分進行中 | web scheduler 相容層已移到 `services/web_scheduler_compat.py`;下一步拆 extension setup |
| 1272 | `services/code_review_pipeline_service.py` | P2 code review | scan、normalize、persist、report 分離 |
| 1202 | `services/pchome_revenue_growth_service.py` | P1 revenue growth | sales query、offer comparison、scoring、projection 分離 |
| 1188 | `services/ppt_auto_generation_service.py` | P2 PPT automation | resolver、queue、generator、catchup 分離 |
@@ -152,7 +152,7 @@
| 1023 | `routes/cicd_routes.py` | P2 CI/CD Blueprint | query、deploy action、route glue 分離 |
| 1014 | `services/pchome_crawler.py` | P1 crawler | transport、parser、fallback、rate policy 分離 |
| 1014 | `routes/daily_sales_routes.py` | P2 Daily Sales Blueprint | query、format、export、route glue 分離 |
| 1013 | `routes/export_routes.py` | P2 Export Blueprint | command、path policy、download 分離 |
| 1017 | `routes/export_routes.py` | P2 Export Blueprint | command、path policy、download 分離string dtype Excel sanitizer 已修正 |
| 989 | `routes/market_intel_routes.py` | P2 Market Intel Blueprint | page、API、MCP registration 分離 |
| 966 | `services/trend_crawler.py` | P2 trend crawler | adapters、parser、persistence 分離 |
| 942 | `services/learning_pipeline.py` | P2 RAG learning | distill、promotion、persistence、telemetry 分離 |
@@ -178,7 +178,7 @@
## 工作項目
1. P0持續拆 `routes/openclaw_bot_routes.py`Telegram API helper 已搬到 `services/openclaw_bot/telegram_api.py`Inline Keyboard builders 已搬到 `services/openclaw_bot/menu_keyboards.py`,下一步拆 report formatting 或 command dispatcher。
1. P0持續拆 `routes/openclaw_bot_routes.py`Telegram API helper、Inline Keyboard builders 與 10 個 timed-job scheduler hook 已搬離巨型 Blueprint,下一步拆 report formatting 或 command dispatcher。
2. P0`routes/sales_routes.py`,先把 chart/query/calendar 計算搬到 `services/sales/`
3. P0`scheduler.py`,建立 `jobs/``services/scheduler/` task registry。
4. P0`routes/admin_observability_routes.py`,先搬純查詢函式到 `services/observability_query_service.py`,再搬 AutoHeal / Code Review / AiderHeal / throttle mutation 到 `services/observability_action_service.py`
@@ -191,3 +191,10 @@
- `tests/test_modularization_governance.py` 會掃描所有 Python 檔案;任何新的 >800 行檔案沒有列在本 inventory 就會失敗。
- 若檔案拆小後低於 800 行,可從本清單移除並同步更新測試。
### 2026-07-11 自動盤點
- `python3 scripts/ops/report_codebase_modularization_performance.py` 會為 Python 與前端大型資產建立穩定 work item ID、P0/P1、`in_progress/not_started` 狀態與拆分方向。
- `momo-scheduler` 每日 04:15 執行同一盤點,原子寫入 `data/ai_automation/codebase_inventory/latest.json`;失敗只記 degraded receipt不得阻斷其他排程。
- 本次基線447 個 production Python modules、260,059 行、48 個大於等於 800 行模組、33 個大型前端資產、23 個 P0、6/6 runtime controls 通過program completion 69.1%runtime closure 仍為 partial。
- `services/openclaw_learning_service.py` 已降至 789 行embedding worker 的唯一 runtime owner 已移到 `momo-scheduler`,因此不再列入大檔債務,但仍需由 production worker/readback 驗證。