Skip to content

[Bug]: updating only an importer points its include at a phantom bare-stem node when the target has a same-stem sibling #5630

In progress

Description

@0xkaushik-ai

Pre-flight checks

  • I have checked the Troubleshooting section in the README

What happened?

foo.c and foo.h both yield the file id foo, so a full build salts them to foo_c_foo and foo_h_foo, and main.c's #include "foo.h" points at foo_h_foo.

If only main.c changes, graphify update (and a repeated graphify extract) re-extracts main.c alone. Neither colliding file is in that batch, so no collision is seen, and the include stays on the bare foo. The graph gains a sourceless foo node a full build never has, and loses the edge to the real header.

The same happens in C++ (w.cpp/w.hpp) and TS (import { a } from './index' next to index.ts/index.js). This is the importer side of #5464 / #5505, which fixed the colliding files themselves.

Steps to reproduce

mkdir p && cd p
printf 'int foo(void);\n' > foo.h
printf '#include "foo.h"\nint foo(void) { return 1; }\n' > foo.c
printf '#include "foo.h"\nint main(void) { return foo(); }\n' > main.c
graphify update .
echo '// touched' >> main.c
graphify update .

Then compare with a fresh graphify update . of the same tree.

Error output or graph output

nodes, update:     foo, foo_c_foo, foo_foo, foo_h_foo, main, main_main
nodes, full build: foo_c_foo, foo_foo, foo_h_foo, main, main_main

only in update:     main -> foo        imports
only in full build: main -> foo_h_foo  imports

Graphify version

0.9.123 (v8 5d962d2d)

Operating System

Linux

Python Version

3.12.13

Installation Method

From source (uv sync --all-extras on v8)

Activity

  1. github-actions commented on Nov 29, 2026

    @github-actions

    Thanks for opening this issue, @0xkaushik-ai. 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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions