Skip to content

Tree-sitter accuracy audit: measure Ada (97.8% recall, 96.8% precision) - #9154

Merged
squid-shepherd[bot] merged 4 commits into
mainfrom
treesitter-audit-ada
Nov 24, 2026
Merged

squid-shepherd[bot] merged 4 commits into
mainfrom
treesitter-audit-ada

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

What this does

Adds Ada to the tree-sitter accuracy audit, so Ada gets a function measurement against a real reference for the first time (it was listed as deliberately unmeasured).

Why it was blocked, and why it is not now. The audit's note said language-crucible had no data/ada at the v1.2.0 pin. At the current pin (v1.7.0) it has 54 files (alire and functional: 33 .adb, 17 .ads). I removed the stale note.

What counts as a function (a judgement call). GitGalaxy's Ada func_start deliberately matches only a subprogram with a body (Rule 7: not a spec-only declaration, is abstract, is null or is new). The reference follows the same definition: a subprogram_body plus an expression function. My first attempt counted spec declarations too and gave 71.7% recall; that booked every .ads spec as a miss against a rule that excludes them by design, so I did not keep it. If you want specs counted, it is one line in NODE_MAPS["ada"], but the engine would then need a rule for them.

First measurement (49 files):

metric value
functions found 928 of 949 reference functions (97.8% recall)
extra functions 31 (96.8% precision)
argument counts exact 912 of 928 (98.3%)

The misses are mostly operator-overload bodies ("and", "or", "<", "xor") and some nested subprograms (Evaluate, Flatten, Iterate in alire-conditional_trees.adb). The extras are mostly constructs in .ads files. I did not investigate either further; they are candidate engine issues, not filed.

Code changes in tests/tools/tree_sitter_accuracy_audit.py: an ada entry in NODE_MAPS; the function name is read from the nested procedure_/function_specification; parameters are the unnamed identifiers of each parameter_specification (L, R : Boolean is two). No class measure: Ada's tagged types are not mapped. The tool also updated the summary table in gitgalaxy/standards/language_standards/__init__.py.

Update 2026-11-24: baseline corrected

CI failed on args_exact_match: 914 -> 912. I had generated the baseline in my self-scan venv, which differs from CI's installed dependencies. The CI-matched venv (tree-sitter-language-pack 1.24.0, hash-pinned in ci/requirements/treesitter.txt) reproduces 912, so I regenerated the baseline there (the pack version is the same in both environments; the difference is other installed packages). Every other Ada number is the same in both. I also merged current main and re-measured against the v1.8.0 pin.

Read before merging

  • This creates a gating baseline, tests/tree_sitter_accuracy_baseline_ada.json. CI will fail if Ada's numbers drop below it.
  • The reference is tree-sitter-language-pack's Ada grammar, not ground truth. The numbers measure agreement with it.
  • I ran the audit against data/ada extracted from the v1.7.0 tag with git archive, not a full crucible checkout. The corpus_path in the baseline reads language-crucible/data/ada like the others.
  • Not done: the other languages that were candidates. Julia, R, OCaml, Elixir, Erlang, Crystal, Nim, F# and HCL have no data in the crucible. Scheme, COBOL and Groovy are excluded for documented grammar reasons that still hold (I confirmed groovy's grammar still has no method nodes).

Checked

  • pytest tests/tools/test_tree_sitter_accuracy_ada.py: 3 passed; related tool tests: 228 passed, 3 skipped
  • tree_sitter_accuracy_audit.py --lang ada --ci: OK
  • ruff_audit.py --ci, doc_refs_audit.py --ci: no new findings

🤖 Generated with Claude Code

https://claude.ai/code/session_018srRvhLsKhsTZmCyX36Qem

…rence functions: 97.8% recall, 96.8% precision)

Ada was listed as deliberately not measured because language-crucible had no
data/ada at the old v1.2.0 pin. At the current v1.7.0 pin it has 54 files (alire
and functional), so the blocker is gone.

The reference follows GitGalaxy's own Ada definition of a function (Rule 7: a
subprogram with a body, not a spec-only declaration, `is abstract`, `is null` or
`is new`): a subprogram_body plus an expression function. Counting spec
declarations would book every .ads spec as a miss against a rule that excludes
them by design. The name lives on the nested procedure_/function_specification
and parameters are the unnamed identifiers of each parameter_specification
(`L, R : Boolean` is two), so both are read there.

First measurement over 49 files: 928 of 949 functions found (97.8%), 31 extra
(96.8% precision), 914 of 928 argument counts exact (98.5%). The misses are
mostly operator-overload bodies (`"and"`, `"<"`) and some nested subprograms; the
extras are mostly spec-file constructs. No class measure: Ada's tagged types are
not mapped.

Baseline written with --regenerate; the language-standards summary table was
updated by the tool.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018srRvhLsKhsTZmCyX36Qem
@squid-protocol
squid-protocol marked this pull request as ready for review November 24, 2026 00:09
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

squid-protocol and others added 2 commits November 24, 2026 08:51
… environment

CI's tree-sitter-accuracy-audit failed on Ada with `args_exact_match: 914 -> 912`. I
had generated the baseline in a different venv (the self-scan one) than CI's. The CI
matched venv (.crucible_venvs/full_precision, tree-sitter-language-pack 1.24.0 from
ci/requirements/treesitter.txt) reproduces 912, so the 912 is the figure CI measures;
the difference is in the installed dependencies, not the grammar pack version (both
environments use 1.24.0 and agree on every other Ada number: 949 reference functions,
928 found, 31 extra).

Regenerated from scratch (the tool refuses to regenerate over a regression, and this
baseline had not merged), against the language-crucible v1.8.0 pin. The new baseline
passes --ci in both environments (914 is better than 912, which the gate accepts).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018srRvhLsKhsTZmCyX36Qem
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Nov 24, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) November 24, 2026 18:51
@squid-shepherd
squid-shepherd Bot merged commit 54c2882 into main Nov 24, 2026
76 checks passed
@squid-shepherd
squid-shepherd Bot deleted the treesitter-audit-ada branch November 24, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant