Skip to content

fix regex remove duplicates - #4087

Merged
hackwaly merged 2 commits into
mainfrom
yuxiang/fix-regex-remove-duplicates
Aug 17, 2026
Merged

fix regex remove duplicates#4087
hackwaly merged 2 commits into
mainfrom
yuxiang/fix-regex-remove-duplicates

Conversation

@hackwaly

Copy link
Copy Markdown
Contributor

Closes #4074

The previous implementation re-create seen every iteration, which is wrong behavior.

Copilot AI lite review requested due to automatic review settings August 17, 2026 03:19
@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 6128

Coverage decreased (-0.005%) to 90.715%

Details

  • Coverage decreased (-0.005%) from the base build.
  • Patch coverage: 2 of 2 lines across 1 file are fully covered (100%).
  • 1 coverage regression across 1 file.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
string/internal/regex_engine/execute.mbt 1 92.0%

Coverage Stats

Coverage Status
Relevant Lines: 17706
Covered Lines: 16062
Line Coverage: 90.72%
Coverage Strength: 324026.95 hits per line

💛 - Coveralls

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses regex execution blowups caused by inadequate thread deduplication in variable-length repetition bodies (as described in #4074), preventing exponential growth in the thread set and related OOM behavior.

Changes:

  • Add a regression test that exercises variable-length repetition patterns over a long subject and ensures matching remains feasible.
  • Fix ThreadSet::remove_duplicates to share a single seen set across nested Seq thread trees, enabling global deduplication across wrapper boundaries.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
string/regex_test.mbt Adds a regression test covering variable-length repetition cases that previously led to exponential thread growth/OOM.
internal/regex_engine/automata/thread_set.mbt Updates duplicate-thread elimination to reuse a single seen set across nested thread trees, preventing exponential growth.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@hackwaly
hackwaly enabled auto-merge (squash) August 17, 2026 03:26
@hackwaly
hackwaly merged commit 400d497 into main Aug 17, 2026
20 checks passed
@hackwaly
hackwaly deleted the yuxiang/fix-regex-remove-duplicates branch August 17, 2026 03:36
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.

string: Regex thread set grows exponentially when a repetition body has variable length (OOM at 31 characters)

3 participants