fix(query): respect response_limit and report result_count for event/config patterns#676
Open
Alaa-Taieb wants to merge 1 commit into
Open
fix(query): respect response_limit and report result_count for event/config patterns#676Alaa-Taieb wants to merge 1 commit into
Alaa-Taieb wants to merge 1 commit into
Conversation
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
In
code_review_graph/tools/query.py, seven query-pattern branches (triggers_of,triggered_by,publishers_of,listeners_of,handlers_of,endpoints_for,consumers_of) bypassed the canonicaladd_result()helper. As a result they ignored themax_results/response_limitcap and never incrementedtotal_results, so the returnedresult_countwas always0while the response still contained N results — a contradiction that breaks pagination and any agent/UI relying onresult_count/results_omitted.This is Issue #674, Finding #4.
Fix
Route the seven branches through
add_result()exactly like the sibling branches already do. Edges are still emitted unconditionally when the resolved node isNone(preserving the prior contract — no edges disappear).consumers_ofkeeps its dedup and now only emits an edge for a newly-added result or a missing node, eliminating duplicate edges for already-seen consumers.add_resultsignature or any sibling branch — contained, low-risk diff.Patterns fixed
triggers_oftriggered_bypublishers_oflisteners_ofhandlers_ofendpoints_forconsumers_ofVerification
grep -n "results.append" code_review_graph/tools/query.pyreturns zero matches in the seven branches (only insideadd_resultand one unrelated branch at line 783).test_event_query_patterns_respect_max_results_and_report_countintests/test_spring_events.pybuilds 5 publishers + 5 listeners against one event and asserts:publishers_of(... max_results=3)returns ≤3 results,result_count == 5,results_omitted == 2.listeners_of/handlers_ofreportresult_count == 5.result_count == 0) and passes after the fix (negative proof done).ruff checkclean; fulltests/ -k querysuite passes (22 passed).test_event_resolver_does_not_cross_link_same_named_packages) fails on the Windows baseline regardless of this change; left untouched (it's a Windows path-separator issue in the test itself, not in the code under fix).Manual test checklist (post-merge)
query_graph("publishers_of", "event::X", max_results=3)returns ≤3 results butresult_count== total publishers.query_graph("listeners_of"/handlers_of/triggers_of/triggered_by/endpoints_for/consumers_of) similarly report a correct (non-zero)result_count.edgesarray vs. pre-fix behavior (edges still emitted even when a node can't be resolved).Closes #674.