fix(governance): align inventory with runtime image

This commit is contained in:
ogt
2026-07-11 09:59:39 +08:00
parent 603352b88a
commit 2c167cd396
3 changed files with 26 additions and 3 deletions

View File

@@ -206,5 +206,5 @@
- `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,05948 個大於等於 800 行模組、33 個大型前端資產、23 個 P0、6/6 runtime controls 通過;program completion 69.1%runtime closure 仍為 partial。
- 本次基線以 production image build context 為準;`.dockerignore` 排除的 `.claude`、data/logs、docs 與 infra sources 不計入 runtime coverage。V10.777 同版 scanner 為 443 個 production Python modules、259,76448 個大模組、33 個大型前端資產、23 個 P0、6/6 runtime controlsprogram completion 69.1%runtime closure partial。禁止手動沿用舊的 447-module 基線。
- `services/openclaw_learning_service.py` 已降至 789 行embedding worker 的唯一 runtime owner 已移到 `momo-scheduler`,因此不再列入大檔債務,但仍需由 production worker/readback 驗證。

View File

@@ -21,11 +21,26 @@ IN_PROGRESS_PYTHON_PATHS = {
"run_scheduler.py",
}
IGNORED_PARTS = {
".claude",
".docker",
".git",
".gitea",
".github",
".pytest_cache",
".venv",
"__pycache__",
"aiops-core",
"backups",
"data",
"docs",
"k8s",
"logs",
"memory",
"n8n-workflows",
"node_modules",
"runtime_artifacts",
"secrets",
"ssl",
"tests",
"venv",
}
@@ -36,8 +51,6 @@ def _iter_python_files(root: Path) -> Iterable[Path]:
relative = path.relative_to(root)
if any(part in IGNORED_PARTS for part in relative.parts):
continue
if relative.parts[:2] in {("docs", "design"), ("docs", "design_audit_frontend")}:
continue
yield path

View File

@@ -3,6 +3,8 @@ from datetime import datetime, timezone
from pathlib import Path
from services.codebase_modularization_performance_service import (
ROOT,
_iter_python_files,
build_codebase_inventory,
write_codebase_inventory_receipt,
)
@@ -44,6 +46,14 @@ def test_inventory_receipt_write_is_atomic_and_readable(tmp_path):
assert not target.with_suffix(".json.tmp").exists()
def test_production_inventory_excludes_docker_build_ignored_sources():
paths = {path.relative_to(ROOT).as_posix() for path in _iter_python_files(ROOT)}
assert "data/__init__.py" not in paths
assert "logs/__init__.py" not in paths
assert not any(path.startswith(".claude/") for path in paths)
def test_scheduler_owns_daily_inventory_runtime():
source = (Path(__file__).resolve().parents[1] / "run_scheduler.py").read_text(encoding="utf-8")