From 3c6503446d5a50b06cf9388c1155c8358582797b Mon Sep 17 00:00:00 2001 From: OoO Date: Wed, 13 May 2026 11:32:59 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=9C=AA=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=20runtime=20=E4=BE=9D=E8=B3=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/memory/claude_inventory_validation_20260513.md | 1 + requirements.txt | 2 -- tests/test_requirements_pinning.py | 11 +++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/memory/claude_inventory_validation_20260513.md b/docs/memory/claude_inventory_validation_20260513.md index bbc63d2..8f07efb 100644 --- a/docs/memory/claude_inventory_validation_20260513.md +++ b/docs/memory/claude_inventory_validation_20260513.md @@ -46,6 +46,7 @@ - V2 提到的「死依賴」不可整批刪:`beautifulsoup4` 用於多個 crawler、`google-api-python-client` 用於 Google Drive、`google-generativeai` 用於 Gemini paths、`python-pptx` 用於 PPT generator、`matplotlib` 用於 Telegram/圖表/PPT。 - `tests/test_requirements_pinning.py` 已鎖住上述被 V2 誤列的 runtime dependencies:套件需留在 `requirements.txt`,且至少一個 runtime import 證據仍存在。 - `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` 移除並補測試。 - Telegram `momo:eig:` 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` 已覆蓋。 - `services/ai_automation_smoke_service.py` 不是死 service:`run_scheduler.py` 每日 09:10 掛 `run_ai_smoke_daily_summary_task()`,該 task 會呼叫 `send_smoke_daily_summary()`;`tests/test_ai_automation_smoke_service.py` 與 `tests/test_ai_automation_metrics.py` 已覆蓋。 diff --git a/requirements.txt b/requirements.txt index 78464ed..7aced09 100644 --- a/requirements.txt +++ b/requirements.txt @@ -23,8 +23,6 @@ beautifulsoup4>=4.14.3 lxml>=6.1.0 prometheus-client>=0.25.0 python-telegram-bot[job-queue]>=20.0 -pgvector>=0.2 python-pptx>=1.0.2 # ADR-014: PPT 簡報系統 matplotlib>=3.9.4 # 圖表生成(日報/週報/月報) -matplotlib-inline>=0.2.2 # Jupyter 相容層(可選) psutil>=5.9 # ADR-019 Phase 2: ElephantAlpha system load 真實量測(production 必裝;缺失時 fallback 為 queue-based 估算) diff --git a/tests/test_requirements_pinning.py b/tests/test_requirements_pinning.py index 635f065..684caa8 100644 --- a/tests/test_requirements_pinning.py +++ b/tests/test_requirements_pinning.py @@ -86,3 +86,14 @@ def test_cli_ssh_helper_replaces_legacy_paramiko_dependency(): assert "subprocess.run" in helper_source assert '"ssh"' in helper_source assert "paramiko" not in helper_source + + +def test_pgvector_extension_uses_local_sqlalchemy_type_not_python_package(): + requirements = _requirement_names() + ai_models_source = (ROOT / "database" / "ai_models.py").read_text(encoding="utf-8") + migration_source = (ROOT / "migrations" / "009_pgvector_embedding.sql").read_text(encoding="utf-8") + + assert "pgvector" not in requirements + assert "matplotlib-inline" not in requirements + assert "class Vector(UserDefinedType)" in ai_models_source + assert "CREATE EXTENSION IF NOT EXISTS vector" in migration_source