Skip to content

0.9.29: TypeScript leaks absolute-path slug ids into links source endpoints (C# fixed by #2250, TS not) #2262

Description

@vanjos

Follow-up to #2243. Thanks for the 0.9.29 fix (#2250), it cleaned up the C# case. TypeScript still leaks, in a slightly different spot.

What happens

In a TypeScript graph, a large number of links entries have a source that is an absolute-scan-path-derived slug rather than a real node id. The slug is the scan path lowercased with every run of non-alphanumerics collapsed to _, followed by the file's repo-relative path and the function name, for example abs_scan_path_slug_packages_account_src_components_paymentmethods_prepaybalancecontainer_invoicebalancesubsection. The target of the same edge is a clean scope-relative id (packages_account_src_settings_basesettingssection_constructrowwithid).

Two things about the leaked source:

C# vs TypeScript in the same version

Same repo, same graphify 0.9.29, two scopes:

  • C# scope, 79,336 nodes: 0 absolute-path slug endpoints.
  • TypeScript scope, 74,271 nodes / 165,872 edges: 7,143 absolute-path slug endpoints.

So the 0.9.29 relativization landed for the C# extractor but not the TypeScript one.

Why it matters

The slug is derived from the absolute scan path, so the same source tree built on two machines (or two checkout paths) produces different graph.json files. We commit graphs to git, so every rebuild on a different path shows a spurious diff, and the underlying non-determinism is general. Same reproducibility and cross-machine caching problem as #2243.

Repro

It shows up in a TypeScript monorepo (a packages/* layout with cross-package imports). A minimal two-file TS project does not trigger it, and neither does a class with arrow-property handlers calling across two files, so it correlates with the larger structure rather than a single syntactic form. The leaked callers are handler-style functions (invoicebalancesubsection, handletabclick, handleapply) whose containing symbol does not appear in nodes. Happy to share a fuller extract from the affected graph if useful.

Suggested fix

Apply the same relativization as #2243/#1899 to the TypeScript extractor's edge-source identifiers, and/or materialize the caller node so the edge references a real scope-relative id instead of an absolute path.

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