You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Lua require() dependencies do not appear as file-level edges in the final graph #1075
It looks like Lua require() dependencies are not consistently preserved as file-level edges in the final graph.
Because of this, Lua files that are referenced via require() may not show the expected inbound dependency relationships.
Expected behavior
When Lua source contains imports such as:
localmod=require("foo.bar")
require("foo.baz")
the final graph should include a file-level dependency edge between the importing file and the imported Lua file.
Actual behavior
The final graph appears to keep other relationships such as structural containment and call edges, but Lua file-to-file dependency edges from require() are missing.
Possible cause
From a quick look at the current Lua extraction path, this may be related to how require() targets are extracted and resolved before graph construction.
In particular, it seems possible that:
only some require() forms are detected,
and/or the extracted target does not always match the corresponding file node in the graph.
If so, the dependency edge may be dropped during graph build.
Minimal example
a.lua
localb=require("pkg.b")
returnb
pkg/b.lua
localM= {}
returnM
Expected result:
a file-level dependency edge from a.lua to pkg/b.lua
Actual result:
the file-level dependency edge is missing
Suggested direction
It may help to:
support more Lua require() forms,
resolve Lua module paths to actual project file nodes,
and preserve those relationships as file-level edges in the final graph.
changed the title [-]Lua \ dependencies do not appear as file-level edges in the final graph[/-][+]Lua require() dependencies do not appear as file-level edges in the final graph[/+]on May 29, 2026
Fixed in 5642c1b — _import_lua was taking only the last dot-segment of the module path and using the raw string as the edge target, which never matched the file node ID. Replaced with _resolve_lua_import_target that converts dots to path separators, probes the filesystem (up 6 parent dirs, tries .lua/.luau/init.lua variants), and returns the correct _make_id(str(resolved_path)). Graceful fallback on unresolved imports.
Thanks for the quick fix, and for linking it here.
I re-tested this on our Lua corpus and on a smaller repro. The core issue in #1075 does look fixed: require("pkg.mod") is now resolved to a real file node instead of using only the last dot segment.
That said, I still see a couple of gaps compared with the behavior we were validating in PR #1076:
Bare require("pkg.bare") calls still appear to be missed in some cases, while assigned / nested / chained forms are picked up.
In my local tests, the upstream fix emits imports edges, but not the imports_from file-level edges we were expecting for cross-file dependency analysis.
For example, on our Nearby corpus I currently see:
Activity
[-]Lua \ dependencies do not appear as file-level edges in the final graph[/-][+]Lua require() dependencies do not appear as file-level edges in the final graph[/+]call-me-sean commentedon May 29, 2026
Opened a fix PR for this:
It includes the Lua
require()file-level edge fix, follow-up path consistency fixes, and targeted validation notes.fix Lua require() import edges lost due to wrong target ID resolution (…
safishamsi commentedon May 29, 2026
Fixed in 5642c1b —
_import_luawas taking only the last dot-segment of the module path and using the raw string as the edge target, which never matched the file node ID. Replaced with_resolve_lua_import_targetthat converts dots to path separators, probes the filesystem (up 6 parent dirs, tries.lua/.luau/init.luavariants), and returns the correct_make_id(str(resolved_path)). Graceful fallback on unresolved imports.call-me-sean commentedon Jun 3, 2026
Thanks for the quick fix, and for linking it here.
I re-tested this on our Lua corpus and on a smaller repro. The core issue in #1075 does look fixed: require("pkg.mod") is now resolved to a real file node instead of using only the last dot segment.
That said, I still see a couple of gaps compared with the behavior we were validating in PR #1076:
For example, on our Nearby corpus I currently see:
So from my side, the core target-ID bug is fixed, but there are still some remaining coverage / edge-semantics differences.
PR #1076 is still open if helpful. It includes:
Happy to help narrow this further or split the remaining gaps into a smaller follow-up if that makes review easier.
fix Lua require() import edges lost due to wrong target ID resolution (…