Fixes #1542: Parameterize relationship query limits, add truncation flags & CLI support - #1594
Open
shanmukhdatta wants to merge 1 commit into
Open
Fixes #1542: Parameterize relationship query limits, add truncation flags & CLI support#1594shanmukhdatta wants to merge 1 commit into
shanmukhdatta wants to merge 1 commit into
Conversation
…add truncation flags & CLI support
|
@shanmukhdatta is attempting to deploy a commit to the shashankss1205's projects Team on Vercel. A member of the Team first needs to authorize it. |
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 #1542
Context & Solution
Issue #1542 flagged that
find_callersand other relationship queries silently capped output at 20 results regardless ofTOOL_RESULT_LIMITSconfiguration, and failed to notify callers when results were truncated.This PR parameterizes the Cypher
LIMITclauses across relationship search queries incode_finder.py, addstruncated(bool) andresult_limit(int) metadata to response envelopes, and updates CLI commands to respect configured limits.Changes Made
code_finder.py: ParameterizedLIMIT 20clauses withlimit: Optional[int] = Noneacross 8 relationship functions (who_calls_function,what_does_function_call,who_imports_module,find_functions_by_argument,find_functions_by_decorator,who_modifies_variable,find_function_overrides,find_function_call_chain).analyze_code_relationships(): ResolvesTOOL_RESULT_LIMITSper query type, querieslimit + 1rows to detect truncation, slices tolimit, and adds"truncated"and"result_limit"keys to output envelopes. Appends truncation notices to summary strings.analysis_handlers.py: Forwards"truncated"and"result_limit"flags from envelope dicts to top-level handler responses.cli/main.py: Updated CLI subcommands (analyze callers,analyze calls,analyze chain,analyze overrides,find decorator,find argument) to query withlimit + 1and print truncation warnings when output is capped.tests/unit/tools/test_relationship_tool_limits.py: Added unit tests covering limit enforcement, truncation flags,TOOL_RESULT_LIMITSenv overrides, handler forwarding, and untruncated regressions.Testing & Verification
uv run python -m pytest tests/unit/tools/test_relationship_tool_limits.py(4/4 PASSED)uv run python -m pytest tests/unit/tools/(400 PASSED, 3 SKIPPED)GSSoC Contributor Notice: Please add
gssocand appropriate level label (level2/level3) to this PR. Thank you!