Skip to content

calls_out (cpp/ts/c#): catch generic calls, drop Class::method self-headers, name the type in Type var( (#3644) - #3683

Merged
squid-protocol merged 1 commit into
mainfrom
claude/calls-out-generics-3644
Sep 25, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
claude/calls-out-generics-3644

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes #3644 (part of #3641). Three calls_out defects, all validated shapes in docs/self_scan/graph_comparison_ledger.json:

1. Generic calls were missed (C3). A type-argument list between the callee and ( defeated \b(name)\s*\(. Examples: static_cast<int>(, Object::cast_to<EditorDock>(, back_inserter<vector<wstring> >(, TS/C# new Array<T>().

  • New CALLS_OUT_C_STYLE_GENERIC in _shared_patterns.py. It allows an optional <…> right after the name (no blank, so a spaced comparison a < b never opens one).
  • The list may nest one level, stays on one line, and may not contain ( ) ; { } = | ! ? or quotes. It ends in > then (.
  • Quantifiers are bounded and the alternatives are disjoint, so it's ReDoS-safe. ReDoS tests are included.
  • It's registered in QUALIFIED_CALLS_OUT_PATTERNS, so qualifier capture and the C5/C8 checks apply. Only cpp, typescript and csharp switch to it; every other language keeps CALLS_OUT_C_STYLE.

2. An out-of-class Class::method header was a call to method (793 occurrences, the ledger's largest shape). Self-removal compared the qualified unit name with the bare callee, so it never matched. A qualified unit now drops its leaf name when the call is bare, this->/self.-qualified or qualified by its own class. That covers its own header and its recursion. child->method( is another object's method and stays a call.

  • A first cut dropped the leaf everywhere and lost 143 real child->getTextInRange(…)-style calls, so the rule is receiver-aware.

3. C++ Type var(args) took the variable as the callee (C3). Examples: EditorProgress progress(…), MutexLock lock(m). The callee is now the type. Details:

Truth side (tests/tools/call_graph_accuracy.py). The tree-sitter side dropped only the unit's full (qualified) name, so it counted real C++ recursion (deleteSubtree(child) inside Buffer::deleteSubtree) as an engine miss. It now applies the same receiver-aware leaf rule, the same kind of truth-side fix as #3666. There's a new test in tests/tools/test_call_graph_accuracy.py.

Type of change

  • Bug fix
  • Parsing or engine logic (detector.py, _shared_patterns.py, cpp/typescript/csharp profiles)

Measured: call_graph_accuracy.py on language-crucible v1.5.0

language precision before → after recall before → after FP FN
cpp 87.7% → 96.5% 95.6% → 99.3% 1039 → 280 345 → 52
typescript 99.6% → 99.6% 95.1% → 97.2% 23 → 23 310 → 177
csharp 99.2% → 99.2% 97.6% → 99.8% 22 → 22 62 → 5
the other 8 unchanged unchanged

Shapes from the issue:

shape before → after
cpp qualified_identifier<function_declarator (own header) 793 → 13
cpp template_function+generic 154 → 0
cpp qualified_identifier+generic 118 → 0
cpp field_expression+generic 23 → 0
cpp init_declarator<declaration (Type var() 51 → 0
typescript engine-attributes-to-another-function (new Array<T>()) 132 → 52
csharp generic_name / member_access+generic / object_creation+generic 5 / 25 / 17 → 0

Moved, not removed: cpp declaration<compound_statement went 7 → 59. These are the Type var( sites now reporting the type (wistringstream s(attribs) → wistringstream), as the validated verdict asks. Tree-sitter has no call node for a declaration, so they count as engine-only until that shape gets its own ledger verdict.

Known gap: type arguments nested two levels deep (make<vector<vector<int>>>() are still missed. That keeps the pattern bounded, and a test pins it.

tests/call_graph_accuracy_baseline.json is regenerated and the shapes are merged into the ledger with --ledger. No verdict was hand-edited.

Golden masters

crucible_check.py --mode both --update --yes reports no drift in either fixture. The golden masters don't record callee names, and the idiom-wrapper call-site counts they do record didn't move.

Verification

$ pytest tests/                                              -- 11389 passed, 334 skipped, 0 failed
$ pytest tests/extraction/languages/test_calls_out_generics_3644.py   -- 29 passed (also via plain `pytest` from another cwd)
$ pytest tests/tools/test_call_graph_accuracy.py             -- 13 passed
$ PATH=.venv/bin:$PATH python tests/tools/audit_check.py     -- all clear (ruff, mypy, dead-key, ast-accuracy)
$ python tests/tools/call_graph_accuracy.py --buckets 3 --regenerate --ledger
$ python tests/tools/crucible_check.py --mode both --update --yes     -- no drift, both modes

🤖 Generated with Claude Code

https://claude.ai/code/session_01GCpfMCUMpco98QGbsuv2sr

…var( (#3644)

- CALLS_OUT_C_STYLE_GENERIC steps over one nested level of type arguments
  before the (: static_cast<int>(, Object::cast_to<T>(, new Array<T>().
  Bounded, one line, no ( ) ; { } = | ! ? or quote inside; only cpp,
  typescript and csharp use it.
- A Class::method unit drops its leaf name when the call is bare, this- or
  own-class-qualified (its own header and its recursion); child->method( stays.
  call_graph_accuracy.py's tree-sitter side applies the same rule.
- C++ Type var(args) in a body names the type as the callee (C3); a built-in
  type or a pointer/reference declarator calls nothing.

call_graph_accuracy on language-crucible: cpp precision 87.7 -> 96.5, recall
95.6 -> 99.3; typescript recall 95.1 -> 97.2; csharp recall 97.6 -> 99.8.
Baseline regenerated, shapes merged into the ledger.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GCpfMCUMpco98QGbsuv2sr
@squid-protocol squid-protocol changed the title calls_out (cpp/ts/c#): generic calls, qualified-unit recursion, Type … calls_out (cpp/ts/c#): catch generic calls, drop Class::method self-headers, name the type in Type var( (#3644) Sep 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit cfaf9bb into main Sep 25, 2026
36 checks passed
@squid-protocol
squid-protocol deleted the claude/calls-out-generics-3644 branch September 25, 2026 21:01
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.

calls_out (cpp/ts/c#): generic calls name<T>( missed; cpp own Class::method( header and Type var(args) counted as calls

2 participants