fix: disambiguate colliding node IDs from same-name files#441
Open
V0v1kkk wants to merge 1 commit intosafishamsi:v4from
Open
fix: disambiguate colliding node IDs from same-name files#441V0v1kkk wants to merge 1 commit intosafishamsi:v4from
V0v1kkk wants to merge 1 commit intosafishamsi:v4from
Conversation
When two files share the same stem (e.g. Program.cs in BKD.Api and BooksKnowledgeDistillation), _make_id(stem, name) produces identical node IDs, causing nodes to merge incorrectly. Detect ID collisions across different source files and disambiguate by prepending the parent directory name to the ID. This ensures each Program class gets its own node in the graph. Made-with: Cursor
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 #438
Summary
Adds a post-extraction pass that detects and resolves node ID collisions caused by files sharing the same stem (e.g.
Program.csin multiple directories)._make_id(stem, name)uses only the filename stem, sosrc/App1/Program.csandsrc/App2/Program.csboth produceprogram_program. This causes their methods and type nodes to silently merge into a single node.The fix detects these collisions by grouping nodes by ID and checking if they come from different
source_filepaths. When a collision is found, all affected nodes are renamed by prepending the parent directory name (e.g.app1_program_programandapp2_program_program).Impact
Common in .NET solutions where each project has its own
Program.cs,Startup.cs,AssemblyInfo.cs, etc. Also affects any multi-module project with naming conventions that produce duplicate file stems.Test Plan
Program.csfiles