# Claude Code 盤點驗證記憶(2026-05-13) > 用途:接續 V1/V2 全棧盤點整改時,先看這份,避免把已修或已過期的項目重複當成阻擋。 ## 已驗證並修補 - `rag_query_log.saved_call`:已改為只有高信心 RAG 命中且跳過 LLM 時寫 `true`,並補測試。 - `ai_calls.rag_hit`:logger API 原本可寫但缺回歸測試;已補 `set_rag_hit(True)` 寫入測試。 - 舊 `SSH_JUMP_* / SSH_TARGET_*`:Python caller 已不存在;已從 `config.py` 與 `.env.example` 範例移除,執行路徑以 `ELEPHANT_ALPHA_JUMP_*` 為準。 - `filesystem-mcp`:`MCP_BASE_HOSTS` 與 health check 已存在;已補 `ops_diagnostics` 唯讀工具白名單,並測試 `read_file` 可通、`write_file` 被拒。 - `mcp_calls.status`:已補 `ok/cache_only/timeout/rate_limited/error` 細分,早退結果也會帶 `status='error'`。 - Telegram `cat_` callback:主 OpenClaw route 不是問題;polling bot helper 的預設 `cat` 才是潛在漏 handler。已改預設為既有 handler `trend` 並補測試。 - Scheduler 觀測任務:BGE-M3 embedding consistency 不一致、host health probe、AI error spike、觀測台日報與 cleanup 例外都已接 `_notify_scheduler_failure()`。 - AutoHeal Telegram inline:`obs_heal` 已用 `_CURRENT_USER_ID_CTX` 記錄實際 Telegram user,webhook request 開頭會清空 stale user context。 - 匯入檔名日期 helper:`routes/import_routes.py` 已改用 `utils.text_helpers.extract_snapshot_date_from_filename()` 單一來源,並用真實日期解析拒絕 `20261399` 這類不可能日期。 - `monthly_summary_analysis` 匯入已守住「刪同年月後 append」路徑,`tests/test_import_service_sql_params.py` 會防止該月結匯入區塊退回整表 `if_exists='replace'`。 - ROI 月報 feedback 區塊:反饋趨勢查詢失敗仍不阻擋月報,但已改為 warning + stack,避免完全靜默。 - Elephant Alpha short-circuit:`log_ai_call` 遙測失敗仍不阻擋省成本 return,但已改為 warning + stack。 - Claude cost throttle:成本節流檢查失敗仍維持 Claude 可用,但已改為 warning + stack,避免成本保護失效無跡可查。 - `ai_call_logger` caller registry:registry 匯入失敗仍不阻擋 LLM 遙測,但已改為 warning + stack。 - Observability route:promotion review RAG 相似查詢、PPT audit history 缺表、host health probe 寫入、MCP 24h summary 缺表等 fail-safe 區塊已改成 debug/warning log,不再完全靜默。 - Google Drive import:`services/import_service.py` 的日期 `IN (...)` 刪除/驗證查詢已改為 SQLAlchemy bind params,不再把 DataFrame 日期值拼進 SQL 字串。 - OpenClaw Bot:中文字型下載、趨勢同期 DB 查詢、匯入格式業績預覽解析等 best-effort 區塊已補 debug/exception/warnings,避免真正錯誤完全無跡可查。 - Telegram polling bot:舊 callback 正規化失敗、空 `momo:eig:` event_id 回覆失敗仍保持 fail-safe,但已補 debug log。 - `ai_call_logger._write_to_db` 不是死函數:它是 `_async_write()` 的 daemon thread target;`infer_caller_from_stack()` 確認無 caller 後已移除。 - `cache_manager.FingerprintCache` 與 dashboard shared cache 清理維持 fail-open / best-effort,但已補 debug log,避免 cache fingerprint 或檔案清理失敗完全沉默。 ## 已驗證為已修或過期 - migration / ORM:`032` 已入庫,`033` host label、`034` embedding_signature、`035` business baseline、`036` incidents 雙欄、`037` action_plans guardrails 均已存在。 - `migrations/031` 權限已是 `644`。 - `app.py` 的 `SYSTEM_VERSION` 已從 `config.py` import,app 內只留版本註解。 - V2 提到的 `app.py` 死 import 與 `scheduler.py import schedule` 已不成立;`app.py` 仍使用 `schedule.run_pending()` 等呼叫。 - `tests/test_phase3f_cleanup_contracts.py` 已補 guard:V2 點名的舊 app imports 不得回來,且 `app.py` 的 active `schedule` 用法不可被誤刪。 - V2 點名的 3 個 silent failure 點位已不是 `except: pass`:OpenClaw 趨勢圖暫存檔清理與 Notification public_url 讀取失敗都會記 log,並由 `tests/test_phase3f_cleanup_contracts.py` 守住。 - Cron 盲區清單多數已補 `_notify_scheduler_failure()`;ROI 月報已避開 09:00 改 09:05,AI smoke 已是 09:10。 - V2 指出的 9 個 cron 盲區已補回歸守門:8 個 `run_scheduler.py` wrapper 必須呼叫 `_notify_scheduler_failure()`,`scheduler.py::run_promo_event_task` 必須呼叫 `notify_failure()`。 - 09:00 排程衝突已有回歸守門:`daily_report=09:00`、`roi_monthly_report=09:05`、`ai_smoke_daily_summary=09:10` 必須保持錯開。 - AutoHeal inline host transition 告警已有 DB transition dedup 守門:`run_host_health_probe()` 只在健康狀態翻轉且 1h 內沒有同方向 transition 時推送。 - CD migration 全範圍冪等已有回歸守門:`.gitea/workflows/cd.yaml` 必須維持 024-099 pattern、`sort | uniq` 與 `for m in $V5_MIGRATIONS` apply loop。 - CD Observability production smoke 已補 timeout 守門:`quick_review.sh --observability-smoke` 必須帶 `--timeout 12`。 - 0-byte `database/momo*.db` 迷惑檔已不存在;真實 SQLite 僅在 `data/momo_database.db`。 - `.gitignore` 已涵蓋 `.claude/worktrees/`、`.tmp_*`、`tmp_*.png`、`MOMO Pro/`、root/uploads/screenshots 與 `MOMO Pro` uploads/screenshots,並由 `tests/test_gitignore_contracts.py` 守住。 - `cache_service.py` 已成為 `cache_manager.py` 的相容 shim,`_SALES_CACHE_TTL` 單一來源有測試鎖住。 - `aiops-core/requirements.txt` 已不存在,`aiops-core/README.md` 已標記此目錄只保留歷史 stub,不應安裝或部署。 - 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` 移除並補測試。 - `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` 已守住,不能只因體積大就三主機移除。 - Ollama host env 已加白名單護欄:`OLLAMA_HOST*` / `EMBEDDING_HOST` 只接受 GCP-A、GCP-B、111 或 110 proxy,誤設 188/localhost 會回到核准主機。 - OpenClaw QA / daily Hermes template / NemoTron qwen3 的 flag 文件與測試已對齊 Ollama-first 預設 ON;顯式 `false` 才是 Gemini/NIM legacy 緊急退路。 - `routes/price_comparison_routes.py` 的 MOMO crawler TODO 已接到既有 `services.momo_crawler.search_momo_products()`;未手動上傳 MOMO 商品時會自動抓 MOMO,再交給比價服務。 - 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` 已覆蓋。 - `mcp_calls.status` CHECK 已接受 `ok/error/timeout/rate_limited/cache_only`,與 `services/mcp_router.py` 的細分狀態一致。 - DB migration / ORM 覆蓋已有 `tests/test_migration_metadata_coverage.py` 守門,`Base.metadata.tables - migrations CREATE TABLE` 必須為空;`tests/test_ai_observability_models.py` 也鎖住 v5 observability ORM stub。 - V2 BLOCKED migration 守門已補:`031-037` 必須存在且 group/world-readable,`database/momo.db` / `momo_data.db` / `momo_database.db` 迷惑檔不得回來。 - `host_health_probes.chk_host_label_029` 不一致已有 migration 033 修補並補測試:必須重建 CHECK,且接受 `GCP-SSD`、`GCP-SSD-2`、`111 備援` 與兩個 110 Nginx proxy runtime labels。 - `rag_query_log` / `learning_episodes` 缺 `embedding_signature` 已由 migration 034、ORM 欄位、RAG/learning 寫入路徑與 migration metadata 測試覆蓋。 - `incidents` 雙欄相容與 `action_plans` source/status guardrails 已在 migration 036/037、migration metadata 測試與 `tests/test_auto_heal_safety.py` 覆蓋。 - `services/agent_actions.py` 不是死碼:`services/event_router.py` 透過 `SAFE_ACTIONS` registry 動態執行 ADR-012 L2 actions,`tests/test_agent_actions.py` 與 `tests/test_event_router.py` 已覆蓋並通過。 ## 不可盲動 - `services/agent_actions.py` 不能只看靜態 caller 清理;已確認它是 `SAFE_ACTIONS` 動態 dispatch 入口,未來改動必須同步更新 registry 與 EventRouter 測試。 - `logo_circle.svg` / `logo_navbar.svg` / `logo_transparent.png` 不能只因 runtime `rg` 無引用就刪;設計文件仍規劃品牌頁、登入頁、錯誤頁使用。 - 多個永遠 OFF feature flag 屬產品/上線策略決策,不應在清債時直接全部改 ON 或刪除。 - `ai_calls.rag_hit` 不等同 `rag_query_log.saved_call`:跳過 LLM 的 RAG 命中應記在 `rag_query_log.saved_call`;有實際 LLM 呼叫且 caller 明確用了 RAG context 時才適合標 `ai_calls.rag_hit`。 ## 本輪已推 commits - `36d0e5d` 標記 RAG 命中節省 LLM 呼叫 - `20cab6e` 補上 RAG hit logger 回歸測試 - `6817f64` 移除舊 SSH jump 設定殘影 - `44eb369` 補上 MCP filesystem 唯讀白名單 - `2068a37` 修正 Telegram 分類按鈕預設 callback - `bdb74b1` 告警 BGE embedding 一致性異常 - `d15b221` 細分 MCP 呼叫遙測狀態 - `34db2db` 修正 scheduler 合成告警 trace - `5785a58` 補齊 scheduler 觀測任務失敗告警 - `a335ab5` 修正 AutoHeal Telegram 觸發者審計 - `d7ae243` 清空 Telegram webhook 使用者上下文 - `ba8510e` 補齊 MCP 早退狀態 - `317ff1b` 共用匯入檔名日期解析 - `c300e49` 記錄 ROI 月報反饋區塊失敗 - `f49413e` 記錄 EA short-circuit 遙測失敗 - `0a75d11` 記錄 Claude 成本節流檢查失敗 - `5625032` 記錄 AI caller registry 匯入失敗 - `0bc6f18` 更新 Claude 盤點修補記憶 - `3cb091f` 記錄 Observability fail-safe 區塊失敗 - `e29529f` 校正 Observability 修補記憶 hash - `4e6e9bf` 綁定自動匯入日期查詢參數 - `47c59fd` 更新自動匯入修補記憶 - `ae79cdd` 記錄依賴盤點驗證結果 - `2b1174a` 移出誤入的本地變更 - `adfcccf` 補齊盤點修補 commit 清單 - `4256a04` 記錄 Telegram 與 MCP 缺口驗證 - `5285abe` 記錄 DB migration 覆蓋守門 - `f9d3da5` 記錄 AutoHeal DB guardrail 驗證 - `7e92850` 記錄 Agent Actions 動態入口驗證 - `89c400d` 補上 OpenClaw best-effort 區塊紀錄 - `ec5a22d` 記錄 Telegram pending action 驗證 - `f44c429` 補強 AI logger best-effort 診斷 - `8a36856` 補強 Telegram callback 診斷 - `5b52af9` 補強 cache best-effort 診斷 - `497c376` 記錄 AI smoke service 入口驗證 - `b22cbb2` 守住 scheduler 失敗告警覆蓋 - `8026b93` 守住 scheduler 早晨排程錯開 - `eb6886e` 同步 scheduler 排程摘要 - `b24241f` 守住 migration blocker 修補 - `6c86839` 守住盤點誤判依賴 - `2e2b775` 守住 V2 import 清理狀態 - `58ba95b` 守住月結匯入 append 路徑 - `4079f1c` 守住 CD migration 全範圍執行 - `81aa424` 守住 Observability smoke timeout - `dc99bab` 移出誤入的本地變更 - `546c63f` 守住 V2 silent failure 修補 - `c165081` 守住 host label migration 對齊 - `4921275` 守住 RAG embedding signature migration - `035b88c` 守住 AutoHeal migration guardrails - `5b6b35f` 守住 AutoHeal inline 告警去重 - `749eace` 移除未使用 Paramiko 依賴 - `3c65034` 移除未使用 runtime 依賴