Skip to content

Groovy: fix return-type/control-flow/nested-paren bugs in args regex - #1026

Closed
squid-protocol wants to merge 1 commit into
mainfrom
recovered-groovy-regex-fixes
Closed

squid-protocol wants to merge 1 commit into
mainfrom
recovered-groovy-regex-fixes

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Recovered from an abandoned background-agent worktree -- never committed at the time. Three real bugs in the "args" pattern:

  • Lowercase primitive return types (void foo(), int add()) never matched since the return-type stepper required an uppercase first char. Added a primitive-keyword alternative alongside the existing capitalized-type branch, and allowed , so multi-param generic return types (Map<String, Integer> foo()) don't break after the first type param.
  • The flat [^)]* param-list matcher truncated at the first inner ), breaking on one-level-nested calls in default values (int y = Math.max(3, 4)). Swapped for a bounded one-level-nesting form.
  • No exclusion for control-flow keywords, so if (x) {, while (x) {, switch (x) {, for (i in ...) {, catch (Exception e) {, and synchronized(lock) { were all misread as method parameter blocks. Added the same negative-lookahead style func_start already uses.

Not yet verified against the golden-master corpus or opened as a PR -- needs the usual crucible_check.py pass before merging.

Description of Structural Changes

Visual Observatory Testing

  • I tested the output JSON on GitGalaxy.io OR the Airgap Observatory.
  • Flexbox constraints, HUD elements, and 3D rendering remain intact.

The Differential Scan Acknowledgement

  • I understand that my PR will be subjected to a Full Differential Scan.
  • I have provided the link to the specific repository this PR addresses so it can be tested alongside the 80-repo calibrated baseline.
  • I believe these changes will measurably improve the engine's Accuracy, Speed, Utility, or Ethos without causing regressions.

Recovered from an abandoned background-agent worktree -- never committed
at the time. Three real bugs in the "args" pattern:

- Lowercase primitive return types (void foo(), int add()) never matched
  since the return-type stepper required an uppercase first char. Added
  a primitive-keyword alternative alongside the existing capitalized-type
  branch, and allowed `,` so multi-param generic return types
  (Map<String, Integer> foo()) don't break after the first type param.
- The flat [^)]* param-list matcher truncated at the first inner `)`,
  breaking on one-level-nested calls in default values
  (int y = Math.max(3, 4)). Swapped for a bounded one-level-nesting form.
- No exclusion for control-flow keywords, so if (x) {, while (x) {,
  switch (x) {, for (i in ...) {, catch (Exception e) {, and
  synchronized(lock) { were all misread as method parameter blocks.
  Added the same negative-lookahead style func_start already uses.

Not yet verified against the golden-master corpus or opened as a PR --
needs the usual crucible_check.py pass before merging.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@squid-protocol

Copy link
Copy Markdown
Owner Author

Verified against current main — all three bugs described here are already fixed. They were fixed and merged in PR #712 (2026-07-28, closing #584 as part of epic #518), which predates this issue's creation (2026-08-04):

  • Lowercase primitive return types (void foo(), int add()): fixed via the primitive-keyword alternative in the return-type stepper (gitgalaxy/standards/language_standards.py args regex, ~L12204), plus , added to the identifier class for multi-param generics.
  • One-level-nested parens in default values (Math.max(3, 4)): fixed via the bounded (?:[^()]|\([^()]*\))* nesting form.
  • Control-flow keywords misread as param lists (if, while, switch, for, catch, synchronized): fixed via the negative lookahead (?!(?:if|for|while|switch|catch|synchronized)\b).

Confirmed with a local run: all 144 tests in tests/extraction/languages/test_groovy_strict.py + test_groovy.py pass, including dedicated regression tests for each of these three bug classes (e.g. test_groovy_strict.py:259, :285, :345).

This issue was recovered from an abandoned background-agent worktree that apparently never synced with the epic #518 work landing on main. Closing as already fixed / duplicate of #584.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant