Conversation
- polardb.py: delete unreferenced *_old/_ccl methods that reference an unassigned self.connection (would raise AttributeError if called), and fix __del__ to close the real connection_pool - chat_handler.py: replace full chat request logging with a whitelisted summary, masking business_key and excluding query/history/prompt content - .gitignore: ignore FuXi CLI local state (.fuxi/) Co-Authored-By: FuXi <fuxicodex@gmail.com>
🤖 Open Code ReviewTarget: PR #2377 🔍 OpenCodeReview found 10 issue(s) in this PR. 1.
|
✅ Automated Test Results: PASSEDAll tests passed (3/3 executed). memos_python_core/changed-python-source: 3/3. Duration: 8s Branch: |
- src/memos/api/config.py: correct 7 misplaced docstrings (vllm/activation/ reranker/neo4j variants), add missing @staticmethod on get_milvus_config, and fix Nacos config log that never printed its payload - apps/memos-local-plugin/adapters/deepseek-harness/index.ts: wrap session/event callback in try/catch so a malformed host event cannot break DSH's event loop (matches fail-open pattern of other handlers) - docker/requirements*.txt: drop pytest/pluggy/iniconfig test-only deps from production image requirements - .gitignore: ignore root node_modules/ as a catch-all Co-Authored-By: FuXi <fuxicodex@gmail.com>
❌ Automated Test Results: FAILED
Error detailsBranch: |
Implement get_neighbors / get_path / get_context_chain which were stubs raising NotImplementedError in both backends. Postgres already had working implementations; this closes the gap so graph traversal works across all supported graph backends. - get_neighbors: supports in/out/both direction, ANY type wildcard, DISTINCT dedup, and per-user filtering in non-multi-db mode - get_path: shortest directed/undirected path up to max_depth (neo4j via shortestPath, PolarDB via AGE variable-length match) - get_context_chain: delegates to get_neighbors(id, type, "out"), matching the existing postgres implementation Co-Authored-By: FuXi <fuxicodex@gmail.com>
|
Resolve 10 issues from Open Code Review on MemTensor#2377: - deepseek-harness/index.ts: log full error stack instead of String(error) which dropped trace (L423-427) - polardb get_neighbors/get_path: enforce relationship-type allowlist and validate/sanitize ids before Cypher interpolation, preventing `$$` dollar-quote breakout injection (L954-956, L1089-1090) - polardb get_neighbors/get_path: properly decode agtype objects via .value and skip NULL rows instead of appending "None" (L986-991, L1103-1104) - polardb drop_database: document intentional no-op so callers are not silently misled - neo4j get_neighbors/get_path: relationship-type allowlist (L680), inline & cap max_depth since Neo4j rejects parameterized hop bounds (L806), require user_name in non-multi-db mode to prevent tenant isolation gap (L693-695, L798) Co-Authored-By: FuXi <fuxicodex@gmail.com>
|
- chat_handler.py: frozenset whitelist for O(1) lookups; lazy log guard so request serialization is skipped when INFO is disabled - index.ts: merge error stack into single warn call for correlation - neo4j get_neighbors/get_path: explicit tenant-isolation contract note for multi-db mode; max_depth type validation; document 2x traversal cost of 'both' direction - polardb get_neighbors/get_path: replace quote-escaping (invalid in AGE Cypher) with strict character allowlist via re.fullmatch; only apply user_name filter when configured (multi-db may have none); re-raise DB errors instead of swallowing as empty result Co-Authored-By: FuXi <fuxicodex@gmail.com>
❌ Automated Test Results: FAILED
Failed tests:
Error detailsBranch: |
Summary
Cleaning pass on two files found during a full project audit:
src/memos/graph_dbs/polardb.py(–597 lines): removes six unreferenced legacy methods (edge_exists_old,get_edges_old,get_neighbors_by_tag_old,get_grouped_counts1,get_all_memory_items_old,get_neighbors_by_tag_ccl) plus unreachable code indrop_database. All of them referencedself.connection, which is never assigned in the class (onlyself.connection_poolis), so they would raiseAttributeErrorif ever called.__del__is fixed to close the real connection pool viacloseall()instead of checking the phantomself.connection.src/memos/api/handlers/chat_handler.py: request logging no longer prints the full Pydantic model, which could leak memory content (query/history/system_prompt) and thebusiness_keyauth credential. A whitelisted summary now logs safe fields and masksbusiness_key..gitignore: ignore FuXi CLI local state (.fuxi/).Why
_old/_cclvariants silently crash onself.connection.Test plan
python -m py_compilepasses for both modified .py filesself.connection(non-pool) references remainbusiness_key, excludes query/prompt, keeps whitelist fields (3 cases pass)Checklist
🤖 Generated with FuXi