Repository navigation
Description
Summary
args_exact_match for haskell measures 31/81 (38.3%) in docs/self_scan/tree_sitter_accuracy_history.csv. Every sampled mismatch is real=0 got=N where GitGalaxy's own curried-arity count (N, from :: type-signature arrow counting -- see #1209) is correct -- the tool's tree-sitter ground truth is under-measuring.
Root cause
tests/tools/tree_sitter_accuracy_audit.py::_get_param_count looks for a field literally named parameters, which tree-sitter-haskell's real function-equation node never has.
Confirmed via a live parse of:
configureCommonState :: Foo -> Bar -> IO ()
configureCommonState a b = return ()This produces TWO separate nodes typed "function" (haskell's grammar reuses this type name for two unrelated shapes, both already inside func_node_types = {"function"}):
- Inside the
signaturenode: an arrow-chain type expression (Foo -> Bar -> IO ()) with fieldsparameter/arrow/result-- nonamefield, so_get_node_namecorrectly returnsNonefor it and it's never added toreal_funcs(no false-positive naming collision here, confirmed). - The actual function equation (
configureCommonState a b = return ()) with fieldsname(->variable, resolves to "configureCommonState" correctly),patterns(-> apatternsnode wrapping onevariablechild per parameter -- 2 in this example), andmatch.
_get_param_count never checks a patterns field at all, so it falls through every existing branch and returns 0 for every real haskell function equation regardless of true arity.
Reproduce: LANGUAGE_CRUCIBLE_PATH=/home/joe/nyx_projects/language-crucible python tests/tools/tree_sitter_accuracy_audit.py --lang haskell (no --ci) and read the "Sample args-count mismatches" section.
Suggested fix
Same shape as #1503/#1504 (this function's own precedent, plus the original #1339 whitelist-gap fix): when node.type == "function" and node.child_by_field_name("patterns") is not None, count that node's named children as the parameter count. Sample corpus (pandoc/App.hs) only exercises plain variable patterns in the cases checked so far -- verify against at least a wildcard (_) and a literal/constructor pattern (e.g. f 0 = ...) too, since those are also valid named children of a patterns node and should still count as one parameter each. Note this only fixes the ground-truth counter; it does not touch GitGalaxy's own arrow-counting args regex or _count_haskell_type_arrows in detector.py, which are already correct per the sampled mismatches (got already matches expected arity in every sample).
Out of scope
Do not touch anything related to func_start's equation-form detection (#1435/#1442, already closed) or the "Sample missing"/"Sample extra" func-name mismatches shown in the same audit run -- this issue is scoped to the args-counter only.
This only affects tests/tools/tree_sitter_accuracy_audit.py's own measurement accuracy (epic #1227/#1261), not GitGalaxy's actual args structural signature or risk scoring in any way.
Activity
fix(tree_sitter_accuracy_audit): args ground-truth counter missing so…
squid-protocol commentedon Aug 14, 2026
Fixed by #1507 (haskell equation node's param list field is 'patterns', not 'parameters' --
_get_param_countnow handles it, seetests/tools/tree_sitter_accuracy_audit.pyline ~1282). Closing as already resolved -- found while triaging the sweep backlog, PR merged but issue was never auto-closed.fix(tcl): default-value braced-pair parameters overcounted in args (#…