Skip to content

test(cpp): C++ special-member name reconciliation → function precision 100% - #2455

Merged
squid-protocol merged 1 commit into
mainfrom
cpp-func-precision-100
Aug 29, 2026
Merged

test(cpp): C++ special-member name reconciliation → function precision 100%#2455
squid-protocol merged 1 commit into
mainfrom
cpp-func-precision-100

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

tree_sitter_accuracy_audit measured cpp function precision at 95.0% (68 "extra"
functions). Investigating every one: they are all real C++ special members that GitGalaxy
correctly extracts and tree-sitter-cpp either names differently or drops. Zero genuine
GitGalaxy false positives
— GitGalaxy's cpp function precision is genuinely 100%; the metric
was under-counting it.

Three shared-reader fixes

(all in tree_sitter_accuracy_audit.py, used by both the accuracy audit and
tri_comparison_gatherer)

1. Conversion-operator naming

tree-sitter's operator_cast / qualified_identifier node text bakes in the parameter list and
cv-qualifiers — Variant::operator String() const — and, for a template conversion, the
argument list — operator Vector<Plane>() const. GitGalaxy's func_start stores just
Variant::operator String / operator Vector. Added _cpp_canonical_operator_name: strips the
trailing (...) + cv-quals and <...> args, keeps operator and the Ns:: qualifier.
Guarded to conversion operators only (operator + a type token) — symbol operators
(operator(), operator==, operator[], operator->) are left untouched.

2. _FORCE_INLINE_-macro parse errors

A function-like macro with no visible definition immediately before a special member desyncs
tree-sitter-cpp: it drops the operator keyword or the ~ into a sibling ERROR node and
names the member by its bare type (_FORCE_INLINE_ operator T() const"T";
_FORCE_INLINE_ ~Variant()"Variant"). Recover the prefix from the ERROR node so the two
readers agree instead of double-counting.

3. Blind-spot promotion

Added cpp to _find_blind_spot_ranges (small tree-sitter-cpp ERROR nodes, padded ±2 lines for
the template <...> header line GitGalaxy anchors on), so GitGalaxy's correct extraction of a
constructor tree-sitter's error recovery loses (_FORCE_INLINE_ RequiredResult(...) : ... {})
is promoted to ground truth via the existing #1849 Phase 2 mechanism.

Result

Metric Before After
Func precision 95.0% 100.0%
extra_functions 68 0
Func recall 87.0% 89.3%
Args exact-match 99.8% 100.0%

tree_sitter_accuracy_audit --all --ci 31/31 OK; C unchanged. cpp baseline + summary table
regenerated.

Tri-comparison

The shared _get_node_name fix also lands in tri_comparison_gatherer, moving ~55
conversion-operator occurrences from cpp/function/existence/agree[tree_sitter]_vs[ctags,gitgalaxy]
(200 → 136) and agree[ctags,gitgalaxy]_vs[tree_sitter] (66 → 14) into GitGalaxy+tree-sitter
consensus. Verdicts, chart, points-of-interest regenerated; every reproducing ledger shape stays
validated. tri_comparison_chart --all --ci OK.

Scope

No engine changegitgalaxy/core/* untouched, no golden-master re-bless. This is a
measurement-accuracy fix: the audit now correctly recognizes that GitGalaxy and tree-sitter
found the same C++ members.

🤖 Generated with Claude Code

https://claude.ai/code/session_019Zm1uVBpVEZJ9SB7bWFR8S

`tree_sitter_accuracy_audit` measured cpp function precision at 95.0%
(68 "extra" functions). Every one is a real C++ special member that
GitGalaxy correctly extracts and tree-sitter-cpp either names differently
or drops -- zero genuine GitGalaxy false positives. Three shared-reader
fixes (used by both the accuracy audit and tri_comparison_gatherer):

1. Conversion-operator naming. tree-sitter's `operator_cast` /
   `qualified_identifier` node text bakes in the parameter list and
   cv-qualifiers (`Variant::operator String() const`) and, for a template
   conversion, the argument list (`operator Vector<Plane>() const`).
   GitGalaxy's `func_start` stores just `Variant::operator String` /
   `operator Vector`. Added `_cpp_canonical_operator_name` -- strips the
   trailing `(...)` + cv-quals and `<...>` args, keeps the `operator `
   keyword and `Ns::` qualifier. Guarded to CONVERSION operators only
   (`operator ` + a type token); symbol operators (`operator()`,
   `operator==`, `operator[]`) are left untouched.

2. `_FORCE_INLINE_`-macro parse errors. A function-like macro with no
   visible definition immediately before a special member desyncs
   tree-sitter-cpp: it drops the `operator` keyword or the `~` into a
   sibling ERROR node and names the member by its bare type
   (`_FORCE_INLINE_ operator T() const` -> "T"; `_FORCE_INLINE_ ~Variant()`
   -> "Variant"). Recover the prefix from the ERROR node so the readers
   agree instead of double-counting.

3. Blind-spot promotion. Added cpp to `_find_blind_spot_ranges` (small
   tree-sitter-cpp ERROR nodes, padded +/-2 lines for the `template <...>`
   header line GitGalaxy anchors on), so GitGalaxy's correct extraction of
   a constructor tree-sitter's error recovery loses
   (`_FORCE_INLINE_ RequiredResult(...) : ... {}`) is promoted to ground
   truth via the existing #1849 Phase 2 mechanism.

Result: cpp function precision 95.0% -> 100.0% (extra_functions 68 -> 0),
recall 87.0% -> 89.3% (the operator matches now count as found), args
exact-match 99.8% -> 100.0%. Baseline + summary table regenerated.
`tree_sitter_accuracy_audit --all --ci` 31/31 OK; C unchanged.

Tri-comparison: the shared `_get_node_name` fix also lands in
`tri_comparison_gatherer`, moving ~55 conversion-operator occurrences from
`cpp/function/existence/agree[tree_sitter]_vs[ctags,gitgalaxy]` (200 -> 136)
and `agree[ctags,gitgalaxy]_vs[tree_sitter]` (66 -> 14) into
GitGalaxy+tree-sitter consensus. Verdicts, chart, points-of-interest
regenerated; every reproducing ledger shape stays validated.

No engine change -- `gitgalaxy/core/*` untouched, no golden-master re-bless.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Zm1uVBpVEZJ9SB7bWFR8S
@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 df68f70 into main Aug 29, 2026
30 checks passed
@squid-protocol
squid-protocol deleted the cpp-func-precision-100 branch August 29, 2026 21:52
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