Repository navigation
Description
Why
docs/language_status/<lang>.md §9 ("Measured accuracy") is the strongest evidence this repo
has for whether func_start/args/class_start/_dependency_capture actually work on real,
unmodified production code -- as opposed to the (also necessary, but isolated) hand-picked
valid/invalid/pathological snippets in tests/extraction/languages/test_<lang>.py. It's the
methodology that surfaced #1182/#1183/#1184/#1193 for Python (via stdlib ast) and #1220/#1221/
#1222 for JavaScript (via tree-sitter-language-pack, the first non-Python repeat).
Both of those passes were one-off, hand-run investigations -- the JavaScript one explicitly used
an ad hoc scratchpad script, not committed tooling (see PR #1223's own description: "no committed
permanent tooling ... since the user chose 'single deep dive' not 'build the tooling'"). That
means every future language pass currently re-derives the methodology from scratch, and there's
no regression floor once a pass is done -- a later PR could silently regress a language's
real-world accuracy with nothing catching it (unlike ruff_audit.py/mypy_audit.py/
dead_key_audit.py/tests/ast_accuracy_audit.py, which are all baseline-gated).
This epic is the "build it once, then roll out per language" pass for tree-sitter-based accuracy
measurement, following the same shape as epic #813 (extraction gauntlets) and epic #1069
(strict-signature depth): one prerequisite tool-build issue, then one issue per language.
Design (from investigation, see sub-issue #1 for the full writeup)
- One generalized script,
tests/tools/tree_sitter_accuracy_audit.py, mirroring
tests/ast_accuracy_audit.py's proven shape (pinned corpus,--ci/--regenerate/full-report
modes, per-language baseline JSON, regression-gated not zero-tolerance) -- swapastfor
tree-sitter-language-packand use a small per-language "node map" (function/class node types,
name/params field names -- these genuinely vary per grammar, e.g. JS arrow functions use field
parametersingular for a bare param butparametersplural for a parenthesized list) as the
only hand-built per-language artifact. - Corpus: reuse
language-crucible(the same ~80-repo corpustests/tools/crucible_check.py
already diffs against, pinned at tagv1.0, resolved viaLANGUAGE_CRUCIBLE_PATHor a sibling
checkout) instead of cloning a fresh external repo per language the way the JavaScript pass did
withexpressjs/express. Confirmed via spot-check:language-crucible's files are real,
complete, production source (not fragments -- e.g.jquery/ajax.js, Spring Boot's 1876-line
SpringApplication.java) and tree-sitter parses them cleanly (zerohas_erroron the JS
sample). This avoids building a whole new corpus-pinning/caching mechanism per language. - Language coverage: of GitGalaxy's 45 signature-bearing languages (has a non-
None
func_startrule), 36 have a confirmedtree-sitter-language-packgrammar (33 direct name
matches +shell->bash,objective-c->objc,makefile->makealiases). Note this
contradictsdocs/language_status/README.md's / thelanguage-statusskill's blanket claim
that cobol/fortran/apex/matlab have no practical ground truth -- those grammars exist in the
pack, but may still be low-quality for real enterprise dialects and need a per-language quality
spot-check before being trusted, not just an availability check.embedded_python,m4,
sqlite,yacchave no tree-sitter grammar at all (9 languages, matching the skill's existing
"no practical ground truth" list minus the 4 above, stay undocumented for §9 as already
established). - Write-up location unchanged:
docs/language_status/<lang>.md§9, per the existing
language-statusskill structure -- this epic doesn't change where results live, only how
they're produced and whether they're regression-gated afterward.
Distinct from #1096
#1096 (deferred, open) proposes a hand-authored synthetic multi-language control corpus to test
whether the same construct (a for loop, a try/except) is counted equivalently across
languages -- a signal-equivalence check. This epic is about real-world extraction accuracy for
one language at a time against that language's own tree-sitter ground truth. Complementary, not
overlapping -- keep them separate.
Sequencing
- Build the generalized tool + node-map registry (see sub-issue -- being filed alongside this
epic). - Re-derive the JavaScript §9 numbers (fix(core): critical-leak synthetic risk_vector hardcoded to stale 18-length RISK_SCHEMA #1220/func_start missing the args regex's 'Invocation Shield': bare call statements false-positive as function definitions (7 languages) #1221/javascript: second occurrence of a structurally-identical top-level function silently dropped from function_data #1222) through the new tool as a correctness
check before trusting it for a new language. - Roll out one language at a time via its own sub-issue, filed incrementally as capacity allows
-- not filing the full ~34 remaining candidate-language sub-issues up front (unlike Epic: Harden the four extraction gauntlets (function/args/class/dependency) per language #813/Epic: Harden the strict structural-signature test suite (non-extraction-pillar rules) per language #1069,
which did front-load their full sub-issue list; deliberately deferred here since each pass
costs real investigation time/tokens per language, same reasoning Feature: multi-language control corpus to validate structural extraction equivalence across languages #1096 itself gave for
needing "a design pass before scoping into sub-issues").
Python (ast, not tree-sitter -- no grammar needed) and JavaScript (tree-sitter, ad hoc) are
already done; not re-listed as pending.
Activity
squid-protocol commentedon Aug 11, 2026
I have reviewed this epic and the workflow still fits perfectly, with one proposed optimization:
We just completed Step 2 (re-deriving the JavaScript baseline) in PR #1236, which proved the
tree_sitter_accuracy_audit.pygeneralized tool works brilliantly and is ready for expansion.For Step 3, rather than strictly doing one language per PR (which would mean ~34-50 separate PRs, creating massive review overhead and CI spam), I propose we roll these out in thematic clusters of 5-8 languages per PR (e.g., a "Core Scripting" cluster for Ruby/PHP/Perl/Lua, a "C-Family" cluster for C/C++/C#/Java, etc.).
For each cluster, our workflow would be:
NODE_MAPSintests/tools/tree_sitter_accuracy_audit.py.python tests/tools/tree_sitter_accuracy_audit.py --lang <lang> --regenerateagainst thelanguage-cruciblecorpus to establish the exact baseline metrics.This strikes the right balance between not front-loading all languages at once, while avoiding the extreme overhead of dozens of separate PRs. I am ready to begin with the first cluster whenever you'd like to proceed!
feat(ci): formalize tree-sitter accuracy audit as a CI regression gate (
squid-protocol commentedon Aug 11, 2026
Closing — the epic's core deliverables are done:
tests/tools/tree_sitter_accuracy_audit.py+ per-language node-map registry, closed.--ci/--regeneratemachinery into real CI — a PR-time gate (tree-sitter-accuracy-audit.yml, ~1min across all baselined languages) plus a push-to-main history/summary-table updater (tree-sitter-accuracy-history.yml, appending todocs/self_scan/tree_sitter_accuracy_history.csvfor graphing over time). This was the epic's actual stated motivation in the "Why" section — "no regression floor once a pass is done" — now closed.language-crucible(not the original ad hoc express/site/js/corpora from fix(core): critical-leak synthetic risk_vector hardcoded to stale 18-length RISK_SCHEMA #1220-1222) — validates the generalized tool works, though it's a different corpus than javascript.md §9's existing numbers, so those weren't overwritten.Remaining candidate languages (e.g.
makefile) can roll out incrementally the same way the last four clusters did, per this epic's own sequencing note ("filed incrementally as capacity allows, not filing the full remaining list up front") — same pattern #813 and #1069 used: epic closes once the build-out is done, further per-language passes are business as usual rather than still-open epic work.feat(ci): roll out apex/fortran/makefile/matlab/tcl tree-sitter accur…