fix(query): reach the not-indexed marker on the not_found path - #885
Merged
Conversation
query_graph returns early with status not_found for every pattern except consumers_of and file_summary, so an unresolved target never reached the empty-result path where the confidence marker is attached. The marker was only observable through file_summary, which is what the original test used. Attach it to the not_found response too, and check for an empty or stale graph before declaring a target simply unindexed. A stale graph explains the miss and has a remedy, so it outranks wording that reads like a permanent parser limitation. Verified against this repository's own graph, built three months and many commits behind HEAD: callers_of on a function that plainly exists now says the graph predates HEAD and to update it, where before it said the symbol was not indexed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012fHfGDiZedoxjpKzanHri3
code-review-graph reviewOverall risk: 0.75 (HIGH) — 8 changed function(s)/class(es), 0 affected flow(s), 1 test gap(s) Risk-scored changes
Test gaps
Token savings: this graph-backed report used ~17,804 fewer tokens (~91%) than reading every changed file in full (estimated, chars/4 approximation). Powered by code-review-graph — local-first analysis; no code leaves the CI runner. |
This was referenced Aug 19, 2026
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.
Follow-up to #884, found by smoke-testing the merged feature against this repository's own graph rather than trusting the tests.
The gap
query_graphreturns early at query.py:375 withstatus: "not_found"for every pattern exceptconsumers_ofandfile_summary. An unresolved target therefore never reached the empty-result path where #884 attaches the marker. The feature's most valuable case, telling an agent that a zero means "I never indexed this", was unreachable for 14 of the 16 query patterns in production. The original test did not catch it because it exercisedfile_summary, one of the two patterns that skip that branch.The fix
Attach the marker to the
not_foundresponse, and check for an empty or stale graph before declaring a target simply unindexed. Priority now matches whatsemantic_search_nodesalready did: empty graph, then stale graph, then genuinely not indexed.A stale graph explains the miss and has a remedy, so it outranks wording that reads like a permanent parser limitation.
Verified against a real stale graph
This repository's checked-in graph was built on 2026-05-16 at commit
52cf3bc, with HEAD at455a85a. Querying a function that plainly exists in the source:Before:
After #884 alone:
After this change:
The first is silent, the second blames the parser, the third names the actual cause and the fix.
Tests
9 new tests: the marker is present on
not_foundacross five patterns (the reachability regression), stale beats not-indexed, current graph still says not-indexed, empty graph says build, and a resolved target with results still carries no marker so the token guarantee holds on this path too.Full suite 2768 passed, 5 skipped, 2 xpassed in a clean checkout. ruff and mypy clean.