fix(registry): restrict same-module suffix resolution to self/namespace receivers#893
fix(registry): restrict same-module suffix resolution to self/namespace receivers#893sahil-mangla wants to merge 4 commits into
Conversation
|
Thanks for the focused #876 fix. Triage: parsing/quality bug, normal priority. Review should verify the receiver restriction removes store/delegation false positives without regressing legitimate same-module self or namespace receiver calls. The small registry-focused diff is a good shape for this bug. |
626802b to
4479649
Compare
|
@DeusData Everything is ready for you to review it took me oddly big time to fix |
|
Thanks — the root-cause analysis is exactly right (
The regression tests in |
… receivers Limit same-module suffix fallback in resolve_same_module to only fire if the receiver is a self-receiver or matches the module/namespace. Also reject matching dotted/colon-qualified callees targeting a Function to a different prefix in name lookup. This prevents false-positive recursion flags on store/delegation calls. Signed-off-by: sahil-mangla <manglasahil2017@gmail.com>
Signed-off-by: sahil-mangla <manglasahil2017@gmail.com>
Signed-off-by: sahil-mangla <manglasahil2017@gmail.com>
|
I have split the changes as requested to keep this PR focused and atomic:
|
Edge-Loss Evidence (Precision vs. Recall)To verify the impact of the receiver gates on call-graph precision and recall, the indexer was run on the
Key Takeaways:
|
What does this PR do?
This PR fixes #876 false-positive recursion flags (
unguarded_recursion,self_recursive,recursive) occurring on store wrappers, singleton delegations, and other method calls targeting unrelated objects that happen to share a name with a top-level function in the current module (e.g._get_store().get(...)insideget(...)or_default.check(...)insidecheck(...)).Root Cause
During call graph resolution in Strategy 2 (
resolve_same_moduleinsrc/pipeline/registry.c), dotted/colon-separated callee names (like_default.check) were split intoprefix(_default) andsuffix(check). The resolver fell back to checking if the suffix exists as a top-level function in the caller's module (module_qn.check). If a localcheckfunction was defined, it matched and mistakenly resolved the call to it, generating a self-loopCALLSedge which flagged the function as recursive.Solution
is_same_module_receiverto validate the receiver prefix. Suffix fallback checks inresolve_same_moduleare now restricted to:"self","this","cls","@self"..<prefix>).axios.get,_get_store().get,_default.check) from matching same-module top-level functions, eliminating spuriousCALLSself-loops.tests/test_registry.c(resolve_same_module_only_on_self_receiver) to cover delegation, self, and namespace/module receiver pattern cases.Checklist
git commit -s) — required, CI rejects unsigned commits (DCO, see CONTRIBUTING.md)make -f Makefile.cbm test)make -f Makefile.cbm lint-ci)