feat(search): route name-shaped queries to the symbol lane - #3078
Open
devin-ai-integration[bot] wants to merge 4 commits into
Open
devin-ai-integration[bot] wants to merge 4 commits into
devin-ai-integration[bot] wants to merge 4 commits into
Conversation
Omitted prefer_symbol now runs the preferred-symbol route when at least half the query's content words are identifier-shaped. The decision and its margin are disclosed as query_route on search and context results. The margin describes query shape only, not answerability. Fixes #3013 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This reverts commit d1023ac.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This branch has not been deployed
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.
Summary
prefer_symbolnow lets the query's shape decide. Name-shaped queries such asgetUserById,UserStore::getUserById, andwhere is parse_config calledadd the preferred-symbol route beside the strict query. Prose keeps the strict query alone.query_routeonSearchCompleteV1andContextResultV1discloses the decision, its margin, and who decided. Markdown gets a matchingQuery route:line.Fixes #3013
Motivation
prefer_symbolwas caller-only and defaulted to off, so name lookups ran the strict query alone. A qualified spelling the strict query cannot match, such asUserStore::getUserById, returned no results.Changes
crates/tracedecay-query/src/retrieval/lexical/routes.rs:prefer_symbolis nowSymbolRoutePreferenceV1, with the valuesByQueryShape(the default),Always, andNever.classify_query_shapecounts content words, excluding stoplisted and one-character words. A word counts as a name whennames_identifiermatches the whole token or the trailing name ofa.banda::b. The query isNamewhen at least half its content words are names, so one incidental identifier in prose does not flip it.LexicalRouteReceiptV1carryLexicalRouteDecisionV1.crates/tracedecay-contracts: addsSearchQueryRouteV1 { route, margin, decided_by }:marginis the share of identifier-shaped content words minus one half, in[-0.5, 0.5]. It describes query shape only. Nothing reads it as an answerability or abstain signal.crates/tracedecay-mcp: passesprefer_symbolthrough asOption<bool>, fills inquery_route, and renders it in markdown.sdks/typescript/src/operations.tsandplugin/chatgpt-extension/embedded/server.mjs.Test plan
name_shaped_queries_take_the_symbol_name_route_by_query_shaperuns against a real index. With default routing,UserStore::getUserByIdandusers.getUserByIdranksrc/users.ts::getUserByIdfirst. Both returned no results before this change. A prose query reportsprose, plans only the strict query, and ranks the same asprefer_symbol: false.bash scripts/require-exact-test.sh cargo test -p tracedecay-code-index-runtime --lib code_index_scheduler::tests::serving::name_shaped_queries_take_the_symbol_name_route_by_query_shape -- --exact: 1 passedsearch_returns_the_named_symbol_and_refuses_arguments_outside_its_typed_requestnow also checks thatledger_post_entrywithoutprefer_symbolplans the same routes asprefer_symbol: trueand reportsdecided_by: query_shape. The forced call reportscaller, and the prose miss reportsprosewith margin-0.5. 1 passed viarequire-exact-test.sh.cargo test --libfortracedecay-query,tracedecay-contracts,tracedecay-mcp, andtracedecay-code-index-runtime: all passcargo test -p tracedecay --lib mcp::tools::handlers: 84 passedcargo test -p tracedecay --features test-transport --test mcp_suite mcp_handler_test::: 484 passed. 4 failures come from the local environment: 3 need the hostast-grepCLI, and 1 needs the builttracedecaybinary.cargo clippy -D warnings --all-targetspasses on the four crates above and ontracedecay(--features test-transport).cargo fmt --all -- --check,python3 scripts/linux-test-partitions.py check,node scripts/lint-commit-range.mjs --repository . origin/master HEAD, sdks/codegencargo test, sdks/typescript typecheck and test, and chatgpt-extensioncheck:embeddedall pass.cargo nextest run --workspace.Checklist
CHANGELOG.mdupdated: release-please generates it from the commit..envfiles includedprefer_symbol. An omittedprefer_symbolnow follows query shape instead of meaningfalse.query_routeis a new optional response field.Link to Devin session: https://app.devin.ai/sessions/2b6081c218314ac9bd2af0f9dcc3cb57
Open in Devin Desktop: https://app.devin.ai/desktop/session/2b6081c218314ac9bd2af0f9dcc3cb57?variant=devin
Requested by: @ScriptedAlchemy