Skip to content

tcl args regex: default-value braced parameters overcounted (proc foo {{db db}} measures got=2, real=1) #1512

Closed

Description

@squid-protocol

Summary

Found while verifying #1504 (tcl's tree-sitter ground-truth args-counting fix, PR #1507). After fixing the ground truth, a distinct real bug in GitGalaxy's own tcl args engine regex became visible: Tcl's default-value parameter syntax, {paramName defaultValue} as a single braced pair inside the argument list, is overcounted.

Repro

proc faultsim_integrity_check {{db db}} {
    ...
}

tree-sitter-tcl parses {{db db}}'s inner arguments node as a single argument child wrapping the whole {db db} span (confirmed via live parse) -- i.e. ground truth is real=1 (one parameter, db, with a default value also named db). GitGalaxy's own args regex measures got=2, i.e. it's splitting {db db} into two counted tokens instead of treating the braced pair as one parameter.

Same shape recurs across language-crucible/data/tcl/sqlite/tester.tcl (cksum, catchsafecmd, explain_i, ifcapable, etc. -- all real=N got=N+1, one extra count per default-valued parameter in the signature).

Suggested fix

Look at tcl's args rule in gitgalaxy/standards/language_standards.py -- it likely counts space-separated tokens without respecting Tcl's {name default} grouping syntax (distinct from the outer {...} that wraps the whole argument list). Needs to treat a nested {word word} pair as ONE parameter, not two, similar in spirit to how haskell's _count_haskell_pattern_list (#1505, PR pending) treats a parenthesized compound pattern as one token rather than naively whitespace-splitting.

Scope

Not fixed in this issue -- filed as a follow-up while working on a different args-counting fix, per repo convention (file incidental findings as their own issue rather than a PR-body footnote). Low priority: affects only tcl's args_exact_match measurement (currently 118/141, 83.7%) and the args structural-signal count for procs using this specific default-value syntax, not func_start/class_start naming accuracy.

Activity

  1. added
    bug
    testing
    core-engine
    threat: false-positive
    priority: low
    on Aug 13, 2026
  2. 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: lowtestingthreat: false-positive

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions