Repository navigation
Description
Summary
tests/tools/tree_sitter_accuracy_audit.py --lang c reports class_precision 78.2% (found_classes=61, extra_classes=17). All 17 "extra classes" (100%) are the exact same literal name: Anonymous_Class, one per file, across all 17 affected corpus files (cpython, doom, micropython, sqlite/lemon.c).
This is not a GitGalaxy engine false-positive. It's the exact same measurement-tool blind spot already fixed for functions via _SYNTHETIC_GG_FUNC_NAMES = frozenset({"Anonymous_Block", "__global_context__"}) (see that constant's own comment, matlab/shell), just never extended to the class comparison.
Root cause
gitgalaxy/core/detector.py's _resolve_class_start_match (line ~432) falls back to the literal string "Anonymous_Class" as the reported name whenever c's class_start regex matches a struct/union/enum with no capturable tag name -- most commonly typedef struct { ... } Foo;, an extremely common real C idiom (epic #813/#822 deliberately made the tag name optional so this shape is found, just not named). This is intentional, correct behavior for the engine: the struct genuinely exists, GitGalaxy just can't invent a name tree-sitter didn't give it either.
tree_sitter_accuracy_audit.py's class-comparison step (measure(), around line 1783-1794) builds gg_classes directly from class_data.class_name with no equivalent exclusion set, so every Anonymous_Class row is compared by literal string against tree-sitter's real_classes set -- which, by construction, can never contain the string "Anonymous_Class" (tree-sitter reports real node text, not GitGalaxy's placeholder), so it's counted as a permanent false "extra" every time GitGalaxy correctly identifies an anonymous struct/union/enum.
Confirmed via direct diff script over language-crucible/data/c/*: 17/17 extra_classes are literally 'Anonymous_Class', zero other names.
Suggested fix
Add a _SYNTHETIC_GG_CLASS_NAMES = frozenset({"Anonymous_Class"}) in tests/tools/tree_sitter_accuracy_audit.py, filtered out when building gg_classes, mirroring the existing _SYNTHETIC_GG_FUNC_NAMES filter applied to gg_funcs_by_name a few lines above it. Audit-tool-only change; no gitgalaxy/ engine code needs to change.
Out of scope
- Not chasing whether
Anonymous_Classshould ever get a real inferred name (e.g. from the typedef alias) -- that's a separate, harder extraction-accuracy question, not a measurement-tool bug. - csharp's own class_start precision gap (73.3%) has a completely different root cause (a grammar parse-error cascade, same family as tree_sitter_accuracy_audit.py: csharp ground truth misses a real method due to a tree-sitter parse error in a large corpus file #1427/tree_sitter_accuracy_audit: csharp's #1427 exclusion misdiagnosed the trigger and undersold scope (~100x) #1567) -- filed separately.
Scope note: this only affects the tree-sitter-accuracy measurement's class_precision number (epic #1261/#813's extraction-pillar naming accuracy), not GitGalaxy's actual risk-scoring output.
Activity
fix(testing): tree-sitter accuracy audit -- fix c/csharp class_start …
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, …