codegraph icon indicating copy to clipboard operation
codegraph copied to clipboard

fix: avoid sibling methods in impact traversal

Open sjh9714 opened this issue 6 months ago • 1 comments

Summary

Fixes #536.

codegraph impact could walk from a method to its parent class through an incoming contains edge and then fan back out to every child of that class, so unrelated sibling methods appeared as impacted. This keeps the parent in the impact result but suppresses the sibling fan-out for containers reached through child-to-parent contains traversal.

Changes

  • Track when impact traversal reaches a container through an incoming contains edge and skip expanding that container's children in that case.
  • Add a C# regression fixture covering a method with an unrelated sibling method.
  • Add an Unreleased changelog entry for the impact behavior fix.

Testing

  • npx vitest run __tests__/graph.test.ts -t "should not include sibling methods reached through parent contains edges" (failed before the fix, passed after)
  • npx vitest run __tests__/graph.test.ts
  • npm run build
  • node dist/bin/codegraph.js impact NoReferences --path "$tmp" --depth 2 --json after creating the C# fixture used for reproduction
  • npx vitest run __tests__/mcp-roots.test.ts -t "honors an explicit rootUri without asking the client for roots" (rerun after one full-suite timeout)
  • npm test (passed on rerun; first run had one transient mcp-roots timeout)

Note: I used Codex while preparing this change, reviewed the final diff, and ran the listed checks locally.

sjh9714 avatar May 31 '26 18:05 sjh9714

Git config/CD

treytracedit-lab avatar Jun 05 '26 13:06 treytracedit-lab