Skip to content

Siblings shouldn't be included in impact by default #536

@R-Hergert

Description

@R-Hergert

Issue

Impact search does not consider edge type when traversing, meaning that any parent containers and their children are considered impacted.

Impact

I have a C# function that does not do anything. It has no callers and no callees.
When an LLM searches for impact, it is returning 220 symbols due to other functions that happen to exist in the same C# class

codegraph_impact
{
  "symbol": "DoNothingFunction",
  "depth": 2
}

This happens consistently in C# classes and I assume other languages, making "impact" queries detrimental to LLMs unless your codebase has tight classes.

Suggestion

When traversing upstream from a 'contains' edge, the downstream traversal of retrieving all container children should be skipped.

In most languages a node will not have an impact on sibling functions unless there is an explicit link.

If there are languages where this sibling impact is needed, maybe this can be added as a flag.

Reproduction

Scenario

    public class TestClass {
        public static void NoReferences()
        {
            return;
        }
        public static void SisterFunction()
        {
            return;
        }
    }

codegraph impact NoReferences

Return

ImpactTest.cs
  method      NoReferences:2
  class       ImpactTest:1
  method      SisterFunction:6
  file        ImpactTest.cs:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions