Skip to content

calls_out: a function's calls include every nested named function's calls (C8) #3642

Closed

Description

@squid-protocol

Part of #3641.

Contract: C8 (docs/calls_out_rule_contract.md, decided 2026-09-25) says a call inside a nested named function belongs to that inner unit only.

What happens: the engine scans the outer unit's whole text block, so every call inside a nested named unit is also listed in the outer unit's calls_out_to. The #3360 C5 fix drops only the nested unit's header, not its body.

Size, from call_graph_accuracy --ledger (language-crucible), counted as GitGalaxy-only calls. All shapes are validated in docs/self_scan/graph_comparison_ledger.json.

language shape occurrences
python inner-named-function_definition 392
typescript inner-named-method_definition / arrow_function / function_declaration 184 / 142 / 48
javascript inner-named-function_declaration / function_expression 131 / 127
rust inner-named-function_item 166
csharp inner-named-local_function_statement 143
java inner-named-method_declaration (anonymous-class methods) 17

Examples:

  • cpp/NVDA/__init__.py:416: fetcher.getValue(...) inside a nested def is also listed on the enclosing method.
  • typescript/fp-ts/TaskEither.ts:758: object-literal arrows filter: (fa, p) => pipe(...) inside getFilterable.

Fix direction: when the slicer emits a nested unit inside an outer one, blank the nested unit's span out of the outer block before scanning for calls. It's the same span _declaration_headers already locates.

Measure: call_graph_accuracy.py --buckets 3 before and after. Expect Python, JS, TS, C#, Java and Rust precision to rise; the golden masters move calls_out_to, fan-in and PageRank.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcore-engine

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions