標定 PG sync 為 opt-in 工具

This commit is contained in:
OoO
2026-05-13 11:53:01 +08:00
parent 8099bb6999
commit 49c576bc4f
2 changed files with 37 additions and 0 deletions

View File

@@ -48,6 +48,7 @@
- `paramiko` 已確認沒有 runtime importADR-013 現行實作改以 `utils/ssh_helper.py` 組 CLI `ssh`,因此已從 `requirements.txt` 移除並補測試防止依賴殘影回來。
- `pgvector` Python package 與 `matplotlib-inline` 已確認不是 runtime 依賴pgvector 走 PostgreSQL extension + 本地 SQLAlchemy `Vector` typeJupyter inline backend 不屬 production path兩者已從 `requirements.txt` 移除並補測試。
- `tests/test_pg_sync.py` 已改為 opt-in integration test預設不再連 localhost PostgreSQL 或建立/刪除測試表,需 `RUN_PG_SYNC_INTEGRATION=1` 且提供 `POSTGRES_PASSWORD` 才執行。
- `services/pg_sync_service.py` 是顯式 opt-in legacy CLI不是生產自動同步路徑`tests/test_pg_sync_contract.py` 已守住預設 OFF 與 runtime paths 不自動 import。
- `qwen3:14b` 不是未使用 Ollama 模型OpenClaw QA、NemoTron dispatch 與 LLM model router 仍有現役路徑;`tests/test_qwen3_runtime_usage.py` 已守住,不能只因體積大就三主機移除。
- Telegram `momo:eig:<event_id>` callback 已在 `routes/openclaw_bot_routes.py``services/telegram_bot_service.py` 實作並有 webhook 測試覆蓋,不是未實作缺口。
- Telegram `date_*` / `goal_*` 不是死 callback handler按鈕先送 `await:*` 進入輸入等待狀態,使用者下一則文字才由 pending action 消費;`tests/test_openclaw_bot_menu_keyboards.py``tests/test_openclaw_bot_routes_webhook.py` 已覆蓋。

View File

@@ -0,0 +1,36 @@
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def test_pg_sync_service_remains_explicit_opt_in_legacy_tool():
source = (ROOT / "services" / "pg_sync_service.py").read_text(encoding="utf-8")
assert "PG_SYNC_ENABLED', 'false'" in source
assert "python services/pg_sync_service.py --full" in source
assert "python services/pg_sync_service.py --verify" in source
assert "python services/pg_sync_service.py --daemon" in source
def test_runtime_paths_do_not_auto_wire_pg_sync_service():
active_paths = [
ROOT / "app.py",
ROOT / "scheduler.py",
ROOT / "run_scheduler.py",
ROOT / "routes",
ROOT / "services",
]
forbidden = "services.pg_sync_service"
offenders = []
for active_path in active_paths:
paths = active_path.rglob("*.py") if active_path.is_dir() else [active_path]
for path in paths:
if path.name == "pg_sync_service.py" or "__pycache__" in path.parts:
continue
source = path.read_text(encoding="utf-8")
if forbidden in source:
offenders.append(str(path.relative_to(ROOT)))
assert offenders == []