Fixes #1542: Parameterize relationship query limits, add truncation flags & CLI support - #1594
Merged
Merged
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. |
Shashankss1205
approved these changes
Aug 13, 2026
Shashankss1205
left a comment
Collaborator
There was a problem hiding this comment.
Verified locally against the exact reproduction from #1542 (25 distinct callers, KuzuDB backend):
- default config → 20 results +
Total: 20 caller(s) (truncated, 20+ exist) TOOL_RESULT_LIMITS={"find_callers": 50}→ all 25 results, no truncation notice
Full unit suite (1117 passed) and integration suite (44 passed) green on a trial-merge onto main. Parameterized LIMIT $limit is consistent with the existing pattern in report_generator.py and java_toolkit.py, so it holds across backends. Thanks for the thorough fix!
Contributor
Author
|
please add the girl script summer of code tag to this to consider for commit of contribution |
This was referenced Aug 13, 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.
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!