Skip to content

Class nodes always have in_degree/out_degree = 0 despite real INHERITS edges existing #558

Description

@Ilyes512

Version

codebase-memory-mcp 0.8.1

Platform

macOS (Apple Silicon)

What happened, and what did you expect?

search_graph returns Class nodes with in_degree: 0 and out_degree: 0 even when real INHERITS edges exist for those nodes in the graph.

Example — AbstractAttachmentDto has 8 subclasses, but search_graph reports in_degree: 0:

search_graph(name_pattern=".*AbstractAttachmentDto.*")

→ { "name": "AbstractAttachmentDto", "label": "Class", "in_degree": 0, "out_degree": 0 }

Confirmed via Cypher that the edges actually exist:

MATCH (child)-[:INHERITS]->(parent)
WHERE parent.name = 'AbstractAttachmentDto'
RETURN child.name

→ Returns 8 rows correctly.

Also confirmed that the degree properties are stored as 0 on the node itself, not computed live:

MATCH (n:Class {name: 'AbstractAttachmentDto'})
RETURN n.in_degree, n.out_degree

→ 0, 0

Root cause hypothesis

The in_degree/out_degree properties appear to be written onto nodes during indexing (not computed dynamically from the graph). It looks like these counts are not being updated for Class nodes after INHERITS edges are resolved, leaving them at their initial value of 0.

Impact

  • search_graph returns misleading connectivity data for all classes
  • Any min_degree filter to find well-connected or abstract classes will silently exclude everything
  • Agents fall back to grep because search_graph results look like isolated/unused nodes

Workaround

Use query_graph with a Cypher traversal directly — the edges are correct, only the stored property is wrong:

MATCH (child)-[:INHERITS]->(parent {name: 'MyAbstractClass'})
RETURN child.name, child.file_path

Confirmations

  • I searched existing issues and this is not a duplicate.

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