Skip to content

fix: correct inverted segment condition logic in docs - #9

Merged
voj-tech-j merged 2 commits into
mainfrom
fix/segment-condition-logic-docs
Aug 15, 2026
Merged

fix: correct inverted segment condition logic in docs#9
voj-tech-j merged 2 commits into
mainfrom
fix/segment-condition-logic-docs

Conversation

@voj-tech-j

Copy link
Copy Markdown
Contributor

What

The doc comments on the segment condition types state the boolean composition backwards.

Docs said Actually
Within a group AND OR
Between groups OR AND

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:

$groupClauses[] = '('.implode(' OR ', $conditionClauses).')';  // within group → OR
...
'where' => implode(' AND ', $groupClauses),                     // between groups → AND

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-node has no comment on these types at all and may be worth adding one.

🤖 Generated with Claude Code

voj-tech-j and others added 2 commits August 15, 2026 12:14
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>
@voj-tech-j
voj-tech-j merged commit d3cd40f into main Aug 15, 2026
2 checks passed
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