fix(dart): long-param constructors not found + assert() false-positive func_start - #1538
Merged
Merged
Conversation
…e func_start #1493: _slice_by_braces's dart terminator-scan search_limit was pinned to start_idx+2000, but the scan starts at params_end_idx -- for constructors with parameter lists themselves exceeding ~1800 chars (e.g. ThemeData.raw's ~140-line constructor), params_end_idx landed past the limit, leaving zero room to find the real terminator and rejecting the whole match. Fix anchors the extra room to params_end_idx instead, but only when it would exceed the original bound (max(search_limit, params_end_idx+200)) -- preserves identical behavior for every normal function and only widens for the pathological case, avoiding a file-wide loosening that independently proved to reach spurious terminators elsewhere. Also fixes a related false-positive found during verification: `assert` was missing from func_start's reserved-keyword exclusion, so `assert(...);` could be misdetected as a function definition -- already a widespread, pre-existing false positive in flutter's corpus (hundreds of instances), not something this PR's search_limit change introduced, just newly reachable once the window widened enough for assert's own terminator hunt to succeed. Net effect on the 7-file flutter/dart corpus: found_functions 1096->1100, extra_functions 571->426 (a 25% precision improvement, mostly from the assert fix). 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 #1493.
Summary
_slice_by_braces's dart-specific terminator-scan window was pinned tostart_idx + 2000, but the scan itself starts atparams_end_idx-- for constructors whose parameter list alone exceeds ~1800 chars (e.g.flutter/theme_data.dart'sconst ThemeData.raw({...}), ~140 lines / hundreds ofrequired this.xxx,entries),params_end_idxlanded past the window, leaving no room to find the real terminator and silently rejecting the whole match.dart_search_limit = min(next_match_start, max(search_limit, params_end_idx + 200))-- anchors extra room toparams_end_idxonly when needed, so every normal function keeps byte-identical behavior and only the pathological long-param case widens. (A flatparams_end_idx + 2000was tried first and empirically found to reach spurious terminators in unrelated code across other files -- see commit history in this branch.)assertwas missing from func_start's reserved-keyword exclusion lookahead, soassert(...);could be misdetected as a function definition namedassert. This was already a widespread, pre-existing false positive in the flutter corpus (hundreds of instances across framework.dart/navigator.dart/object.dart/semantics.dart) -- not introduced by this PR, just newly reachable once the search window widened enough forassert's own terminator scan to succeed instead of timing out.Numbers (7-file flutter/dart corpus, live audit)
found_functions: 1096 -> 1100extra_functions: 571 -> 426 (25% precision improvement, mostly from theassertfix)ThemeData.rawand the unnamedfactory ThemeData(...)constructor: now found.Test plan
pytest tests/extraction/languages/test_dart.py tests/extraction/languages/test_dart_strict.py-- 186 passedtree_sitter_accuracy_audit.py --all --ci-- clean across all 31 languages (shared-helper ripple check)crucible_check.py --mode both-- PASS/PASS after blessing expected drift (theme_data.dart's function count changed materially)audit_check.py --ci-- all clearassert(...)non-matches🤖 Generated with Claude Code