graphify
graphify copied to clipboard
Fix Lua require file-level edge resolution
Summary
- add a Lua-specific post-pass that resolves
require()module strings to file nodes and emitsimports_fromedges - support bare, nested, assigned, and chained
require()forms by collecting calls from the Lua AST - add focused tests covering Lua file-level import edge extraction
Why
Lua require() dependencies were being detected inconsistently at the file graph level, which meant inbound file edges were missing from graph.json and downstream consumers could not reliably answer "who imports this file?"
Validation
python3 -m py_compile graphify/extract.py tests/test_extract.py- targeted Lua validation script covering assigned, bare, nested, and chained
require()forms - verified on a real Lua corpus that the patched extractor emits file-level
imports_fromedges
Notes
I did not run the full pytest suite in this environment because pytest is not installed here.
Refs #1075
Follow-up update after local review:
- preserve logical corpus paths during Lua
require()resolution instead of eagerly using fully-resolved paths - keep Lua post-pass
source_filevalues consistent with the rest of extraction (str(path)) - add a symlink-focused regression check so file-level
imports_fromedges still attach to the correct file nodes
Validation I ran locally:
python3 -m py_compile graphify/extract.py tests/test_extract.py- targeted Lua file-edge validation: OK
- targeted Lua symlink validation: OK
- real-corpus recheck on NearbyFeed:
imports_from = 775
I did not run the full pytest suite here because pytest is not installed in this environment.