fix(resolver): scope registry rehydrate to the indexed project (#711)#727
Conversation
There was a problem hiding this comment.
Code Review
This pull request scopes the rehydration of the in-memory function registry, module names, and class inheritance to the specific project being indexed by filtering Cypher queries with a $project_prefix. This prevents symbols from other projects in a shared database from polluting the resolver trie and causing cross-project leaks during incremental runs. An integration test has been added to verify this behavior, and the package version has been bumped in uv.lock. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|



Summary
Fixes #711. When more than one project shared a Memgraph database, indexing project A could resolve unqualified / bare-name calls into a same-named definition in an unrelated project B, producing wrong cross-project
CALLSedges and (with theiocapture group) wrong cross-projectFLOWS_TOtaint edges.Root cause
_rehydrate_registry_from_graphruns on every non---cleanrun and re-registers every definition qualified name from the graph into the in-memory resolver trie. The three queries it uses (CYPHER_ALL_DEFINITION_QNS,CYPHER_ALL_MODULE_QNS,CYPHER_ALL_INHERITS) had no project filter, so the trie built while indexing one project was polluted with every other project's symbols. The call resolver's bare-name fallback then bound an unqualified call in A to another project's symbol.Fix
Scope all three rehydrate queries to the project being indexed with a
$project_prefix(<project_name>.)STARTS WITHfilter, threaded through as a query param. The rehydrate exists to restore edges into unchanged files of the same project (issue #532); cross-project symbols never belonged in the trie. Real cross-project links still flow through actualIMPORTSedges, not the bare-name fallback.Test (RED → GREEN)
New integration test
test_cross_project_resolution_e2e.pyreproduces the issue's exact scenario: indexcollide(defines barelen/getenv) thencaller(callslen(t)on a tainted value) into one DB, and asserts zerocaller.* -> collide.*edges. Confirmed RED before the fix (3 leaked edges: twoCALLS, oneFLOWS_TO) and GREEN after.Full suite: 5021 passed, 10 skipped. ruff + ty clean.