Skip to content

Epic: Fix extraction accuracy gaps found by the tree-sitter accuracy audit #1261

Closed

Description

@squid-protocol

Summary

This epic exists because tests/tools/tree_sitter_accuracy_audit.py (built/rolled out in #1227, #1249, #1253) surfaced real, measured func_start/class_start extraction defects in GitGalaxy's structural-signature system.

IMPORTANT SCOPE NOTE: This tool measures ONLY function/class name extraction accuracy (the func_start/args/class_start "extraction gauntlet" pillar from epic #813) -- it does NOT measure GitGalaxy's risk-scoring rules (branch, io, safety_bypasses, concurrency, cryptography, etc.), which are hardened and tested completely separately and are unaffected by anything these measurements show.

What the audit does

  • Scans each language's real-world corpus samples in language-crucible/data/<lang> (pinned corpus snapshot, same one tests/tools/crucible_check.py uses)
  • Parses each file with tree-sitter's grammar to extract the "ground truth" function/class count
  • Compares against GitGalaxy's regex-based extraction on the same files
  • Produces per-language baseline JSON files: tests/tree_sitter_accuracy_baseline_<lang>.json (keys: files_scanned, real_functions, found_functions, extra_functions, real_classes, found_classes, extra_classes, args_comparable, args_exact_match)

Sub-issues filed

The following 5 issues categorize the gaps found, from highest-severity (100% miss rate) through medium (measurement validation needed) to lowest-severity (narrow but safe broadening opportunity):

  1. #[ruby] Ruby func_start matches 0/117 real methods in language-crucible corpus
  2. #[cpp] C++ func_start: 1,147 false positives against only 5/87 real functions found
  3. #[class-detection] Class detection is 0% across apex/csharp/fortran/solidity despite near-perfect function detection
  4. #[c-verify] Verify tree-sitter accuracy measurement's own ground truth for C before treating found_functions=0 as a GitGalaxy defect
  5. #[scala-matlab-haskell] Broaden scala/matlab/haskell func_start regexes -- safe, zero current false positives

References

Activity

  1. added this to the v2.4.8 milestone on Aug 16, 2026
  2. squid-protocol commented on Aug 31, 2026

    @squid-protocol
    OwnerAuthor

    Closing: the audit's gaps are fixed, measured, and now enforced in CI — across three corpus generations

    This epic's extraction-accuracy concerns were addressed and re-validated against language-crucible v1.0, v1.1.0, and v1.2.0 (pinned via LANGUAGE_CRUCIBLE_REF + tests/_crucible_pin.py), with each corpus growth step (152→218 folders, 2,344→3,306 files by v1.2.0) deliberately used to stress the fixes on new real-world code rather than freezing the benchmark at the snapshot that first surfaced the bugs.

    The original five sub-issues are all closed (#1262 ruby, #1263 c++, #1264 class detection, #1265 C ground-truth verification, #1266 scala/matlab/haskell broadening), along with the ~15 follow-on issues the audit surfaced as it deepened (#1311, #1312, #1314, #1319, #1336, #1338, #1405, #1406, #1504, #1506, #1518, #1608, #1630, #1641, …) — a search for issues referencing this epic returns zero open.

    Measured before → after (from the committed history, first audit run 2026-08-11 vs. today's run on v1.2.0):

    • ruby func_start: 0/117 found, 12 false positives → 124/124, 0 false positives
    • c++ func_start: 5/87 found, 1,147 false positives → 1,370/1,370, 0 false positives
    • Repo-wide today: 45 languages, 2,496 corpus files — 24,625 tree-sitter-verified real functions with 65 residual extra function claims total (vs. 1,147 in one language at epic open), 1 residual extra class against 3,120 real, and 98.9% exact args match (24,356/24,624 comparable signatures)

    This is no longer a point-in-time audit. tree-sitter-accuracy-audit.yml runs as a baseline-gated CI check on parsing-logic PRs, and the history CSV + chart regenerate on merges to main (latest run today). Where the 2-tool audit's ground truth itself proved wrong, that was verified and documented rather than chased (#1265, #1608, #1641 are all measurement-side fixes — the audit holds itself to the same standard it holds the engine to).

    The program this epic started also graduated: the 2-tool comparison grew into the tri-comparison (adding Universal Ctags, with a per-disagreement validated ledger — methodology). On the pinned corpus, validated function precision is 100% across all 31 tree-sitter-comparable languages, and GitGalaxy is never the tool found wrong in a validated class or argument disagreement.

    Honest residuals, documented not hidden: groovy has no tree-sitter ground truth (recall unmeasurable; its unverified extras are flagged for follow-up, not counted as wins); css's at-rule args_comparable residue is documented in the audit's SCOPE docstring; and per this epic's own scope note, none of this measures the risk-scoring layer — cross-language measurement consistency now has its own instrument (#1096 → keyword-rosetta, Phase-5 CI tracked in #2557).

  3. added
    scope:frontier
    on Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope:frontier

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions