perf(runtime): isolate workers and compress web assets
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
# PChome 業績成長自動化作戰系統 — AI 競價情報模組 Single Source of Truth
|
||||
|
||||
> **最後更新**: 2026-07-10 (台北時間)
|
||||
> **最後更新**: 2026-07-11 (台北時間)
|
||||
> **狀態**: 🟠 Partial。四 Agent、PixelRAG、MCP/RAG registry、PChome controlled-preview families 與多項 smoke/readback 已建立;但 access control、database identity/RBAC、full asset reconciliation、software supply chain、same-run controlled apply、restore drill、internal RAG canary 與 MCP/RAG runtime closure 尚未全部完成。任何局部 receipt 不得代表整體閉環完成。
|
||||
> **適用版本**: V10.773
|
||||
> **適用版本**: V10.777
|
||||
|
||||
---
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
- Gitea CD 必須執行 `report_security_governance_review.py --strict`,且不得解析 GitHub action/source/image。
|
||||
- production 安全與治理完成度必須分開顯示 program、asset coverage、runtime closure;目前結論是 partial,不是 complete。
|
||||
- 目前 ordered P0 以 `docs/guides/ai_automation_mainline_work_items.md` 為準:先關閉 access exposure,再做 identity/RBAC、webhook trust、supply chain、asset reconciliation、controlled-apply envelope、internal RAG canary 與 MCP/RAG runtime closure。
|
||||
- V10.777 起 web process 只能註冊 OpenClaw Blueprint,不得在 import 或 `record_once` 啟動 APScheduler、timed jobs 或 embedding thread;10 個 OpenClaw timed jobs 與唯一 embedding worker runtime owner 必須由 `momo-scheduler` 明確啟動。每日 04:15 的 codebase inventory 只掃描程式與前端資產並寫 artifact receipt,不讀 secret、不寫業務 DB。
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -47,3 +47,10 @@
|
||||
- 是否讓既有 >800 行檔案淨增加?若是,先抽模組或更新 inventory 與拆分計畫。
|
||||
- 是否新增重複 cache / DB manager / Telegram / AI client 初始化?若是,改用既有 service。
|
||||
- 是否需要更新 ADR、memory、SOT 或 guide?若是,本次 commit 一起更新。
|
||||
|
||||
## 自動盤點與狀態回寫
|
||||
|
||||
- 本機或 CI 使用 `python3 scripts/ops/report_codebase_modularization_performance.py` 取得 JSON;加 `--write` 才原子寫入 receipt。
|
||||
- 正式 `momo-scheduler` 每日 04:15 自動執行,receipt 固定為 `data/ai_automation/codebase_inventory/latest.json`。
|
||||
- work item 狀態只允許 `completed`、`in_progress`、`not_started`;拆出 helper 不代表整個巨型模組 completed。
|
||||
- source/test 綠燈只代表候選變更可部署;必須另有 scheduler receipt、web process 無背景 worker、壓縮/cache header 與 production health readback 才能關閉 runtime lane。
|
||||
|
||||
@@ -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 驗證。
|
||||
|
||||
Reference in New Issue
Block a user