Skip to content

AST extractor misses some named exports, producing dangling imports_from edges #2443

Open

Description

@MG44CPA

Summary

The TypeScript/JS AST extractor doesn't always emit a node for every named export in a file — sibling exports in the same file are inconsistently covered. When another file imports the missed export, the resulting imports_from edge has no valid target node, showing up as a dangling-endpoint edge in graphify.diagnostics.diagnose_extraction.

Repro

src/lib/constants.ts exports two constants:

export const CREDIT_RULES = { ... }
export const DISCLAIMER_SHORT = "..."

The extractor creates a node for CREDIT_RULES (src_lib_constants_credit_rules) but no node for DISCLAIMER_SHORT, despite both being top-level named exports in the same file, extracted in the same pass.

Consumers (src/components/Disclaimer.tsx, src/components/Footer.tsx) that import { DISCLAIMER_SHORT } from '@/lib/constants' produce imports_from edges targeting a node ID that was never created.

The same pattern affects src/content/site.ts's COMPLIANCE_SCRIPT export, imported by src/app/hgc-credits/page.tsx and src/app/orientation/page.tsx — both edges dangle for the same reason.

Impact

Small in isolated scope (6 dangling edges observed on a ~190-file TS/TSX codebase), but any file with multiple named exports is at risk of silently dropping some of them, understating the real fan-out of a shared constants/content module in the graph.

Expected behavior

Every top-level named export in a parsed file should get a node, regardless of how many other exports exist in the same file or what shape the export takes (string template literal, object literal, etc.).

Environment

  • graphifyy 0.9.30
  • TypeScript/TSX source files (Next.js App Router project)
  • Reproduced via graphify.diagnostics.diagnose_extraction(extraction, directed=False, root='.')

Activity

  1. ayushcodes10 commented on Sep 16, 2026

    @ayushcodes10
    Contributor

    Already fixed on current v8.

    Reproduced the exact repro from this issue (two sibling named exports, e.g. CREDIT_RULES and DISCLAIMER_SHORT, from one file) — both now get their own node, and a consumer's imports/imports_from edges resolve to real, non-dangling targets for both names.

  2. ayushcodes10 commented on Sep 17, 2026

    @ayushcodes10
    Contributor

    Tried to reproduce this on current `v8` (well past 0.9.30) and could not, across several variations of the reported shape:

    ```ts
    export const CREDIT_RULES = { a: 1, b: 2 };
    export const DISCLAIMER_SHORT = "short text";
    ```
    → both `CREDIT_RULES` and `DISCLAIMER_SHORT` get nodes.

    Also tried: a multiline/nested object literal paired with a template-literal export (interpolation included), a three-export file mirroring the `site.ts`/`COMPLIANCE_SCRIPT` case, and TypeScript type annotations (`Record<string, number>`, explicit `: string`) plus a sibling `export type` — every named export got a node in every variant.

    This may already be fixed by general JS/TS extraction work that's landed between 0.9.30 and current `v8`, or it may need a more specific trigger from your actual file (a particular export shape, a preceding comment/decorator, file size, something in the surrounding imports) that my synthetic repros didn't hit. If it's still reproducible against current `v8`, the two real file names from the report (`src/lib/constants.ts`, `src/content/site.ts`) suggest you have the originals — a minimized version of whichever one still drops a node would be the fastest way to pin this down, since my attempts at the described shape aren't triggering 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