Skip to content

Fix ambiguous cross-file call inference for duplicate helper names#632

Open
alceops wants to merge 1 commit intosafishamsi:v5from
alceops:alce/fix-543-ambiguous-cross-file-calls
Open

Fix ambiguous cross-file call inference for duplicate helper names#632
alceops wants to merge 1 commit intosafishamsi:v5from
alceops:alce/fix-543-ambiguous-cross-file-calls

Conversation

@alceops
Copy link
Copy Markdown

@alceops alceops commented Apr 30, 2026

Fixes #543.

This keeps cross-file calls inference from guessing when an unqualified callee label resolves to multiple functions across the corpus. Today the global label map stores one node per normalized label, so common helper names like log(), execute(), or main() can resolve to whichever duplicate was seen last, creating false INFERRED calls and inflating graph metrics such as god_nodes.

Changes:

  • track all global label candidates instead of overwriting duplicates
  • resolve an unqualified cross-file raw call only when the label has exactly one candidate
  • add a regression with two log() helpers proving run() -> log() is not guessed when ambiguous

Verification:

  • python3 -m py_compile graphify/extract.py tests/test_extract.py
  • fresh venv: pip install -e . pytest
  • pytest tests/test_extract.py -q → 21 passed
  • graphify update .

@alceops alceops changed the base branch from main to v5 April 30, 2026 14:17
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.

Cross-file INFERRED calls resolution lacks import evidence + ambiguous-candidate handling — short common names blow up god_nodes ranking

1 participant