fix(core): use Observation.permalink in build_context to match the search index#946
Merged
Conversation
…atch the search index build_context rebuilt the synthetic observation permalink inline with no 200-char truncation (#446) and no content digest (#931), so for long observations it returned permalinks that don't exist in the search index. Use the Observation.permalink model property instead — the single definition of the format; the parent entity is already eager-loaded by ObservationRepository's load options. Regression test asserts the permalink returned by build_context equals the model property and the indexed row's permalink for a >200-char observation; it fails against the previous inline construction. Fixes #929 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Drew Cain <groksrc@gmail.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #929
Summary
build_contextrebuilt the synthetic observation permalink inline:with no 200-char truncation (#446) and no content digest (#931), so for observations longer than 200 chars it returned permalinks that don't exist in the search index.
As suggested in the issue: use the
Observation.permalinkmodel property instead, so there is exactly one place that defines the synthetic observation permalink format. No lazy-load hazard —ObservationRepository.get_load_options()already eager-loadsObservation.entity, andexecute_queryapplies those options to thefind_by_entitiesquery that feedsbuild_context.Test plan
test_build_context_observation_permalinks_match_search_index: a >200-char observation's permalink frombuild_contextmust equal both the model property and the indexed row's permalink. Verified it fails against the previous inline construction.tests/services/test_context_service.py— 13 passed (SQLite), 12 passed / 1 pre-existing skip (Postgres via testcontainers)test-int/mcp/test_build_context_validation.py+test_build_context_underscore.py— 8 passedruff check,ruff format --check,ty check src tests test-int— cleanNot included
The issue's second item — release notes for the #931-shipping version mentioning that pre-existing
search_indexrows keep digest-less permalinks until re-sync orbm reindex --search— belongs to the release runbook, not this change.🤖 Generated with Claude Code