fix(search): age-fused graph-only hydration uses real columns (closes #201) - #202
Conversation
…nt, metadata->>'created_at') The #150 graph-only hydration query selected 'content' and 'created_at' from mempalace_drawers, but that table has {id, document, embedding, metadata, wing, room, doc_tsv} — so every /search/age-fused with graph-only hits raised 'column "content" does not exist', logged 'graph-only hydration failed', and fell back to vector-only (200 OK but no KG enrichment). 0 such errors before the 2026-05-29 23:37 deploy, 195 after. Fix: content->document, created_at-> metadata->>'created_at' (text; mapping no longer calls .isoformat). Closes #201. Unblocks familiar.realm.watch#88. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a regression in the age-fused search functionality by correcting the SQL hydration query. It replaces invalid column references with the correct schema fields for the mempalace_drawers table, ensuring that graph-only hydration functions as expected and resolving associated runtime errors. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the '_hydrate_drawers' function in 'search_routes.py' to query the 'document' column instead of 'content', and retrieves the 'created_at' timestamp from the 'metadata' JSON field instead of a dedicated column. Consequently, the mapping logic is simplified to handle the string representation directly instead of calling '.isoformat()'. I have no feedback to provide.
…use the SME #117 reorder (#203) SME #117 found a daemon restart reordered 49% of /search top-5 on identical-looking data, +32% context. A deterministic reranker reloading the same model shouldn't reorder. This probe answers it. Finding: the rerank stage IS deterministic across restart (proven, code + empirical). FlashRank's ONNX pairwise path is a pure function of (query, passage, weights); the final sort is stable Timsort; rerank_hits reconstructs by original index with no dict-order/float-tie dependence. The probe confirms: same input reranked 5× in-process AND across two fresh process loads (restart sim) → byte-identical order + scores (<1e-9). So the #117 reorder was NOT rerank nondeterminism — it was a candidate-set change upstream: the 2026-05-29 DB rebackfill re-merged checkpoint drawers into the searchable collection (862 confirmed on the live palace), changing the vector ANN neighbours fed to the (deterministic) reranker. Ruled out: #202 (age-fused path, not used by plain /search), the kind filter (both runs used kind=all), and any haystack change (lme drawers filed 05-25). A one-time data migration, NOT an ongoing regression. Latent risk flagged (not changed here — operator call): flashrank is pinned >=0.2.10 (a floor) and PALACE_RERANK_MODEL is unset; a fresh deploy could pull a newer flashrank with different weights and reorder for real. Recommend an exact pin + explicit model env in the systemd unit. - docs/evals/2026-05-30-retrieval-determinism.md — full finding - tests/test_rerank.py::TestRerankDeterminism — pins the guarantee - scripts/evals/rerank_determinism_probe.py — standalone reproducer All read-only against prod (one /search count query + process metadata); no prod restart, no writes. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fixes the silent vector-only fallback on /search/age-fused: the #150 graph-only hydration query referenced
content+created_at, which don't exist onmempalace_drawers(cols: id, document, embedding, metadata, wing, room, doc_tsv). Now selectsdocument+metadata->>'created_at'. 0 hydration errors before the 23:37 deploy, 195 after — this returns the graph half to age-fused results. 603 tests pass + the 3 age-fused hydration tests. Closes #201; unblocks familiar.realm.watch#88.🤖 Generated with Claude Code