Skip to content

AST extractor drops imports_from edges for some source files #414

Closed

Description

@teenne

Summary

graphify extracts AST import edges for some JS/MJS files in a corpus but silently skips them for others, producing misleading degree-0 "orphan" nodes.

Repro

Run /graphify . on a Node.js repo containing:

File A: backend/api/src/seed/run-seed.mjs — 9 explicit relative imports:

import mongoose from "mongoose";
import { CandidateModel } from "../models/candidate.model.mjs";
import { SessionModel } from "../models/session.model.mjs";
import { DecisionModel } from "../models/decision.model.mjs";
import { FeedbackModel } from "../models/feedback.model.mjs";
import { candidateSeeds } from "./prototype/candidates.seed.mjs";
import { sessionSeeds } from "./prototype/sessions.seed.mjs";
import { decisionSeeds } from "./prototype/decisions.seed.mjs";
import { feedbackSeeds } from "./prototype/feedback.seed.mjs";

Observed edges for run-seed.mjs:

  • run-seed.mjs --contains--> run() (intra-file)
  • runPrototypeSeed() --calls--> run() (intra-file)
  • Zero imports_from edges.

All 8 target files exist as nodes in the same graph (they appear in community listings with their own stems), so this isn't a missing-corpus issue.

Counter-example in the same run: backend/api/src/models/enums.mjs is an exports-only file, and the graph correctly shows cross-file edges between it and decision.model.mjs / candidate.model.mjs (resolved via those model files importing ../enums.mjs). So the import resolver handles some ../sibling.mjs cases, just not consistently.

Expected

Each relative import ... from "./foo" or "../foo" statement should produce an imports_from edge whenever the target file is present in the corpus.

Impact

feedback.model.mjs and session.model.mjs appear as degree-0 orphans in GRAPH_REPORT.md despite being actively imported from run-seed.mjs. This inflates the weakly-connected-nodes count and breaks reverse-lookup queries like "which files use session.model.mjs?"

Environment

  • graphifyy 0.4.18 (via pipx)
  • Python 3.12.3 on Ubuntu-based Linux (kernel 6.17)
  • Invocation: /graphify . via the Claude Code skill, default pipeline
  • Corpus: 75 files (27 code, 45 docs, 3 images)

Happy to share the full graph.json or construct a minimal repro repo if useful.

Activity

  1. added a commit that references this issue on Apr 17, 2026
  2. added a commit that references this issue on Apr 23, 2026
    a507c97
  3. added a commit that references this issue on Sep 10, 2026
    eab00d2
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