Repository navigation
Closed
Labels
bugUnintended behavior or logic failure in the enginecore-engineModifications to the central physics and parsing enginepriority: mediumtestingUnit, integration, and E2E pipeline verificationthreat: false-negativeAccuracy tuning: Engine missed a bypass or vulnerability
Description
Summary
The C language baseline shows real_functions=0 across 31 real C corpus files (tree-sitter's own parse found zero real functions), yet the same corpus's struct/class detection is healthy. This is implausible for 31 real C files and suggests a measurement artifact rather than a GitGalaxy defect.
Related epic: #1261
Measurements
From tests/tree_sitter_accuracy_baseline_c.json:
files_scanned: 31real_functions: 0 (tree-sitter found zero functions)found_functions: 0extra_functions: 1687real_classes: 79 (tree-sitter found 79 structs/classes)found_classes: 45extra_classes: 7
What's suspicious
- A real 31-file C codebase with zero functions (only structs/classes) is implausible -- C programs are primarily composed of functions.
- The same corpus's struct/class extraction (45/79 = 57% recall) suggests the corpus and measurement tool are generally working.
- GitGalaxy's C regex reports 1,687 false positives: if it's matching something legitimately wrong (macro invocations, typedef lines, etc.), that's a real finding. But not necessarily a function extraction defect.
Action
Before writing any "fix" for GitGalaxy's C func_start regex, verify the measurement tool's own ground truth:
-
Check
tests/tools/tree_sitter_accuracy_audit.py's file-language classification:- Are all 31 scanned files correctly identified as C (vs. C headers, C++, or other languages)?
- Does the measurement harness correctly distinguish
.cfrom.hfiles, or is it lumping headers (which often have zero functions) into the count?
-
Check the
run_engine_scan()function or equivalent:- Is the language field in
file_datacorrectly populated from the manifest or file extension for each file? - Are there any language-detection mismatches between tree-sitter's classification and GitGalaxy's?
- Is the language field in
-
If all 31 files are genuinely classified as C and genuinely contain zero functions:
- This may not be a GitGalaxy defect at all, only a measurement artifact (the corpus sample is header-heavy or library-only).
- Escalate to Epic: Real-world tree-sitter/AST accuracy tracking, per language #1227 (the tool's original epic) to add a corpus-validation step.
-
If there IS a mismatch or misclassification:
- Document the mismatch and file a SEPARATE sub-issue once the ground truth is clarified.
Notes
- This is filed as Tier 2 (measurement validation) rather than Tier 1 (defect) because the evidence suggests the measurement may be the problem, not the engine.
- Do NOT assume the 1,687 false positives are wrong until the ground truth is confirmed -- that might legitimately expose a precision issue once we know what we're actually measuring.
Metadata
Metadata
Assignees
Labels
bugUnintended behavior or logic failure in the enginecore-engineModifications to the central physics and parsing enginepriority: mediumtestingUnit, integration, and E2E pipeline verificationthreat: false-negativeAccuracy tuning: Engine missed a bypass or vulnerability
Activity
squid-protocol commentedon Aug 11, 2026
Diagnosis: confirmed measurement-tool bug, not a GitGalaxy defect. Fixed in #1280.
Traced the root cause empirically against the real
language-crucible/data/ccorpus (the same 31 files this baseline measures).Root cause:
_get_node_name()intests/tools/tree_sitter_accuracy_audit.pyextracts a node's name vianode.child_by_field_name("name"), with special-case fallbacks only for JS arrow functions, Fortran statements, and Make rules. tree-sitter-c'sfunction_definitionnode has nonamefield at all — the identifier sits two levels deep, atfunction_definition → declarator (function_declarator) → declarator (identifier), with an extrapointer_declaratorlayer for pointer-returning functions. There's no special case for it, so the fast path always returnsNone.Confirmed two ways:
function_definitionnode returnsname_field=None..c/.hfiles found 1,790 realfunction_definitionnodes, of which 0 exposed a usablenamefield.That's deterministic and corpus-content-independent —
real_functionswas always going to be0for C regardless of what's in the files. It also explainsfound_functions=0: nothing can ever match against an emptyreal_funcsset, so every one of GitGalaxy's genuinely-found function names got misclassified as a false positive ("extra"). 1,687 is in fact close to the true 1,790 real function definitions (~94%) — GitGalaxy's Cfunc_startregex was working fine the whole time.Also ruled out this issue's other hypothesis (header-heavy/misclassified corpus): all 31 scanned files are exactly the 22
.c+ 9.hfiles in the corpus, correctly classified asc. Not a language-detection bug.Bonus finding: the same tool had a second, distinct bug in the C++ baseline —
NODE_MAPS["cpp"]included"template_function"infunc_node_types, but that node type is a template instantiation expression (e.g.const_cast<Node*>,cast_to<Window>), not a function definition. 34 of the 87 "real_functions" counted for C++ were actually casts/instantiations.Fixed in #1280 (
_unwrap_c_style_declaratorhelper + droppingtemplate_functionfrom cpp's node map). Regenerated baselines:real_functions0→1776,found_functions0→1670,extra_functions1687→17 (94% recall, 99% precision).real_functions87→1187,found_functions5→253 (21% recall) — this is a real, previously-invisible GitGalaxy C++ recall gap now correctly surfaced for the first time. Not fixed in fix(testing): tree-sitter accuracy audit couldn't name C/C++ functions #1280 (that's an engine-hardening task, not a measurement fix) — worth a separate follow-up issue against the C++func_startregex.function_definition), fixed incidentally.No change was made to GitGalaxy's C
func_startregex — per this issue's own Action item 3, the 1,687 "false positives" weren't real.fix(core): C++ func_start missed pointer/reference returns and mishan…
fix(core): C args regex never recognized custom typedef'd parameter t…
fix(tests): fix tree_sitter_accuracy_audit.py's zero real_functions/c…
fix(testing): tree-sitter accuracy audit couldn't name C/C++ functions (
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, …
fix(testing, rust): exclude impl_item from class ground truth (scope …