Skip to content

class_hierarchy misses most subclasses across files #683

Closed

Description

@ayackel

Description

class_hierarchy (via analyze_code_relationships) only finds child classes defined in the same file or immediately adjacent files. It misses the majority of subclasses spread across a large project.

Steps to Reproduce

  1. Index a Django project with a mixin class MontageTestCase in tools/montage_test/testcases.py
  2. Verify with grep that 19 classes inherit from MontageTestCase across the src/ directory
  3. Query: analyze_code_relationships(query_type="class_hierarchy", target="MontageTestCase")

Expected Result

All 19 child classes found.

Actual Result

Only 3 child classes returned — all from the same file or one nearby test file. The other 16 subclasses across src/ are missed entirely.

Analysis

The INHERITS relationships in the graph appear incomplete. The AST parser likely only resolves inheritance within the same file or module, not across the full project. Classes that from montage_test.testcases import MontageTestCase in other files are not linked.

Environment

  • CGC version: 0.2.14
  • Database: Neo4j
  • Project: ~1400 Python files, Django monolith

Activity

  1. github-actions commented on Mar 10, 2026

    @github-actions
    Contributor

    Hi! 👋 Join our CodeGraphContext Discord channel to collaborate: https://discord.gg/dR4QY32uYQ

  2. Shashankss1205 commented on Mar 29, 2026

    @Shashankss1205
    Collaborator

    Hey @ayackel thanks for bringing this to notice, Perhaps there's a mistake in the custom resolution logic we wrote. I will spend some time digging deep into this issue. Thanks!

  3. Shashankss1205 commented on Jul 25, 2026

    @Shashankss1205
    Collaborator

    Resolved: cross-file INHERITS built via imports_map (inheritance.py:46-52, writer.py:1004). Closing.

  4. moved this from Backlog tasks to Done in CGC Progress Boardon Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions