feat(search): auto-detect Cypher queries + pattern/workspace swap hints (closes #239) - #246
Merged
Merged
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…e swap (closes #239) Two related runtime UX gaps, both about the tool correcting toward the right answer instead of silently returning the wrong one: 1. `search` is the only umbrella command with pattern before workspace (opposite of every other command). Getting it backwards doesn't error — the workspace path silently becomes the search pattern and returns an empty "ok" result with zero indication anything went wrong (the docstring/--help example order was already fixed in a prior PR this session; this fixes the runtime behavior itself). Now: if `pattern` is an existing directory, a `_hints` entry flags the likely argument swap. 2. A Cypher-shaped pattern (`MATCH (...`) passed without `--mode graph` previously got run through whatever mode was set (default: semantic), producing a confusing near-empty result instead of the graph query the caller almost certainly meant. Now: high-confidence matches (pattern starts with `MATCH (`) auto-route to `--mode graph` with a `_hints` entry explaining the auto-route (silence it by passing `--mode graph` explicitly). Both heuristics are narrow by design — no false positives on the existing search test suite, and a negative-control test confirms a pattern that merely mentions "MATCH" mid-string is not reinterpreted.
|
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.



Closes #239.
Summary
searchreturns a_hintsfield whenpatternis an existing directory (likely argument swap —searchis the only umbrella command with pattern-before-workspace).MATCH (...) auto-route to--mode graphwhen a different mode was set, with a hint explaining the auto-route.Test plan
pytest tests/test_search_command.py— 8/8 new testspytest tests/test_search_command.py tests/test_search_engine.py tests/test_semantic_search_engine.py tests/test_query_graph.py— all passsearch . "getAccessMode" --mode symbol(swapped args) →_hintscorrectly flags it;search "MATCH (n) ... RETURN n LIMIT 2" .(no--mode graph) → auto-routed, correct graph results returned