Repository navigation
fix(trace-path): follow own-class calls and ignore test doubles - #138
Merged
Merged
Conversation
A trace from ToolsController.PublishInstance stopped before the repository call that caused a real bug, for three reasons: - A C# call without a receiver (`GetByInstanceId(...)`, `this.Method()`) was stored as the bare method name, so the walk could not tell which class it meant. It is now stored as `OwnClass.Method` when the enclosing type declares that method. - A fake that implements an interface in a test project counted as a second implementation, so `IToolInstanceReader.GetByInstanceId` did not map to `ToolInstanceReader.GetByInstanceId`. Test classes no longer count as implementations. - Production code was linked to test code: `transaction.Commit()` resolved to a fake `RecordingTransaction.Commit` in a test project. When the caller is production code, test candidates are dropped; with only test candidates, the call stays unresolved. Test-code detection now also covers .NET test projects (`App.Tests`) and folders such as `Unit Tests`. C# repositories must be indexed again to get the own-class targets. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
With Code Mode on the real repository, a trace from
ToolsController.PublishInstancedid not reachToolSuperRepository.GetToolAccessPreflight, the call that caused a real bug (a query outside the open transaction). A step-by-step trace showed three causes:ToolService.PublishInstancecallsGetByInstanceId(id, transaction), andToolInstanceReader.GetByInstanceIdcallsGetAccessPreflightAsync(...). Both were stored as bare names, so the walk could not tell which class they meant.IToolInstanceReaderhas one real implementation and fakes in the test project. With more than one implementation, the walk stopped atIToolInstanceReader.GetByInstanceId.transaction.Commit()(avarfromBeginTransaction()) resolved toToolExecutionAuthorizationTests.RecordingTransaction.Commit, because that fake is the only class with aCommitmethod in the index.Fix
csharp_receiver_types.py:Method(...)andthis.Method(...)are stored asOwnClass.Methodwhen the enclosing type declares the method. Inherited methods and local functions stay bare.graph_traversal.py: symbols in test code are marked. Classes in test code do not count as interface implementations. When the caller is production code, test candidates are dropped; if only test candidates match, the call stays unresolved.route_specificity.is_test_route_file(the shared test-code check) also detects .NET test projects (App.Tests,App.Test) and folders such asUnit Tests, and file names that end inTest.cs.C# repositories must be indexed again to get the own-class targets. The test-double rules work at query time.
Tests
tests/test_trace_path_own_class_and_test_doubles.py(4 tests; 3 fail on the old code): test-code detection, own-class andthis.calls, an inherited method stays bare, and an end-to-end trace (controller → service → own method → reader through an interface with a fake → own preflight method → repository) that reaches the repository in both directions and contains no test classes.🤖 Generated with Claude Code