Repository navigation
fix(csharp): extract constructors and the calls made from their bodies - #3016
rajatnagda45 wants to merge 1 commit into
Conversation
The C# function_types listed only method_declaration, so every constructor_declaration was dropped: no constructor node, and — because the constructor body was never treated as a function scope — all the calls it makes (dependency-injection wiring, field initialization, validation) were lost from the call graph. constructor_declaration shares method_declaration's name/parameters/body contract (its name is the class name), so mirror Java (Graphify-Labs#1373) and add it to both function_types and function_boundary_types. Constructors now surface as `.Ctor()` method nodes and their body calls resolve. Adds a regression test.
There was a problem hiding this comment.
Graphify reviewed this change.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Graphify review — findings
Adds constructor_declaration to the C# function_types and function_boundary_types in _CSHARP_CONFIG, so constructors become first-class method nodes and calls from their bodies resolve. Covers it with test_csharp_constructor_is_extracted_with_body_calls, asserting the constructor links to its class and a call in its body resolves.
No blocking issues surfaced.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 1935 functions depend on the 734 functions this change touches.
Health — this change adds coupling hotspots:
- new:
extract()— 490 callers, 42 callees - new:
_rebuild_code()— 98 callers, 50 callees - new:
extract_xaml()— 19 callers, 17 callees - new:
dispatch_command()— 2 callers, 122 callees - new:
extract_js()— 80 callers, 3 callees - new:
_get_extractor()— 26 callers, 6 callees - new:
run_pipeline()— 8 callers, 13 callees - new:
collect_files()— 17 callers, 6 callees - …and 23 more — each is listed as a finding
Verification — 1935 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 1784 function(s) in the blast radius were not formally verified this run
· 31 more finding(s) on lines outside this diff (see the check run).
Problem
The C#
function_typeslisted onlymethod_declaration, so everyconstructor_declarationwas dropped:Constructors are load-bearing in C#, and their bodies are exactly where a lot of the interesting wiring happens, so this erased a large slice of the graph.
Fix
constructor_declarationsharesmethod_declaration's name/parameters/body contract (its name is the class name), so this mirrors what Java has done since #1373: add it to bothfunction_typesandfunction_boundary_types. Constructors now surface as.Ctor()method nodes and their body calls resolve.Test
Adds a regression test asserting the constructor node exists, hangs off its class via a
methodedge, and that a call made in the constructor body resolves. Fails before the change, passes after.All 14 existing C# language tests and the full C#/cross-language resolver suites (152 tests across
test_csharp_*,test_cross_language_call_resolution,test_language_resolvers,test_phantom_cross_package_call) still pass.