Repository navigation
Tree-sitter accuracy audit: node maps for crystal, erlang, nim, julia, r and fsharp - #9201
Merged
Merged
Conversation
…, r and fsharp language-crucible v1.8.0 added data for these languages, so the audit can now measure their function extraction against tree-sitter. Each map follows GitGalaxy's own definition of a function in that language (its func_start rule), not a guess: - crystal: a `def` (method_def) and not a bodiless `abstract def`; a setter's `=` is rebuilt (the grammar splits it off); parameters from the `params` field. `macro` and a column-0 `fun` are not modelled by the grammar and read as engine-only. - erlang: the engine cleaves at the clause-ending period, so a function is a whole form: clauses joined by `;` count once (named from the first), `f/0` and `f/1` ending in `.` count twice. - nim: every `routine` (proc/func/method/iterator/template/macro/converter), forward declarations included because the engine rule needs no body; anonymous `proc (x)` stays out. - julia: a function block and a call-shaped short-form assignment (`f(x) = ...`), not macros; the name is the callee's last identifier. The branch applies only to nodes with a Julia `signature`, so python/c/matlab `function_definition` nodes are untouched (a test pins this). - r: a function is named only by the assignment around it (`f <- function`, `=`, `<<-`, backticks, `obj$f`); the grammar tags the `function` keyword as the node's name field, so the generic lookup is bypassed. - fsharp: a `let` with a function_declaration_left and a member with an `args` field; values and properties stay out. Classes are mapped for crystal and erlang only; the other four have none (like lua/shell/tcl), because the detector's named class extraction is a per-language allowlist (#1264) none of them is on. First measurements (functions): crystal 98.2% recall / 90.1% precision, erlang 90.3% / 99.2%, nim 82.3% / 85.5%, julia 43.0% / 98.8%, r 98.2% / 96.9%, fsharp 45.8% / 95.2%. Baselines were generated in the CI-matched environment (tree-sitter-language-pack 1.24.0 from ci/requirements/treesitter.txt, full-precision venv). All 36 baselined languages pass --all --ci there; the 30 existing baselines did not move. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvhLsKhsTZmCyX36Qem
…nim, julia, r, fsharp) Generated by tests/tools/language_sheets.py --write from the committed baselines. Besides the six new function rows, C, C++, JavaScript, Kotlin and TypeScript change because main's call-graph baselines moved since the sheets were last generated. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvhLsKhsTZmCyX36Qem
squid-protocol
marked this pull request as ready for review
November 24, 2026 14:27
Contributor
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.
What this does
language-crucible v1.8.0 (merged, pin bumped in #9162) added data for ten languages. This maps six of them in the tree-sitter accuracy audit so their function extraction is measured against tree-sitter: crystal, erlang, nim, julia, r, fsharp. Ada is separate (#9154). Elixir, ocaml and hcl are not mapped (below).
Each map follows GitGalaxy's own definition of a function in that language (its
func_startrule), not a guess. First measurements:The low rows (julia, fsharp, part of nim) are real engine gaps, not mapping problems: see #9200, which I filed as one consolidated issue with isolated repros (one-line definitions are not extracted; an Erlang function after a
-speccontaining a record is dropped; Nim operator procs are unnamed).How each language is read (decisions worth checking)
method_def, not the bodilessabstract_method_def. The grammar splits a setter's=off (def name=(v)reads asname), so the name is rebuilt.macroand a column-0funare not modelled by the grammar and read as engine-only.;count once,f/0andf/1ending in.count twice. The grammar wraps each clause in its ownfun_decl, so a clause counts only if the previous form did not end in;.routine, forward declarations included (the engine rule needs no body, unlike its Ada rule). Anonymousproc (x)stays out.f(x) = ...), not macros. Short forms are in the reference because the engine's own rule lists them; I did not narrow the reference to hide the gap.functionkeyword as the node'snamefield, so the generic lookup would return the word "function".letwith afunction_declaration_leftand a member with anargsfield; values and properties stay out.class HTTP::Clientreads asHTTP). The other four have no class map, like lua, shell and tcl; julia and fsharp therefore show "N/A | 0.0%" in the summary table, as lua does.Read before merging
ci/requirements/treesitter.txt, the full-precision venv), after Tree-sitter accuracy audit: measure Ada (97.8% recall, 96.8% precision) #9154 showed that the self-scan venv gives different numbers. I did not run it in CI yet._get_node_namecaught everyfunction_definitionand returnedNonewhen there was no Juliasignature, which silently broke Python and R. It is now gated on asignaturechild, and a test pins that python names are untouched.--all --ciover all 36 baselined languages passes in the CI-matched environment; the 30 existing baselines did not move.call, the same problem as scheme), ocaml (functions arelet_bindings told apart only by parameters), hcl (no function definitions). The detection baseline has not been regenerated for the new languages; that would lift their coverage on the sheets and is a separate small step.docs/language_sheets. Besides the six new function rows, C, C++, JavaScript, Kotlin and TypeScript change becausemain's call-graph baselines moved since the sheets were generated.NODE_MAPSand_get_node_name; they should merge cleanly but whichever lands second may need a trivial rebase.Checked
pytest tests/tools/test_tree_sitter_accuracy_nodemaps.py tests/tools/test_language_sheets.py: 20 passedtree_sitter_accuracy_audit.py --all --ci(CI-matched env): 36 checked, all OKruff_audit.py --ci,doc_refs_audit.py --ci: no new findings🤖 Generated with Claude Code
https://claude.ai/code/session_018srRvhLsKhsTZmCyX36Qem