Skip to content

Fix edge cases in language optimizer regexes#42

Merged
Daliys merged 1 commit into
mainfrom
fix-regex-edge-cases-6582744517876628760
Jun 4, 2026
Merged

Fix edge cases in language optimizer regexes#42
Daliys merged 1 commit into
mainfrom
fix-regex-edge-cases-6582744517876628760

Conversation

@Daliys

@Daliys Daliys commented Jun 3, 2026

Copy link
Copy Markdown
Member

Fix edge cases in language optimizer regexes for nested JSON, closures, and chained shell commands


PR created automatically by Jules for task 6582744517876628760 started by @Daliys

…s, and chained shell commands

This commit updates `_span_patterns()` in `soma_language_optimizer_core.py`:
- Expands the `{...}` regex to match up to 4 levels of depth, which correctly protects deeply nested JSON structures and multiline Swift closures.
- Modifies the inline shell command regex to permit up to 40 arguments (up from 8), allowing long chained commands with operators.
- Fixes shell argument parsing to exclude backticks and prevent swallowing trailing punctuation, accurately protecting paths like `.txt` without matching trailing periods/commas in natural text.
- Reorders the pattern list to evaluate the structural `{}` bracket regex *before* the internal camelCase identifier regex, preventing internal camelCase keys from causing overlap skips and truncating the outer code block.
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@Daliys Daliys merged commit d42ee1f into main Jun 4, 2026
2 checks passed
@Daliys Daliys deleted the fix-regex-edge-cases-6582744517876628760 branch June 4, 2026 07:52
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