Skip to content

fix(search): age-fused graph-only hydration uses real columns (closes #201) - #202

Merged
jphein merged 1 commit into
mainfrom
fix/age-fused-hydration-columns
May 30, 2026
Merged

fix(search): age-fused graph-only hydration uses real columns (closes #201)#202
jphein merged 1 commit into
mainfrom
fix/age-fused-hydration-columns

Conversation

@jphein

@jphein jphein commented May 30, 2026

Copy link
Copy Markdown
Collaborator

Fixes the silent vector-only fallback on /search/age-fused: the #150 graph-only hydration query referenced content + created_at, which don't exist on mempalace_drawers (cols: id, document, embedding, metadata, wing, room, doc_tsv). Now selects document + 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

…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>
Copilot AI review requested due to automatic review settings May 30, 2026 07:15
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, 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

  • SQL Query Correction: Updated the _hydrate_drawers query to reference the correct columns (document and metadata->>'created_at') in the mempalace_drawers table.
  • Data Parsing Adjustment: Simplified the created_at field parsing to handle the new JSON-extracted value format from the database.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@jphein
jphein merged commit 2eb9e3d into main May 30, 2026
1 check failed
@jphein
jphein deleted the fix/age-fused-hydration-columns branch May 30, 2026 07:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

jphein added a commit that referenced this pull request May 30, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(search): /search/age-fused graph-only hydration selects non-existent columns (content, created_at) → silent vector-only fallback

2 participants