Summary
FunctionRegistryTrie.find_ending_with() silently drops call resolution results when simple_name_lookup is present but does not contain the searched suffix.
Root cause
In graph_updater.py, the current code is:
def find_ending_with(self, suffix):
if self._simple_name_lookup is not None:
if suffix in self._simple_name_lookup:
return sorted(self._simple_name_lookup[suffix])
return [] # <--- BUG: should fall through to linear scan
return sorted(
qn for qn in self._entries.keys() if qn.endswith(f".{suffix}")
)
When simple_name_lookup exists but does not contain the suffix, it returns [] instead of falling through to the linear scan over _entries. The original code correctly fell through.
Impact
14 CALLS relationships silently dropped on the axios repo (JavaScript). The bug affects any repo where functions are registered in the trie but their simple names are not indexed in simple_name_lookup. This can happen with generated names, IIFE patterns, or edge cases in JS/TS module systems.
Fix
Restore the original fallback behavior:
def find_ending_with(self, suffix):
if self._simple_name_lookup is not None and suffix in self._simple_name_lookup:
return sorted(self._simple_name_lookup[suffix])
return sorted(
qn for qn in self._entries.keys() if qn.endswith(f".{suffix}")
)
How it was found
Expanding the benchmark suite from 2 repos (requests, tree-sitter) to 10 repos across all supported languages revealed the discrepancy on the axios repo. The original 2 repos did not exercise the failing code path.
Summary
FunctionRegistryTrie.find_ending_with()silently drops call resolution results whensimple_name_lookupis present but does not contain the searched suffix.Root cause
In
graph_updater.py, the current code is:When
simple_name_lookupexists but does not contain the suffix, it returns[]instead of falling through to the linear scan over_entries. The original code correctly fell through.Impact
14 CALLS relationships silently dropped on the axios repo (JavaScript). The bug affects any repo where functions are registered in the trie but their simple names are not indexed in
simple_name_lookup. This can happen with generated names, IIFE patterns, or edge cases in JS/TS module systems.Fix
Restore the original fallback behavior:
How it was found
Expanding the benchmark suite from 2 repos (requests, tree-sitter) to 10 repos across all supported languages revealed the discrepancy on the axios repo. The original 2 repos did not exercise the failing code path.