Skip to content

fix(Segments): Standardise regex matching in the Java server-side SDK - #245

Open
linear-code[bot] wants to merge 1 commit into
mainfrom
linear/sdk-25-standardise-regex-matching-in-the-java-server-side-sdk-6166
Open

linear-code[bot] wants to merge 1 commit into
mainfrom
linear/sdk-25-standardise-regex-matching-in-the-java-server-side-sdk-6166

Conversation

@linear-code

@linear-code linear-code Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Local evaluation matched Matches regex segment conditions anywhere in a trait value. Per the Flagsmith docs, patterns must match from the start of the value without having to cover all of it. So prod should match production but not nonproduction. Identities could previously land in segments they don't belong to under local evaluation. The engine now uses Matcher.lookingAt() in place of find(). matches() would have wrongly required a full-string match.

Changes

  • Regex segment conditions match only from the start of the trait value, for every alternative (prod|dev matches development but not nondev).
  • Patterns that use ^…$ still require a full-value match. Matching stays case-sensitive, and invalid patterns still never match.
  • Regression cases taken from the docs' examples.

Closes SDK-25

Review effort: 1/5

Match regex segment conditions from the start of the trait value without
requiring a full-string match, per the Flagsmith documentation.

Generated with [Linear](https://linear.app/flagsmith/agent-session/558e4f47-74c1-4a67-950a-c3bb7765c695)

Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
@linear-code
linear-code Bot requested a review from a team as a code owner November 3, 2026 15:46
@linear-code
linear-code Bot requested review from emyller and removed request for a team November 3, 2026 15:46
@linear-code

linear-code Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

SDK-25

@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: dd15e9d7-c140-4613-936f-80c4cc811de7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@linear-code

linear-code Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@codspeed

codspeed Bot commented Nov 3, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 15 untouched benchmarks


Comparing linear/sdk-25-standardise-regex-matching-in-the-java-server-side-sdk-6166 (a339909) with main (82ea4c5)

Open in CodSpeed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants