Repository navigation
Report tree-sitter's own accuracy alongside GitGalaxy's - #1850
Merged
Merged
Conversation
tests/tools/tree_sitter_accuracy_audit.py treated tree-sitter as an unconditional ground truth, measuring only GitGalaxy against it. Repeated investigation work has found specific, evidenced cases where tree-sitter's own parse has the gap instead (docs/why_gitgalaxy_beats_ast_here.md's Claims 1-3): JS Flow-typed hallucinations, C macro hallucinations, Cython dialect blind spots, csharp/fortran parse-error cascades. measure() already builds real_funcs/real_classes as tree-sitter's parse with those exact corrections baked in during the walk -- so this keeps an uncorrected copy of the same walk and scores it against the same reconciled ground truth via the existing _align_occurrences_by_line, producing ts_found_functions/ts_extra_functions/ts_found_classes/ ts_extra_classes/ts_args_exact_match (the last via a new _get_param_count_declaration_only, reproducing Claim 1's declaration- only baseline live). --chart now renders two stacked bars per language per panel (GitGalaxy on top, tree-sitter's raw reading below), ranked by GitGalaxy's value. Phase 1 scope: tree-sitter's recall panels read 100% by construction since ground truth is still walked from its own tree -- promoting parse-error-cascade regions into ground truth so its real recall loss becomes visible too is deferred to a follow-up. None of this touches the PR-gate baseline schema or _GATED_METRICS -- tree-sitter's own numbers are informational, flowing only through --history/--chart, not CI-gated. Also consolidates why_we_are_better_than_tree_sitter.md (a root-level doc that didn't follow this repo's narrow/dated/evidenced-claim discipline) into docs/why_gitgalaxy_beats_ast_here.md as four verified Claims (8-11); its TypeScript-signature content was deliberately not carried forward since the ground truth treats those cases as not comparable at all, not as tree-sitter missing them. Co-Authored-By: Claude Sonnet 5 <[email protected]>
Contributor
Merged
5 tasks done
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.
Summary
Closes #1849.
tests/tools/tree_sitter_accuracy_audit.pytreated tree-sitter as an unconditional ground truth, measuring only GitGalaxy against it. Repeated investigation work has found specific, evidenced cases where tree-sitter's own parse has the gap instead (docs/why_gitgalaxy_beats_ast_here.md's Claims 1-3: JS Flow-typed hallucinations, C macro hallucinations, Cython dialect blind spots, csharp/fortran parse-error cascades). This PR makes the comparison symmetric: the chart shows GitGalaxy's 5 bars and tree-sitter's own 5 bars, per language, per metric, across three commits.Commit 1 — precision-side symmetric measurement
measure(): keeps an uncorrected copy of the same tree-sitter walk (raw_ts_funcs/raw_ts_classes) alongside the existing correctedreal_funcs/real_classesground truth, and scores it the same way GitGalaxy is scored (_align_occurrences_by_line), producingts_found_functions/ts_extra_functions/ts_found_classes/ts_extra_classes/ts_args_exact_match. The last one uses a new_get_param_count_declaration_only(reuses_get_param_countwithlang="") — reproduces Claim 1's declaration-only baseline (shell 0%, perl ~18%) as a live measured number._GATED_METRICS, orrun_ci_check— tree-sitter's own numbers were informational only in this commit.why_we_are_better_than_tree_sitter.mdintodocs/why_gitgalaxy_beats_ast_here.mdas four newly-verified Claims (8-11).Commit 2 — recall-side ground-truth promotion (Phase 2)
Commit 1's recall panels read 100% by construction for every language — ground truth was walked purely from tree-sitter's own tree, which structurally can't miss what it defines. This promotes GitGalaxy's own matches inside an already-identified blind-spot/cascade region directly into
real_funcs/real_classes, extending the same trust the pre-existingextra_functionsexclusion already placed there (Claims 3/6/7: #1427/#1567 csharp, #1709 fortran, rustmacro_rules!bodies) from "don't penalize" to "count as found":Deliberately scoped to
blind_spot_ranges(already lang-scoped to rust/fortran internally) plustrailing_error_startfor csharp only — not every language the general cascade detector fires on. Verified an unscoped version also drifted c/cpp/javascript/powershell/python/tcl; none of those have the same source-level "fully blind" verification csharp does (Claim 3 explicitly documents javascript as the counter-example — its cascade "resyncs locally" rather than going fully blind, so blanket-promoting there risks blessing a genuine GitGalaxy false positive as ground truth). Scoping tolang == "csharp"for the cascade case brought the drift back down to exactly the 3 languages this was actually verified against.This raises
real_functions/found_functions/found_classesfor csharp/fortran/rust — the gated baseline schema this time, unlike commit 1's purely-informational fields. Their 3 baselines are regenerated here as a deliberate, evidenced ground-truth improvement, per the repo's normal re-blessing protocol.Also reworks the chart layout: rows share one alphabetical language order across all five panels (previously each panel was ranked independently by GitGalaxy's value), with a continuous full-width stripe band, so a single language's numbers can be read straight across instead of hunting for it at a different row in every column.
Commit 3 — per-cell diff badges, shared label column, GitGalaxy-only languages
Three more usability improvements, requested after reviewing the first two commits:
LANGUAGE_DEFINITIONS/NODE_MAPS(_gg_only_langs), not hand-listed. A newmeasure_gg_only()runs the same corpus/engine-scan pipeline but skips the tree-sitter diff entirely (no NODE_MAPS entry to diff against) and renders GitGalaxy's raw found-count as a plain gray bar, tree-sitter side always n/a. Three of the fourteen (ada, embedded_python, sqlite) have no language-crucible corpus yet and render as an all-n/a stub row instead of crashing the run — fills in automatically once the corpus catches up, no code change needed.CSV schema gains 2 more columns (
gg_only,gg_only_data_available); the existing_migrate_history_csv_schemahandles the header/backfill migration generically. Baseline-gated CI schema untouched — verified--all --cistill passes clean.Test plan
python tests/tools/tree_sitter_accuracy_audit.py --lang javascript/shell/perl/csharp/c/fortran/rust— sanity-checkedts_*numbers by hand against documented gaps.python tests/tools/tree_sitter_accuracy_audit.py --all --ci— passes clean (31/31) after each commit, confirming exactly the intended baseline drift (none in commits 1 and 3, csharp/fortran/rust only in commit 2).lang == "csharp".python tests/tools/tree_sitter_accuracy_audit.py --historythen--chartafter each commit — regenerated CSV/SVG, visually confirmed via Inkscape PNG renders (paired bars, shared alphabetical row order, diff badges on real differences only, GitGalaxy-only rows rendering correctly including the awaiting-data stub state, no clipped labels).ruff format .,python tests/ruff_audit.py --ci,python tests/mypy_audit.py --ci,python tests/dead_key_audit.py --ci— all clean, no new findings, after each commit.detector.pybehavior with isolated scratch snippets before restating them.🤖 Generated with Claude Code