Skip to content

tree_sitter_accuracy_audit: tcl's _get_param_count never finds parameters (procedure's param list field is 'arguments', not 'parameters') #1504

Closed

Description

@squid-protocol

Summary

args_exact_match for tcl measures 42/141 (29.8%) in docs/self_scan/tree_sitter_accuracy_history.csv. Every sampled mismatch is real=0 got=N where GitGalaxy's own count (N) 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:

params_node = node.child_by_field_name("parameters")

tree-sitter-tcl's procedure node (GitGalaxy's func_node_types entry for tcl) exposes its parameter list under a field named arguments, not parameters. Confirmed via a live parse of:

proc do_write_test {name expr result} {
    puts "hi"
}

procedure's children are proc / simple_word (field name) / arguments (field arguments) / braced_word (field body). The arguments node wraps one argument child per parameter, each wrapping a simple_word. Since child_by_field_name("parameters") returns None and none of the existing fallback branches (C-style declarator, matlab's function_arguments) apply to tcl's shape, _get_param_count returns 0 for every tcl proc regardless of real arity.

Reproduce: LANGUAGE_CRUCIBLE_PATH=/home/joe/nyx_projects/language-crucible python tests/tools/tree_sitter_accuracy_audit.py --lang tcl (no --ci) and read the "Sample args-count mismatches" section.

Suggested fix

Same shape as issue #1503 (solidity's own _get_param_count field-name gap) and the existing matlab branch/issue #1339 precedent: when node.type == "procedure", read node.child_by_field_name("arguments") instead of "parameters", then count its argument-typed children (each wraps exactly one simple_word, no destructuring/default-value shapes to special-case in Tcl). Verify against a zero-arg proc (proc no_args {} { ... }, empty arguments node with no argument children) to confirm it still returns 0 cleanly, and against args-as-final-parameter (Tcl's variadic-capture convention, still just a plain argument/simple_word like any other -- no special counting needed).

Out of scope

The "Sample missing"/"Sample extra" func-name mismatches shown in the same audit run (drop_all_indexes/do_test etc.) are a separate func_start-naming concern, not part of this args-counting fix.

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

  1. added
    bug
    testing
    core-engine
    threat: false-negative
    on Aug 13, 2026
  2. squid-protocol commented on Aug 14, 2026

    @squid-protocol
    OwnerAuthor

    Fixed by #1507 (tcl procedure's param list field is 'arguments', not 'parameters' -- _get_param_count now handles it, see tests/tools/tree_sitter_accuracy_audit.py line ~1272). Closing as already resolved -- found while triaging the sweep backlog, PR merged but issue was never auto-closed.

  3. added this to the v2.4.8 milestone on Aug 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

    bugcore-enginepriority: mediumtestingthreat: false-negative

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions