Skip to content

[Bug]: Rust: use krate::module::{self, Item} leaves a dangling bare-name imports_from edge (0.9.115) #5398

Open

Description

@grosjeanbaptiste

What happened?

In Rust, use krate::module::{self, Item}; adds an imports_from edge whose target is the bare module name (dev), not the id of the module node (actions_src_dev). Nothing resolves that target, so the edge dangles. The same file's use krate::ports::{Console, SystemConsole}; and pub use ports::Intent; resolve correctly on 0.9.115, so the group form with self seems to be the trigger.

This looks like the same family as #4439 (fixed from 0.9.91 for plain use of a type), but the {self, ...} group is still affected on 0.9.115.

Minimal reproduction

Four files, scanned from their common parent directory:

actions/src/lib.rs

pub mod dev;
pub mod ports;
pub use ports::Intent;

actions/src/dev.rs

pub struct SystemRunner;
pub fn build() {}

actions/src/ports.rs

pub trait Console {
    fn out(&self, line: &str);
}
pub struct SystemConsole;
pub struct Intent;

actions/src/bin/b.rs

use baba_actions::Intent;
use baba_actions::dev::{self, SystemRunner};
use baba_actions::ports::{Console, SystemConsole};

fn run(c: &dyn Console, _i: &Intent, _s: SystemConsole, _r: SystemRunner) {
    c.out("hi");
    dev::build();
}

fn main() {}
from pathlib import Path
from graphify.extract import extract

files = sorted(Path(".").rglob("*.rs"))
r = extract(files, cache_root=Path("."), root=Path("."))
ids = {n["id"] for n in r["nodes"]}
for e in r["edges"]:
    if e["source"] not in ids or e["target"] not in ids:
        print("DANGLING", e["source"], "->", e["target"], e["relation"])

Output on graphify 0.9.115:

DANGLING actions_src_bin_b -> dev imports_from

The node actions_src_dev exists. With 0.9.76 the same project also left ports and intent dangling; 0.9.115 fixes those two, not dev.

Observed on a real project (not reproduced in isolation)

On a 125-file Rust crate (lib plus about 40 src/bin/*.rs, same import style), graphify 0.9.115 gives 415 dangling edges to 93 distinct targets. Most are external (result, pathbuf, anyhow, path, super), which is expected. Two are local:

  • dev: 19 dangling edges, matching the reproduction above.
  • console: 27 dangling edges, although the real node actions_src_ports_console exists. I could not reproduce this one with the files above. In a graph built with 0.9.76 (checked by hand, not re-checked on 0.9.115), the bins linked to the stub were the ones that also contain use krate::dev::{self, SystemRunner};, while bins without self in a group resolved to the real node. That may or may not be related.

After the graph build, each dangling target becomes a source-less concept node (console, systemconsole), so a type is split in two (the real node plus a stub) and its degree and betweenness are understated.

Expected

{self, ...} in a use group should resolve to the module node, like the other items of the group do.

Environment

graphify 0.9.115 (pipx), Python from the pipx venv, macOS, Rust code only (AST extraction, no LLM).

Activity

  1. github-actions commented on Nov 22, 2026

    @github-actions

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

  2. added a commit that references this issue on Nov 26, 2026
  3. added a commit that references this issue on Nov 27, 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

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions