feat(adapters): SME adapter for the Go MemPalace server (sefodo26)#255
Conversation
Add MemPalaceServerAdapter for sefodo26's Go reimplementation of the MemPalace server (fork: techempower-org/mempalace-server). Talks to the server's REST API (/mp/api/v1, bearer auth) — the same shape the Go project's own benchmark harness uses — so SME numbers stay comparable. - ingest_corpus: one drawer per row (content ← document|content|text; wing/room ← row|metadata|session_id|id fallbacks), optional wing-scoped reset-before-ingest for per-question-haystack isolation. Handles the server's deterministic-id idempotency (already_exists) and bullet-splitting (bullets_stored) responses. Never raises on transport failure — errors are captured into the result dict. - query: POST /search, constructor n_results default, optional wing/room/max_distance (omitted by default → server default, matching the reference benchmark). Returns a QueryResult with error set, never raises. - get_graph_snapshot: projects GET /taxonomy through the shared project_graph (wing/room/member_of), identical to the daemon adapter. - reset(wing=None): paginated list+delete isolation (the server has no per-request tenant; MEMPALACE_TENANT_ID is server-level config). - get_harness_manifest: real Cat 9b surfaces — the MCP endpoint (health probe) and REST search — since the server's core identity is an MCP server. get_flat_retrieval / get_ontology_source provided. - Config via constructor → env (MEMPALACE_SERVER_URL / _API_KEY / _TENANT) → docker-compose defaults; zero-config against a fresh `docker compose up`. Registered in sme.cli (aliases mempalace-server / mempalace_server / mp-server; no rename). Added to the fork contract test kit. 31 mocked unit tests (fake_urlopen_factory) + 1 opt-in live round-trip test (MEMPALACE_SERVER_LIVE=1, skips cleanly when absent). ruff check clean; full suite green (pre-existing hindsight network failures unrelated). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 24 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces the MemPalaceServerAdapter to interface with the Go MemPalace server's REST API, along with CLI integration and comprehensive unit and contract tests. The feedback suggests adding defensive type checks in the query and get_graph_snapshot methods to robustly handle unexpected API response structures.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if not results: | ||
| return QueryResult( | ||
| answer="", | ||
| context_string="", | ||
| error="NO_RESULTS", | ||
| retrieval_path=retrieval_path, | ||
| ) |
There was a problem hiding this comment.
Defensively verify that results is a list before iterating over it. If the server returns an unexpected type for results (such as a dictionary or a string), iterating over it or calling .get() on its elements will raise an AttributeError or other runtime exceptions.
| if not results: | |
| return QueryResult( | |
| answer="", | |
| context_string="", | |
| error="NO_RESULTS", | |
| retrieval_path=retrieval_path, | |
| ) | |
| if not isinstance(results, list) or not results: | |
| return QueryResult( | |
| answer="", | |
| context_string="", | |
| error="NO_RESULTS", | |
| retrieval_path=retrieval_path, | |
| ) |
References
- Prefer keeping defensive null checks even if they are currently unreachable due to early returns. Such checks document the intended contract and prevent regressions if the function's control flow is refactored in the future.
| for wing_name, room_map in tree.items(): | ||
| room_map = room_map or {} | ||
| wings[wing_name] = sum(int(v or 0) for v in room_map.values()) | ||
| rooms.append({"wing": wing_name, "rooms": room_map}) |
There was a problem hiding this comment.
Defensively verify that room_map is a dictionary before calling .values() on it. If the server returns an unexpected taxonomy structure (e.g., a list or a string), calling .values() will raise an AttributeError and crash the snapshot projection.
for wing_name, room_map in tree.items():
if not isinstance(room_map, dict):
continue
wings[wing_name] = sum(int(v or 0) for v in room_map.values())
rooms.append({"wing": wing_name, "rooms": room_map})References
- Prefer keeping defensive null checks even if they are currently unreachable due to early returns. Such checks document the intended contract and prevent regressions if the function's control flow is refactored in the future.
…buted) + engram-2 deaccession note (#258) Adds sefodo26's Go+Postgres+AGE server to the field explorer with the 2026-07-04 structural readings (committed baselines; basis=taxonomy honestly recorded — the server does no KG auto-extraction, verified in source and live via SME #255/#257). Publishes his methodology-matched R@5 0.972 in the published_field column with source. Marks engram-2 withdrawn (repo deleted upstream; claims unverifiable). Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Contract adapter for sefodo26's Go+Postgres+AGE MemPalace server (our eval fork: techempower-org/mempalace-server), enabling multipass runs against it.
MemPalaceServerAdapterover REST/mp/api/v1(bearer auth): ingest / query / graph snapshot (via /taxonomy) / reset (list+delete — server tenancy is config-level, no per-request switch, documented)mempalace-server/mp-server; added to the fork contract kit — purely additive, no existing adapter touchedMEMPALACE_SERVER_LIVE=1, skips clean when absent)Two server behaviors the adapter handles (worth relaying to sefodo26): deterministic drawer IDs make re-ingest idempotent (
already_exists), and pure bullet-list content gets split into N drawers (bullets_storedresponse shape).🤖 Generated with Claude Code