graphify icon indicating copy to clipboard operation
graphify copied to clipboard

Fix Lua require file-level edge resolution

Open call-me-sean opened this issue 6 months ago • 1 comments

Summary

  • add a Lua-specific post-pass that resolves require() module strings to file nodes and emits imports_from edges
  • 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_from edges

Notes

I did not run the full pytest suite in this environment because pytest is not installed here.

Refs #1075

call-me-sean avatar May 29 '26 11:05 call-me-sean

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_file values consistent with the rest of extraction (str(path))
  • add a symlink-focused regression check so file-level imports_from edges 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.

call-me-sean avatar May 29 '26 11:05 call-me-sean