Skip to content

fix(tree_sitter_accuracy_audit): args ground-truth gaps for solidity/tcl/haskell/ruby - #1507

Merged
squid-protocol merged 1 commit into
mainfrom
fix/args-ground-truth-solidity-tcl-haskell-ruby
Aug 13, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix/args-ground-truth-solidity-tcl-haskell-ruby

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

_get_param_count() in tests/tools/tree_sitter_accuracy_audit.py (the args-counting ground truth, not GitGalaxy's actual engine) only knew how to find a parameter list via a parameters field or a C-style declarator. Four real per-language shapes fell through and silently measured 0 real params regardless of true arity:

Bonus: the solidity fix's fallback branch is gated on the shared node type function_definition, which objective-c also uses for its C-style plain functions -- some objc functions whose declarator-based extraction failed also now resolve correctly via the same fallback: args_exact_match 110/149 → 148/149.

Process note

All 4 were originally scoped as separate issues for a 4-way parallel Gemini dispatch (this repo's usual pattern for independent per-language fixes), but since all 4 land in the exact same function and I'd already fully root-caused each one, implementing them directly was faster and avoided guaranteed same-function merge conflicts across 4 PRs -- so this is one PR covering all 4 issues plus the objc bonus.

Remaining gaps (filed separately, not fixed here)

Fixing the ground truth surfaced two genuine GitGalaxy engine-side bugs that were previously masked by the ground truth itself under-measuring:

  • haskell: let/where-local functions with no :: type signature (e.g. isPandocCiteproc) measure real=1 got=0 -- GitGalaxy's args regex relies on arrow-counting a :: signature that doesn't exist for these.
  • tcl: default-value braced parameters (e.g. proc foo {{db db}}) measure real=1 got=2 -- GitGalaxy's args regex appears to split on whitespace inside the default-value braces instead of treating {db db} as one parameter.

Out of scope for this PR (ground-truth-only fix); will file follow-ups.

Verification

tree_sitter_accuracy_audit --lang solidity/tcl/haskell/ruby/objective-c --regenerate   # each bcommitted
tree_sitter_accuracy_audit --all --ci     # all 31 baselined languages clean, no cross-language regressions
tree_sitter_accuracy_audit --summary-table  # docstring table refreshed
tests/tools/audit_check.py --ci           # ruff/mypy/dead-key/ast-accuracy all clean (pre-existing baseline only)

No crucible_check.py/golden-master diffing needed -- this only touches the accuracy-measurement tool itself, not GitGalaxy's parsing engine.

Fixes #1503, #1504, #1505, #1506.

🤖 Generated with Claude Code

…lidity/tcl/haskell param-list shapes + ruby keyword_parameter

_get_param_count() only checked for a "parameters" field or a C-style
declarator, which left four real per-language parameter-list shapes
silently measuring 0 real params regardless of true arity:

- solidity: function/modifier/constructor nodes have no "parameters"
  field at all -- params are bare, field-less "parameter" children.
  Also fixes objc's C-style function_definition fallback as a side
  effect (110/149 -> 148/149), since both share the same node type.
- tcl: procedure's param list field is named "arguments", not
  "parameters".
- haskell: the real function-equation "function" node's params live
  in a "patterns" field (distinct from the same-named arrow-chain
  type-expression node, which has no "name" field and was already
  correctly excluded).
- ruby: "keyword_parameter" was missing from the counted_types
  whitelist, a follow-on gap from #1339.

args_exact_match: solidity 22/95 -> 95/95, tcl 42/141 -> 118/141,
haskell 31/81 -> 43/81, ruby 89/117 -> 106/117, objective-c
110/149 -> 148/149 (bonus).

Fixes #1503, #1504, #1505, #1506.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@squid-protocol
squid-protocol merged commit 197ddba into main Aug 13, 2026
27 checks passed
@squid-protocol
squid-protocol deleted the fix/args-ground-truth-solidity-tcl-haskell-ruby branch August 13, 2026 23:29
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

squid-protocol added a commit that referenced this pull request Aug 13, 2026
…s qualified/dotted type signatures (#1513)

Two distinct bugs in the haskell "args" engine regex, found while
verifying #1503-#1506's ground-truth fixes:

1. Typeclass instance methods and where/let-local helpers routinely
   have no restated `::` signature (same shape #1435/#1442 taught
   func_start to recognize) -- args_count fell back to 0 regardless
   of true arity. Added a new capture-group alternative for the
   equation's own LHS pattern list (`name pat1 pat2 = ...`), routed
   through a new detector.py _count_haskell_pattern_list (depth-aware,
   so a parenthesized compound pattern like `(MetaList xs)` counts as
   one argument, not two via naive whitespace-split). Explicitly
   excludes Haskell reserved keywords so `let x = 1` is never mistaken
   for a function equation.

2. The `::` signature capture's character classes never included "."
   -- real-world qualified/imported type names (`T.Text`, `IO.Newline`)
   truncated the whole captured signature at the first dot, silently
   dropping every arrow after it (confirmed: `inquotes :: T.Text ->
   T.Text` captured only "T", zero arrows from a real 1-arrow
   signature). This affected the majority of real corpus mismatches.

args_exact_match: 31/81 -> 43/81 (ground-truth fix alone, #1507) ->
70/81 (86.4%) with both fixes here.

Remaining known gap (documented, not fixed): arrow-count vs.
actual-binding-arity diverges for point-free/partially-applied
equations (e.g. `writerFn`'s signature has 3 arrows but its equations
only bind 2 patterns, since the body itself returns a function value)
-- not fixable without real type inference. tcl's own separate
default-value-parameter overcount bug filed as #1512, not fixed here.

Fixes #1511.

Co-authored-by: Joe Esquibel <[email protected]>
Co-authored-by: Claude Sonnet 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tree_sitter_accuracy_audit: solidity's _get_param_count never finds parameters (function_definition has no 'parameters' field)

1 participant