Skip to content

Fix Lua require file-level edge resolution#1076

Open
call-me-sean wants to merge 2 commits into
safishamsi:v8from
call-me-sean:fix/lua-require-file-edges
Open

Fix Lua require file-level edge resolution#1076
call-me-sean wants to merge 2 commits into
safishamsi:v8from
call-me-sean:fix/lua-require-file-edges

Conversation

@call-me-sean
Copy link
Copy Markdown

@call-me-sean call-me-sean commented May 29, 2026

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
Copy link
Copy Markdown
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant