Repository navigation
Description
Summary
While fixing #1263 (C++ func_start accuracy) and its prerequisite #1265/PR
#1280 (tree-sitter accuracy audit measurement bugs), a third, unrelated
measurement bug surfaced and got fixed as part of PR #1280: the audit tool's
_get_param_count() had the same "C-family function_definition has no
top-level field" gap _get_node_name() did before #1265 — it silently
returned 0 for every C/C++ function's real parameter count regardless of
actual arity, because parameters live behind a nested function_declarator,
not directly on function_definition.
Fixing that (PR #1280's second commit) revealed that GitGalaxy's own C
args/args_exact_match measurement, which looked fine before (1491/1670 =
89% exact match in the committed baseline), was actually two independent
bugs silently cancelling out: the old ground truth always read 0 params
(via the missing-field gap above), and it turns out GitGalaxy's own C args
regex/counting also frequently returns 0 for functions with real,
non-empty parameter lists — so the two wrong numbers agreed far more often
than either was actually correct. Measured correctly for the first time,
args_exact_match for C is 175/1670 (10%), not 89%.
Example
cpython/ceval.c::PyEval_GetFrameGlobals real=1 got=0
cpython/ceval.c::PyEval_SetProfileAllThreads real=2 got=0
cpython/ceval.c::_PyEval_ExceptionGroupMatch real=5 got=0
Confirmed via tests/tools/tree_sitter_accuracy_audit.py --lang c (verbose
sample list) against the pinned language-crucible/data/c corpus.
Suspected root cause (not yet fully traced)
The cpp analog of this same class of bug (found and partially traced while
working on #1263, but not fixed there since it's the args rule, a
different extraction pillar than func_start): detector.py's
_calculate_block_metrics computes a function's own arg count by re-running
the language's separate args regex (rules["args"]) via .search(block)
against the whole function body, not just its own signature line — for a
genuinely 0-arg function like void inProcess_initialize() { ... }, if the
body itself contains an earlier call whose parenthesized argument happens to
look like a typed parameter list to the args regex's heuristic (e.g. a
single-uppercase-letter string-literal prefix like RegisterWindowMessage(L"...")
matching the regex's [A-Z]\w* "looks like a type name" branch), that
call's arg count gets attributed to the enclosing function instead of 0.
Worth verifying this same mechanism explains the bulk of the C corpus's gap
too before proposing a fix.
Action
- Confirm root cause against the C corpus specifically (may be the same
.search(block)-scans-the-whole-body issue, or a distinct C-args-regex
gap — the C and cppargsrules inlanguage_standards.pyare separate
regexes). - Follow the
harden-language-extractionskill's methodology. - Regenerate
tests/tree_sitter_accuracy_baseline_c.json/
tests/tree_sitter_accuracy_baseline_cpp.jsonand the golden-master
fixtures (tests/tools/crucible_check.py --update) once fixed.
References
- Epic Epic: Fix extraction accuracy gaps found by the tree-sitter accuracy audit #1261 (this tool's own umbrella issue) — this fits under its
args
extraction-pillar scope, distinct from thefunc_startname-accuracy work
in [TIER 1] Ruby func_start matches 0/117 real methods in language-crucible corpus #1262/[TIER 1] C++ func_start: 1,147 false positives against only 5/87 real functions found #1263/[TIER 1] Class detection is 0% across apex/csharp/fortran/solidity despite near-perfect function detection #1264/[TIER 2] Verify tree-sitter accuracy measurement's own ground truth for C before treating found_functions=0 as a GitGalaxy defect #1265/[TIER 3] Broaden scala/matlab/haskell func_start regexes -- safe, zero current false positives #1266. - PR fix(testing): tree-sitter accuracy audit couldn't name C/C++ functions #1280 (where the ground-truth measurement side of this was fixed and
the C regression first surfaced). - PR fix(core): C++ func_start missed pointer/reference returns and mishandled operator/destructor names #1281 ([TIER 1] C++ func_start: 1,147 false positives against only 5/87 real functions found #1263's cpp
func_startengine fix — same investigation, but
scoped to names, not arg counts).
Activity
fix(core): C args regex never recognized custom typedef'd parameter t…
Add docs/language_status/c.md -- full doc plus tri-comparison capstone
Resolve 8 of 11 c tri-comparison ledger shapes, 2 more tooling fixes (#…
Correct overclaim in c.md, cross-reference pre-existing args issues, …