Repository navigation
Conversation
A bare `require("mod")` statement with no assignment produces no imports
edge, while `local x = require("mod")` does. Cover the bare form in the
flattened and lua/config layouts, with and without parentheses, plus
guards for the callback recursion a fix must preserve and for method-style
calls that must not fabricate an edge.
…abs#3320) A bare require("mod") with no assignment - the dominant idiom in Neovim configs - never reached the import handler: only variable_declaration was in the Lua import dispatch set, so require(...) used as a standalone statement produced no edge at all. Detect the require call ahead of the generic import_types check instead of widening it to function_call, which would have swallowed every plain call and skipped the walker's recursion into its arguments (e.g. a require() nested inside a callback passed to vim.keymap.set).
There was a problem hiding this comment.
Graphify reviewed this change.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Formal verification. No changes could be formally verified in this run.
Graphify review — findings
Emits an imports edge for a bare Lua require("mod") statement (parenthesized or quote-only, single or double), matching the assigned local x = require(...) form so Neovim/LazyVim configs graph as connected files instead of orphans. The new _lua_is_require_call gate fires only for calls to the global require identifier and runs ahead of the normal import dispatch, so method-style calls like foo.require(...) are ignored and non-require calls still get walked into (a local function inside a vim.keymap.set callback is still discovered). Adds tests/test_lua_import.py covering the bare/assigned/multi-require, directory-layout resolution, no-parens, callback-recursion, and method-style cases.
No blocking issues surfaced. 2 lower-confidence candidates did not survive cross-model review.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 880 functions depend on the 439 functions this change touches.
Health — this change adds coupling hotspots:
- new:
_extract_generic()— 18 callers, 26 callees - new:
extract_js()— 85 callers, 4 callees - new:
extract_xaml()— 19 callers, 17 callees - new:
extract_objc()— 27 callers, 9 callees - new:
extract_julia()— 17 callers, 7 callees - new:
extract_cpp()— 27 callers, 3 callees - new:
extract_vue()— 10 callers, 7 callees - new:
walk()— 1 callers, 60 callees - …and 8 more — each is listed as a finding
Verification — 880 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 820 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
274 of 274 test file(s) selected (100%) via static blast radius.
Escalated to a full run for safety — the selection is not trustworthy on its own (see below). CI should run the whole suite.
tests/test_affected_cli.py— full-run-safetytests/test_affected_member_seed.py— full-run-safetytests/test_agents_platform.py— full-run-safetytests/test_analyze.py— full-run-safetytests/test_anthropic_custom_endpoint.py— full-run-safetytests/test_antigravity_install.py— full-run-safetytests/test_apm_fallback_version.py— full-run-safetytests/test_architecture_doc.py— full-run-safetytests/test_astro_extraction.py— impact, full-run-safetytests/test_astro_import_ids.py— full-run-safetytests/test_atomic_canvas_export.py— full-run-safetytests/test_atomic_version_stamp.py— full-run-safetytests/test_atomic_writes.py— full-run-safetytests/test_backend_env_isolation.py— full-run-safetytests/test_backend_extras.py— full-run-safetytests/test_benchmark.py— full-run-safetytests/test_benchmark_raw_graph.py— full-run-safetytests/test_build.py— impact, full-run-safetytests/test_build_merge_dedup_scope.py— full-run-safetytests/test_build_merge_hyperedges_and_prune.py— full-run-safetytests/test_build_merge_shrink_guard.py— full-run-safetytests/test_builtin_global_type_refs.py— full-run-safetytests/test_cache.py— full-run-safetytests/test_callflow_html.py— full-run-safetytests/test_cargo_introspect.py— full-run-safetytests/test_carried_hyperedge_remap.py— full-run-safetytests/test_case_sensitive_resolution.py— full-run-safetytests/test_charmap_encoding.py— full-run-safetytests/test_chunking.py— full-run-safetytests/test_cjs_module_extension.py— impact, full-run-safetytests/test_claude_cli_backend.py— full-run-safetytests/test_claude_md.py— full-run-safetytests/test_cli_broken_pipe.py— full-run-safetytests/test_cli_export.py— full-run-safetytests/test_cli_help.py— full-run-safetytests/test_cluster.py— full-run-safetytests/test_codebuddy.py— full-run-safetytests/test_community_hub_labels.py— full-run-safetytests/test_community_labels_skill.py— full-run-safetytests/test_confidence.py— full-run-safetytests/test_corrupt_graph_json.py— full-run-safetytests/test_cpp_nested_and_cli.py— impact, full-run-safetytests/test_cpp_objc_cross_file_calls.py— full-run-safetytests/test_cpp_preprocess.py— full-run-safetytests/test_cross_extension_reexport_self_cycle.py— full-run-safetytests/test_cross_language_call_resolution.py— full-run-safetytests/test_cross_repo_member_calls.py— full-run-safetytests/test_cross_repo_shared_types.py— full-run-safetytests/test_csharp_call_site_generic_args.py— full-run-safetytests/test_csharp_enum_members.py— full-run-safety- … and 224 more
non-code file(s) changed (
CHANGELOG.md) → running the full suite for safety (a code graph can't see config/fixture/data deps)
changed code file(s) with no mapped test (
CHANGELOG.md) — a coverage gap or a missing link — running the full suite rather than only the selected tests
Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.
Formal verification
Could not verify: Could not verify \_extract\_generic.
The verifier did not have enough to check \_extract\_generic, so it is saying so rather than guessing. No false assurance is the whole point.
Guarantee: No guarantee either way, this is an honest abstention, not a pass.
Note: Reason: parameter `path` is annotated `Path` — outside the synthesizable primitive/collection set
· 2 grounded finding(s) anchored inline below; 14 more finding(s) on lines outside this diff (see the check run).
| return _read_text(name_node, source) == "require" | ||
|
|
||
|
|
||
| def _extract_generic( |
There was a problem hiding this comment.
_extract_generic()
fans out to 26 callees (efferent coupling); 18 callers depend on it (afferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.
| @@ -3347,6 +3356,20 @@ def ensure_named_node(name: str, line: int) -> str: | |||
| def walk(node, parent_class_nid: str | None = None) -> None: | |||
There was a problem hiding this comment.
walk()
fans out to 60 callees (efferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.
…nto released sections These belong in the next release and will be re-added at the bump with correct credit (@HARSHAVARDHAN-RAJU5 for #3529) and wording.
|
Shipped in v0.9.62 (now on PyPI: |
Fixes #3320.
Problem
A Lua
require("mod")written as a bare statement produces noimportsedge. The assigned form does:The bare form is the dominant idiom in Neovim configuration, where
init.luais typically nothing but a run ofrequire("config.lazy")lines with no assignment. On a real LazyVim-style tree (init.lua+lua/config/*.lua+lua/plugins/*.lua)v8today produces zero import edges; every file lands in the graph disconnected.The cause is dispatch, not parsing.
_LUA_CONFIG.import_typesisfrozenset({"variable_declaration"})(graphify/extract.py:1207), andwalk()only invokesimport_handlerfor a node whose type is in that set. A barerequire(...)parses as afunction_calldirectly underchunk/block, so_import_luais never called for it at all.Fix
graphify/extractors/engine.py: a new_lua_is_require_call()helper plus a narrow branch at the top ofwalk()that fires only fortree_sitter_lua, only on afunction_call, and only when the call'snamefield is anidentifierreading exactlyrequire. It invokes the existing_import_luahandler unchanged.The obvious one-line alternative — adding
function_callto_LUA_CONFIG.import_types— is deliberately not what this does.walk()returns after animport_typesmatch, andfunction_callis the node type for every Lua call, so that version would stop recursion into ordinary calls and silently drop whatever is declared inside their callbacks. Verified: under that behaviourvim.keymap.set("n","x", function() local function inner() end end)loses theinit_innernode entirely, andvim.defer_fn(function() local function deferred() end end, 10)losesinit_deferred. The shipped branch leaves both intact.No double counting:
local x = require("mod")matchesvariable_declarationfirst and returns before the walker descends to the nested call, so it never reaches the new branch. Confirmed with a spy on_import_lua— one handler invocation and one edge for both forms.Method-style calls are rejected:
foo.require("x")has adot_index_expressionname andbar:require("x")amethod_index_expression, so neither produces an edge.Test
tests/test_lua_import.py, 8 tests. Five pin the defect (barerequirein the flattened andlua/config/layouts, several bare requires in one file, and the no-parensrequire 'm'/require "m"forms); one is the assigned-form control; two guard the rationale above — that a non-requirecall still recurses into its callback, and that a method-stylerequirefabricates nothing.Each guard was checked by mutation rather than assumed:
walk()branch_lua_is_require_call→return "requires"comparison_lua_is_require_call→return Truets_module == "tree_sitter_lua"guardtree_sitter_luais the only configured grammar with a node kind namedfunction_call. Kept as defensive scoping.name_node.type != "identifier"checkfoo.require. Kept for clarity.End to end on a LazyVim-shaped tree: 0 import edges before, 3 after (
init → lua_config_lazy,init → lua_config_options,lua_config_lazy → lua_plugins_tele).Local run of the CI jobs on this branch:
skillgen --check/--audit-coverage/--schema-singleton/--monolith-roundtrip/--always-on-roundtrip: all OKpytest tests/ -q(afteruv sync --all-extras --frozen): 5600 passed, 14 skipped, 2 failedruff check graphify tests: cleanbandit -r graphify -ll: unchanged from baselineThe 2 failures are both
test_hooks.py::test_rebuild_bodies_survive_a_graphify_root_symlink_loop, and they fail identically on pristinev8(522ea96) with this branch not applied —2 failed, 111 passedintests/test_hooks.pythere. Environment-specific to my machine, unrelated to Lua.Open question
Only literal
require("string")/require 'string'is handled. A dynamicrequire(var)still produces no edge — unchanged from the assigned form's existing behaviour, since_import_luahas only ever matched string literals. Not addressed here; happy to file it separately if you want it covered.