Skip to content

bug: graph emits zero edges and an empty Mermaid diagram when import relationships exist only among primary-ranked files #643

Description

@aryamthecodebreaker

Summary

fixmap graph promises to "Export imports, reverse dependents, routed tests, and co-change evidence as Mermaid or JSON". For repositories whose import relationships exist only among primary-ranked files — typically repos without test files, i.e. exactly where agents most need dependency hints — it emits zero edges: "edges": [] in JSON and a bare two-classDef Mermaid diagram with no nodes' relationships drawn.

Meanwhile fixmap plan on the same repo explicitly reports those import relationships in its Context Files reasons ("imported by ranked file src/x.js", "imports ranked file src/a.js", "within two import hops"), so the evidence exists and is discarded at export time.

Environment

  • fixmap 0.9.0 (npm global)
  • Windows (win32), Node v24.13.0

Repro 1 — linear chain, no tests

git init demo && cd demo
Set-Content package.json '{"name":"demo","scripts":{"test":"node --test"}}'
New-Item src | Out-Null
Set-Content src\x.js 'import { y } from "./y.js"; export function loginX(){ return y(); }'
Set-Content src\y.js 'import { z } from "./z.js"; export function y(){ return z(); }'
Set-Content src\z.js 'export function z(){ return 3; }'
git add -A; git commit -m init

fixmap plan --issue "loginX broken"
#   src/y.js ... imported by ranked file src/x.js      <- relationship computed
#   src/z.js ... within two import hops of ranked file src/x.js
#   Impact Graph: None found

fixmap graph --issue "loginX broken" --format json

Actual JSON:

{
  "graphVersion": 1,
  "nodes": [
    { "id": "n1", "path": "src/x.js", "role": "primary", ... },
    { "id": "n2", "path": "src/y.js", "role": "primary", ... },
    { "id": "n3", "path": "src/z.js", "role": "primary", ... }
  ],
  "edges": []
}

Mermaid output is an empty flowchart TD with three nodes and no edges.

Repro 2 — import cycle

Same shape with a.js → b.js → c.js → a.js plus a self-import and an import of a missing file: plan reports "src/c.js … imports ranked file src/a.js" and "src/b.js … imported by ranked file src/a.js", while graph again returns "edges": []. Cycles do not crash anything; the edges simply never appear.

Control case

Adding one test file (test/x.test.js importing ../src/x.js) makes the test land in the Impact Graph, and then its edge is emitted (kind: "imported-by"). So edge emission works only for impact-role endpoints; plain import / reverse-dependent relations between primary-ranked files are never exported.

Expected

Either:

  1. Import edges between primary-ranked files are emitted (the plan already computes and prints them), or
  2. The report says why no relationships were exported (e.g. a diagnostic like "no impact-role relationships; import edges among context files are not exported"), because right now an all-primary repo silently gets a relationship-free graph that contradicts both the docs and the plan text produced seconds earlier.

The silent empty output matters downstream: consumers (the /fixmap agent flow, the MCP fixmap_graph tool) read "edges": [] as "this code has no relevant dependents", which is false for every chained/cyclic module layout.

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