Skip to content

fix: disambiguate colliding node IDs from same-name files#441

Open
V0v1kkk wants to merge 1 commit intosafishamsi:v4from
V0v1kkk:fix/node-id-collisions
Open

fix: disambiguate colliding node IDs from same-name files#441
V0v1kkk wants to merge 1 commit intosafishamsi:v4from
V0v1kkk:fix/node-id-collisions

Conversation

@V0v1kkk
Copy link
Copy Markdown

@V0v1kkk V0v1kkk commented Apr 18, 2026

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.cs in multiple directories).

_make_id(stem, name) uses only the filename stem, so src/App1/Program.cs and src/App2/Program.cs both produce program_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_file paths. When a collision is found, all affected nodes are renamed by prepending the parent directory name (e.g. app1_program_program and app2_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

  • Verified on a .NET solution with 2 Program.cs files
  • Nodes correctly separated after fix
  • Edges re-pointed to new node IDs
  • Existing tests pass

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Node ID collisions when multiple files share the same stem (e.g. Program.cs)

1 participant