標定 PG sync 為 opt-in 工具
This commit is contained in:
@@ -48,6 +48,7 @@
|
||||
- `paramiko` 已確認沒有 runtime import;ADR-013 現行實作改以 `utils/ssh_helper.py` 組 CLI `ssh`,因此已從 `requirements.txt` 移除並補測試防止依賴殘影回來。
|
||||
- `pgvector` Python package 與 `matplotlib-inline` 已確認不是 runtime 依賴:pgvector 走 PostgreSQL extension + 本地 SQLAlchemy `Vector` type,Jupyter 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` 已覆蓋。
|
||||
|
||||
36
tests/test_pg_sync_contract.py
Normal file
36
tests/test_pg_sync_contract.py
Normal 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 == []
|
||||
Reference in New Issue
Block a user