Repository navigation
Description
Problem
tests/tools/tree_sitter_accuracy_audit.py currently treats tree-sitter as an unconditional ground truth and only measures GitGalaxy against it (--history → docs/self_scan/tree_sitter_accuracy_history.csv, --chart → docs/self_scan/tree_sitter_accuracy_chart.svg, a 5-panel small-multiples bar chart: func recall, func precision, class recall, class precision, args exact-match — one bar per language per panel, GitGalaxy-only). Repeated investigation work has found specific, evidenced cases where tree-sitter's own parse has the gap, not GitGalaxy's (documented in docs/why_gitgalaxy_beats_ast_here.md Claims 1-3: JS Flow-typed error-recovery hallucinations, C macro hallucinations, Cython dialect blind spots, csharp/fortran parse-error cascades). Treating tree-sitter as unconditionally correct understates GitGalaxy's real accuracy in these cases and hides tree-sitter's own weaknesses.
Goal
Report both tools' recall/precision against the same shared ground truth, so the chart shows GitGalaxy's 5 bars and tree-sitter's 5 bars side by side per language per metric.
Key insight
real_functions/real_classes in measure() (tests/tools/tree_sitter_accuracy_audit.py, the walk() function around lines 1740-1835) is already NOT tree-sitter's raw parse — it's tree-sitter's parse with several already-evidenced corrections baked in during the walk (JS Flow-hallucination skip list, C macro-hallucination skip list, perl bodyless-forward-decl dedup, TS bodyless constructor/overload/catch-finally drops). Each correction already IS one of the documented blind spots. So Phase 1 doesn't need a new hand-curated gold corpus — it exposes what those corrections are already correcting for, by keeping an UNCORRECTED copy of the same walk and scoring it against the same reconciled ground truth using the existing _align_occurrences_by_line alignment function (the same one already used to score GitGalaxy).
Scope for Phase 1 (explicitly deferred: promoting parse-error-cascade-region matches into ground truth so tree-sitter's cascade-region recall loss becomes visible too; that's a separate fast-follow)
-
In
measure(), alongsidereal_funcs/real_classes, build a second uncorrected copy of the same walk (every node matchingfunc_node_types/class_node_typeswith a resolvable name, no JS/C/perl/TS correction filters applied). Pair it againstreal_funcs/real_classesvia the existing_align_occurrences_by_line, producing new metrics keys:ts_found_functions,ts_extra_functions,ts_found_classes,ts_extra_classes. Apply the existingblind_spot_ranges/trailing_error_startexclusion consistently tots_extra_*too (ground truth itself is unchanged in this phase). -
For args: add a
_get_param_count_declaration_onlyvariant of_get_param_count(same function minus the shell/perl body-aware early-return branches — this reproduces exactly the "before" numbers from Claim 1's evidence table, e.g. shell 0%, perl 14.6%). Reuse the same paired occurrences already computed forargs_comparable/args_exact_match(keep a node reference alongside eachreal_funcsoccurrence so this doesn't require a re-walk) to computets_args_exact_matchagainst the sameargs_comparabledenominator GitGalaxy's own metric uses. -
None of this touches
_GATED_METRICS,_ALL_BASELINE_KEYS,run_ci_check, orrun_regenerate— the PR-time CI gate (.github/workflows/tree-sitter-accuracy-audit.yml) and baseline JSON schema (tests/tree_sitter_accuracy_baseline_*.json) stay exactly as-is. Tree-sitter's own numbers are informational only (not gated) — flow only through--history/--chart. -
Extend
_HISTORY_RAW_FIELDSand the CSV header indocs/self_scan/tree_sitter_accuracy_history.csvwith the 5 new fields (append-only; old rows simply lack the columns). -
Extend
generate_chart_svg()/_CHART_METRICSso each language gets two adjacent bars per panel (GitGalaxy + tree-sitter) instead of one, ranked by GitGalaxy's value as today, each bar independently colored by its own value via the existing_rainbow_hexLUT, with a short "GG"/"TS" tag to distinguish them. Update the chart's scope-note text to state both series are scored against the same reconciled ground truth, and that cascade-region recall loss isn't yet visible (Phase 1 limitation). -
Doc cleanup: consolidate
why_we_are_better_than_tree_sitter.md(repo root — currently a blanket, non-dated, non-evidence-disciplined "GitGalaxy is better than tree-sitter" writeup) intodocs/why_gitgalaxy_beats_ast_here.md's existing narrow/dated Claim format, verifying each claim still holds against current baselines, then delete the root file.
No workflow YAML changes needed — .github/workflows/tree-sitter-accuracy-history.yml already runs --history/--chart/--summary-table generically and will pick up the new fields automatically.
Activity
Report tree-sitter's own accuracy alongside GitGalaxy's (#1849) (#1850)
Promote source-verified blind-spot regions into ground truth (Phase 2, …
Tree-sitter accuracy chart: recall-side ground truth + diff badges + …
test(cpp): C++ special-member name reconciliation -> func precision 1…
test(recall-audit): stop counting tree-sitter's own mistakes as GitGa…
test(recall-audit): stop counting tree-sitter's mistakes as GitGalaxy…