feat: improve architecture, remove redundacies and duplicaions, centralize ChromaDB into palace_db singleton, consolidate MCP tools 19→14, add test suite - #25
Conversation
|
Hey, really appreciate the effort here — it's clear you put serious thought into the architecture. However a +2798/-1887 rewrite is too large to review safely at this stage, especially with so many changes landing in parallel right now. We'd love your help in a different way — reviewing incoming PRs is incredibly valuable and helps you understand the codebase patterns before proposing structural changes. Once you have that context, smaller focused PRs that tackle one thing at a time are much easier for us to review and merge. Thanks for understanding! |
|
@bensig - I just buit a tool for that :) Will help in pleasure - let me know if you need help with specific PRs Check this out: You can use octocode-mcp with the |
Completes `git merge v3.3.6` on merge/v3.5.0-into-kostadis-dev. 18 conflict files resolved keeping local design at the divergence sites; §2 parallel-mine mechanics ported into the local pipeline (chunk-cap MemPalace#1455, Tier 6a content-date MemPalace#1584, config chunking, skip_reason); §embedding unified (provider switch + within-onnx model select, case-insensitive embedding_model). Fixed a silent auto-merge defect in backends/chroma.py: the merge dropped the `_HNSW_MISSING_METADATA_DATA_FLOOR` constant while keeping its usages, breaking 15 backend/HNSW tests with a NameError. Restored per upstream. Deferred (documented in docs/v3.5.0-merge-notes.md): MemPalace#1383 KG realpath cache canonicalization (kept local _kg_cache keying per §7); prefetch_mined_set. Tests: 2538 passed, 33 skipped, 2 pre-existing failures (baseline), no new failures. ruff-clean on merge-touched files. version.py = 3.3.6. Refs MemPalace#23. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
PR Review: cleanups
Executive Summary
Affected Areas:
palace_db.py(new),constants.py(new),mcp_server.py,layers.py,searcher.py,miner.py,convo_miner.py,palace_graph.py,knowledge_graph.py,cli.py,config.py,normalize.py,onboarding.py,entity_registry.py,room_detector_local.pyBusiness Impact: None — internal refactoring only. MCP tool surface shrinks from 19 to 14 tools (AI agents will need fewer calls).
Flow Changes: All ChromaDB access now routes through
palace_db.pysingleton. Where-filter construction centralized. KG queries use named column access.Ratings
PR Health
Medium Priority Issues
No medium priority issues remaining — #1 was fixed during review.
🎨 #2: PR description is empty
Location: PR body | Confidence: ✅ HIGH
The PR template is unfilled — "What does this PR do?" and "How to test" are blank. The RFC file (
.octocode/rfc/RFC-mempalace-cleanup.md) covers everything thoroughly, but the PR description should at least link to it and provide a one-liner summary for reviewers scanning the PR list.Low Priority Issues
🎨 #3: Shadow
MIN_CHUNK_SIZEhas no commentLocation:
mempalace/convo_miner.py:20(localMIN_CHUNK_SIZE = 30) vsmempalace/constants.py:45(MIN_CHUNK_SIZE = 50) | Confidence: ✅ HIGHThe RFC acknowledges this is intentional (conversations need smaller chunks than project files), but the code has no comment explaining the divergence. A reader will see
from .constants import CONVO_EXTENSIONS, SKIP_DIRSright above and wonder whyMIN_CHUNK_SIZEwasn't imported too.+ # Conversations use smaller minimum chunks than project files (constants.MIN_CHUNK_SIZE=50) MIN_CHUNK_SIZE = 30⚡ #4:
MempalaceConfig()created per function call inpalace_db.pyLocation:⚠️ MED
mempalace/palace_db.py:15,25,67| Confidence:get_client,get_collection, andno_palace_erroreach instantiateMempalaceConfig()on every call. The old pattern inmcp_server.pywas_config = MempalaceConfig()at module level (singleton). Config reads from~/.mempalace/config.json, so repeated instantiation means repeated file I/O.Not blocking — config files are tiny and OS-cached, but it's inconsistent with the module-level pattern used in
mcp_server.py.🏗️ #5: Stub method without deprecation signal
Location:⚠️ MED
mempalace/entity_registry.py:553-554| Confidence:learn_from_textreturns[]with a docstring "Stub — entity detection removed." The same pattern appears inonboarding.py:_auto_detect. These stubs are functionally correct, but callers have no programmatic signal that the feature is gone. Awarnings.warn("entity detection removed", DeprecationWarning)or removal of the method entirely (with callers updated) would be cleaner.What's Good
palace_db.pysingleton — Clean extraction. Cache key(path, name)handles multi-palace scenarios.reset()for testing is thoughtful.knowledge_graph.pyRow factory —row["obj_name"]instead ofrow[10]is a major robustness win. One schema change would have broken the old code silently.mempalace_statusnow returns graph stats + protocol + AAAK spec in one call. AI agents get full context in a single tool call instead of 3-4.constants.py— Simple, correct. No over-engineering.build_where_filter()— The 6→1 consolidation of where-filter logic is exactly the kind of DRY that prevents subtle divergence bugs.Created by Octocode MCP https://octocode.ai 🔍🐙