fix: correct inverted segment condition logic in docs - #9
Merged
Conversation
The API composes segment conditions as `(A OR B) AND (C OR D)` — conditions
within a group are OR-ed, and groups are AND-ed together. The docs here stated
the exact inverse.
Verified against the server implementation, SegmentService::buildSegmentWhere:
conditions are joined with `implode(' OR ', ...)` inside each group, and the
resulting group clauses with `implode(' AND ', ...)`. The API reference and the
product docs both agree.
Comments only — no behaviour change. The same inversion was present in five
SDKs, which suggests a shared source; each is being corrected separately.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Patch release carrying the segment condition Javadoc fix. The Javadoc jar is built per Maven release, so the corrected AND/OR only reaches users once 1.5.1 is on Maven Central. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
What
The doc comments on the segment condition types state the boolean composition backwards.
The real shape is
(A OR B) AND (C OR D).Why it matters
A developer targeting "plan = pro OR orders > 10" naturally reaches for two groups after reading this — and silently gets an intersection instead of a union. The campaign then goes to the wrong audience, with no error anywhere.
Verification
Confirmed against the server implementation —
SegmentService::buildSegmentWhere:The OpenAPI spec (
SegmentConditionGroup) and the product docs (learn/audience/segments) both already describe it correctly.Scope
Comments/docstrings only — no behaviour change.
The identical inversion exists in five SDKs (PHP, Python, Go, Rust, Java), which points at a shared origin worth tracking down so it doesn't regenerate. Each SDK gets its own PR;
lettr-nodehas no comment on these types at all and may be worth adding one.🤖 Generated with Claude Code