fix(tcl): default-value braced-pair parameters overcounted in args - #1539
Merged
Conversation
#1512: Tcl's default-value parameter syntax {paramName defaultValue} (a single braced pair inside the outer argument-list braces, e.g. proc foo {{db db}}) was counted as 2 tokens instead of 1. Root cause was in detector.py's _calculate_block_metrics fallback (naive whitespace .split() for any comma-free args string), not the regex capture itself -- fixed with a depth-aware token walk (_count_tcl_arg_list) mirroring the existing haskell pattern-list counter's precedent (#1505): a {...} span at depth 0 is one token, bare tokens are one each. No regex/ReDoS surface change. Verified against language-crucible/data/tcl/sqlite/tester.tcl: args_exact_match 119/142 -> 142/142 (100%), found_functions/extra_functions unchanged. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
This was referenced Aug 14, 2026
squid-protocol
added a commit
that referenced
this pull request
Aug 14, 2026
…sequence (#1545) PR #1539 (tcl fix) was built against main before PR #1538 (dart fix) merged, so its own crucible-audit CI ran against a stale base and correctly flagged drift -- but auto-merge proceeded anyway since crucible-audit isn't a required check, landing tcl's fix without its golden masters reflecting dart's already- merged changes. This blesses main's actual current combined state (both fixes applied) rather than a snapshot of either fix in isolation. No code change. Co-authored-by: Joe Esquibel <squid-protocol@users.noreply.github.com> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
squid-protocol
added a commit
that referenced
this pull request
Aug 14, 2026
* fix(python): args regex only balanced one level of nested parens #1527: python's args rule's parameter-list capture group \((?:[^()]|\([^()]*\))*\) balances exactly one level of nested parens (outer paren + one inner non-nested group). A default value with two levels of nested calls -- FastAPI's dependency-injection idiom Depends(partial(callable_gen_dependency, "x")) -- doesn't match at all, so the whole def statement is skipped and args silently defaults to 0. Extends the existing bounded-recursion idiom by one more level (still no unbounded backtracking -- same ReDoS-safety tradeoff already established for this rule, just deeper). Confirmed 12 occurrences of this exact shape in language-crucible/data/python/fastapi/tests/test_dependency_partial.py. args_exact_match: 3588 -> 3601 (python corpus), no other metric changed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * chore: regenerate baselines against post-dart/tcl/bless main Rebased this branch onto the current main (after #1538/#1539/#1545 merged) and regenerated the target's own tree-sitter baseline, both golden masters, and the ruff line-shift baseline against the combined state. No additional code change beyond the previous commit. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Joe Esquibel <squid-protocol@users.noreply.github.com> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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.
Fixes #1512.
Summary
Tcl's default-value parameter syntax,
{paramName defaultValue}as a single braced pair inside the outer argument-list braces (e.g.proc faultsim_integrity_check {{db db}} { ... }), was measured as 2 parameters instead of 1. Root cause:detector.py's_calculate_block_metricsfell through to a naive whitespace.split()for any comma-free args string, splitting{db db}into two tokens instead of recognizing the braced pair as one Tcl-list unit.Fix: new depth-aware
_count_tcl_arg_listwalk (mirrors the existing haskell pattern-list counter precedent from #1505) -- a{...}span at depth 0 counts as one parameter, bare tokens count as one each. Pure Python string-walking, no regex/ReDoS surface change.Numbers
language-crucible/data/tcl/sqlite/tester.tcland others:args_exact_match119/142 -> 142/142 (100%).found_functions/extra_functionsunchanged (no side effects).Test plan
pytest tests/extraction/languages/test_tcl.py tests/extraction/languages/test_tcl_strict.py-- 107 passedtree_sitter_accuracy_audit.py --lang tcl-- no regressions, all mismatch samples now emptyruff check-- no new findings on touched code🤖 Generated with Claude Code