Repository navigation
fix(trace-path): keep only injected callers of same-named methods - #123
Merged
Merged
Conversation
A call stored as a bare method name (for example `_repo.PublishInstance()`) matched every method with that name. Callers of AssistantService.PublishInstance then included ToolsController, ToolService, and AssistantService itself. When more than one class has the method, trace_path now resolves the call through the caller's injected interfaces (constructor signatures and IMPLEMENTS edges). It drops the edge only when the call resolves to a different class. Calls that cannot be resolved are kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…yped-calls # Conflicts: # REQUIREMENTS.md
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.
Problem
trace_pathstores a C# call such as_toolRepository.PublishInstance(id)with the bare targetPublishInstance. The callers query matched every method with that name. In a controller → service → repository layout, the callers ofAssistantService.PublishInstanceincludedToolsController.PublishInstance,ToolService.PublishInstance, and the call inAssistantServiceto its own repository. The only real caller wasAssistantsController.PublishInstance.Fix
In the callers walk, when the target is qualified (
Class.Method), the call target is a bare name, and two or more classes have that method,trace_pathnow resolves the call from the caller's class with the same DI rules that the callees walk uses (_resolve_di_callee: constructor signatures andIMPLEMENTSedges). It drops the edge only when the call resolves to a different class. It keeps calls from the target's own class and calls that it cannot resolve, so no real caller is lost.Tests
tests/test_trace_path_di_callers.py: two controllers, two services, two repositories, all withPublishInstance; each target gets only its injected caller. A call that cannot be resolved is kept.🤖 Generated with Claude Code