Repository navigation
Strict tests for groovy, fix 11 real bugs (2 ReDoS) - #712
Merged
Merged
Conversation
Closes #584. Part of epic #518. Found and fixed 11 real bugs in groovy's structural signatures: - dead_code: only fired on `//`, never `/* */` (Rule 12 gap). - state_mutation: bare trailing `=` matched the first `=` of `==`, miscounting equality checks as assignments. - func_start/args: return-type stepper required an uppercase first char, so lowercase primitive/void return types (`void foo()`, `int add()`) never matched at all; also excluded `,`, breaking multi-param generic return types (`Map<String, Integer> foo()`). - args/decorators/generics: flat negated-class delimiters truncated on one-level nesting (`Math.max(3,4)` default value, `@Grab(..., version=resolve())`, `Map<String,List<Id>>`) -- bounded one-level-nesting forms per Rule 11. - dependency_injection: `plugins {`/`dependencies {` ended on `{` inside a shared trailing \b, which can never fire on a non-word char -- Gradle's two most common DSL entry points never matched. - closures/comprehensions: required `->`/`(` respectively, so Groovy's dominant paren-less trailing-closure idiom (`list.each { it }`) never matched either signature. - func_start/args: `synchronized(lock) { ... }` was hallucinated as a method declaration/parameter block; `args` had no control-flow exclusion at all, also hallucinating `if`/`while`/`switch`/`for`/`catch` blocks as parameter lists. - _dependency_capture was entirely absent for groovy (unlike every other JVM-family language) -- Groovy imports never fed the dependency graph. Added it. - ReDoS: closures' `[\w\s,]+` overlapping a trailing `\s*` caused a confirmed hang (>5s) at n=2000 on an unclosed `{` -- collapsed into one bounded, non-overlapping class. - ReDoS: spec_exposure's `\d+`/`[^\]]*` overlap showed confirmed ~4x-per- doubling quadratic scaling -- bounded to `{0,300}`. Adds 67 new tests (43 parametrized _GROOVY_SIMPLE_CASES + 24 dedicated regression/ambiguity/ReDoS tests). Cross-language finding, NOT fixed here (filed separately): the spec_exposure quadratic-blowup pattern fixed above is copy-pasted identically across 28 languages in language_standards.py, including several already-closed epic languages (yacc among them) -- confirmed via direct ReDoS timing on 3 samples (~4x per doubling, consistent). Needs its own dedicated sweep. Golden crucible: zero diff, confirmed legitimate -- the crucible corpus contains zero real .groovy/.gvy/.gy/.gsh/.gradle/Jenkinsfile files anywhere (the data/groovy/ directory group holds only .java sources from Spock/Gradle's own implementation). Co-authored-by: Joe Esquibel <squid-protocol@users.noreply.github.com> Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
5 tasks
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.
Closes #584. Part of epic #518.
Summary
Found and fixed 11 real bugs:
dead_codemissing/* */,state_mutationmiscounting==as=,func_start/argsnever matching lowercase/void return types or multi-param generics, nested-delimiter truncation inargs/decorators/generics,dependency_injection's Gradle DSL entry points never matching (trailing\bafter{),closures/comprehensionsmissing Groovy's dominant paren-less trailing-closure idiom,synchronizedblocks hallucinated as methods, a missing_dependency_capture, and 2 confirmed ReDoS findings (closures, spec_exposure).Cross-language finding, not fixed here: the
spec_exposureReDoS pattern is copy-pasted across 28 languages, including already-closedyacc. Confirmed via direct timing (~4x/doubling, consistent across samples). Filing a dedicated sweep issue separately.Test plan
ruff_audit.py/mypy_audit.py/dead_key_audit.py --ci— no new findingsfind-verified zero real groovy files anywhere in the corpus)Co-authored-by: Claude Sonnet 5 noreply@anthropic.com