Skip to content

fix(csharp): extract constructors and the calls made from their bodies - #3016

Open
rajatnagda45 wants to merge 1 commit into
Graphify-Labs:v8from
rajatnagda45:fix/csharp-constructor-extraction
Open

rajatnagda45 wants to merge 1 commit into
Graphify-Labs:v8from
rajatnagda45:fix/csharp-constructor-extraction

Conversation

@rajatnagda45

Copy link
Copy Markdown
Contributor

Problem

The C# function_types listed only method_declaration, so every constructor_declaration was dropped:

  • no constructor node;
  • because the constructor body was never treated as a function scope, all calls it makes — dependency-injection wiring, field initialization, validation — were lost from the call graph.

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_declaration shares method_declaration's name/parameters/body contract (its name is the class name), so this mirrors what Java has done since #1373: add it to both function_types and function_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 method edge, 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.

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.

@graphify-labs graphify-labs Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

This branch has not been deployed

No deployments
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.

1 participant