Skip to content

[Bug]: graphify tree ignores the repo tag on merged graphs: no per-repo roots, and identical relative paths from different repos collapse together #4524

Description

@AromalBiju1

Pre-flight checks

  • I have checked the Troubleshooting section in the README

What happened?

On a graph produced by graphify merge-graphs, graphify tree does not use the repo attribute that merge-graphs sets on every node. As a result:

  1. There are no per-repo roots. The root is the common prefix of the repo-relative source_file values, which is empty when the repos differ, so the viewer title is "/".
  2. Files that share a repo-relative path in different repos (e.g. src/engine.py in both) collapse into ONE file node with all of their symbols interleaved.

Expected: each repo tag is a top-level root with its own directory/file hierarchy built from that repo's relative paths. This would also fix --root on merged graphs, since each repo subtree would be anchored by its tag rather than an absolute path.

Steps to reproduce

1. Create two graph.json files (repo-a, repo-b) whose nodes have source_file "src/engine.py".
2. graphify merge-graphs repo-a/graphify-out/graph.json repo-b/graphify-out/graph.json --out world/graphify-out/graph.json
3. graphify tree --graph world/graphify-out/graph.json --output WORLD_TREE.html
4. Or inspect directly: python3 -c "import json; from graphify.tree_html import build_tree; print(build_tree(json.load(open('world/graphify-out/graph.json'))))"

Merged nodes do carry `repo: "repo-a"` / `"repo-b"` and `local_id`, so the data needed to group by repo is present. tree_html.py never reads `repo`.

Error output or graph output

build_tree output (name, total_count), both repos sharing src/engine.py:

engine.py (8)
  src (8)
    engine.py (8)
      Cls (1) x4
      fn (1) x4

Symbols from repo-a and repo-b are mixed under one file node. Viewer title: "/".

Graphify version

0.9.92

Operating System

Linux

Python Version

3.13

Installation Method

uv tool install (recommended)

Additional Environment Details

No provider environment variables set. Reproduced on a fresh shallow clone of main at the 0.9.92 release commit.Also reproduced with a fresh uv venv; same result.”

Additional context

Suggested fix: in build_tree (tree_html.py), if nodes carry repo, group by it first and build each repo's subtree independently under a root named after the tag. A test in tests/test_tree_html.py with two repos sharing a relative path would cover it.

Related to #4522 (merged-graph tree rendering), but a different cause: here source_file is intact and the repo tag is simply unused by tree.

Activity

  1. github-actions commented on Oct 17, 2026

    @github-actions

    Thanks for opening this issue, @AromalBiju1. A maintainer will take a look soon.

    If you would like to discuss it in real time, come say hi on our Discord server. For longer-form questions and ideas there is also GitHub Discussions.

    To help us triage, please make sure the report includes what you expected, what actually happened, and the steps (and a small sample) to reproduce it.

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions