test(cpp): C++ special-member name reconciliation → function precision 100% - #2455
Merged
Conversation
`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
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tree_sitter_accuracy_auditmeasured 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 andtri_comparison_gatherer)1. Conversion-operator naming
tree-sitter's
operator_cast/qualified_identifiernode text bakes in the parameter list andcv-qualifiers —
Variant::operator String() const— and, for a template conversion, theargument list —
operator Vector<Plane>() const. GitGalaxy'sfunc_startstores justVariant::operator String/operator Vector. Added_cpp_canonical_operator_name: strips thetrailing
(...)+ cv-quals and<...>args, keepsoperatorand theNs::qualifier.Guarded to conversion operators only (
operator+ a type token) — symbol operators(
operator(),operator==,operator[],operator->) are left untouched.2.
_FORCE_INLINE_-macro parse errorsA function-like macro with no visible definition immediately before a special member desyncs
tree-sitter-cpp: it drops the
operatorkeyword or the~into a siblingERRORnode andnames 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 tworeaders agree instead of double-counting.
3. Blind-spot promotion
Added cpp to
_find_blind_spot_ranges(small tree-sitter-cppERRORnodes, padded ±2 lines forthe
template <...>header line GitGalaxy anchors on), so GitGalaxy's correct extraction of aconstructor tree-sitter's error recovery loses (
_FORCE_INLINE_ RequiredResult(...) : ... {})is promoted to ground truth via the existing #1849 Phase 2 mechanism.
Result
extra_functionstree_sitter_accuracy_audit --all --ci31/31 OK; C unchanged. cpp baseline + summary tableregenerated.
Tri-comparison
The shared
_get_node_namefix also lands intri_comparison_gatherer, moving ~55conversion-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-sitterconsensus. Verdicts, chart, points-of-interest regenerated; every reproducing ledger shape stays
validated.
tri_comparison_chart --all --ciOK.Scope
No engine change —
gitgalaxy/core/*untouched, no golden-master re-bless. This is ameasurement-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