Repository navigation
Call resolver: link a constructor call to the class's constructor method - #3690
Merged
Merged
Conversation
A call that resolved to a class (`Foo(...)`, contract C3) stayed a class target, which the function graph never sees, so no function reached `Foo.__init__`. It now links the class's own constructor -- __init__ / __new__ (python), constructor (js/ts/kotlin), __construct (php), initialize (ruby), init (swift), or the class-named method (java, c#, c++, dart, apex, objective-c) -- found in the class's own file or beside it with the same stem (a C++ foo.h class, Foo::Foo in foo.cpp). Owner keys are bare class names, so a constructor anywhere else is never taken. The fcall_data row keeps the class too (dst_class_id). A class without its own constructor keeps the class as the target. call_graph_resolution.py python (pyan3): confident precision 98.7 -> 98.8 (1277 -> 1391 judged), recall 36.1 -> 39.3. Resolution recall only counts pyan edges whose callee name the engine extracted, and pyan names these `__init__` where the engine names the class, so it does not see them. Golden masters (both): godot rendering_server_default.cpp gains a downstream file (a constructor defined beside its header), plus the network macros and one forensic top list it moves. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GCpfMCUMpco98QGbsuv2sr
Contributor
…tructors Kept both test sections in test_call_resolver.py; took main's side for the resolution baseline and golden masters, then regenerated them with both changes: call_graph_resolution.py python -> confident precision 99.3% (1687 judged), recall 48.0%, resolution recall 90.2%. Golden masters move 4 values each (network_macro, one forensic top list). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GCpfMCUMpco98QGbsuv2sr
This was referenced Sep 26, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A Level 2 (call-graph resolution, epic #3265) improvement found by breaking down where the resolver loses pyan3's edges.
Problem.
Foo(...)names the class (contract C3), and the resolver linked it to the class definition.dst_kind == "function"), so no function ever reachedFoo.__init__.Fix (
gitgalaxy/core/call_resolver.py,_constructor_of): when a call resolves to a class that defines its own constructor, the row points at that constructor method:__init__/__new__constructor__constructinitializeinitfoo.hclass,Foo::Fooinfoo.cpp).tests/test_read_with_orm_mode.pyPerson(no__init__) to the unrelatedPerson.__init__intests/test_jsonable_encoder.py. There's a regression test for it.__init__) keeps the class as its target, as before.fcall_datarow still names the class:record_keeper.pyfillsdst_class_idfrom the newdst_class_path/dst_class_namesite keys, alongsidedst_func_idfor the constructor.Type of change
call_resolver.py,record_keeper.py)Measured:
call_graph_resolution.py python(pyan3 reference, language-crucible)Measured on its own against the pre-#3689 main, this PR took edge recall from 36.1% to 39.3% at 98.8% precision.
__init__of their own.__init__while the engine names the class, so the metric can't see them. Making the metric credit a class name for an__init__edge would be a separate truth-side change.tests/call_graph_resolution_baseline.jsonis regenerated on the merged head.Golden masters
Re-blessed with
crucible_check.py --mode both --update --yeson the merged head: 4 differences per fixture on top of main (network_macroavg path length / modularity / assortativity at the 4th decimal, and theundocumented_critical_pathforensic top list).The branch's own change, before the merge, was 7 differences:
cpp/godot/rendering_server_default.cppdirect downstream and Popularity Rank 1 → 2, plus its Composition Fit z-score: a constructor defined beside its header now draws the file edge to the.cpp. That part merged cleanly into main's fixture.Tests
tests/core_engine/test_call_resolver.py: Python__init__; a class with no constructor stays a class; TypeScriptconstructor; Java class-named constructor; C++ out-of-class constructor beside its header; a constructor calling its own class is not an edge; a same-named class elsewhere doesn't lend its constructor.tests/tools_recorders/test_fcall_data.py: the recorded row has bothdst_func_id(the constructor) anddst_class_id(the class).Verification (merged head
f58bc0fa)Main was merged in (#3689 conflicted on the shared test file, the resolution baseline and the golden masters). Both test sections were kept, and the generated files were regenerated rather than hand-merged.
🤖 Generated with Claude Code
https://claude.ai/code/session_01GCpfMCUMpco98QGbsuv2sr