Skip to content

chore: Fix segment key in FileData example (includes → included)#406

Merged
jsonbailey merged 1 commit into
launchdarkly:mainfrom
dyozie-ld:docs/fix-filedata-segment-included-key
Jul 10, 2026
Merged

chore: Fix segment key in FileData example (includes → included)#406
jsonbailey merged 1 commit into
launchdarkly:mainfrom
dyozie-ld:docs/fix-filedata-segment-included-key

Conversation

@dyozie-ld

@dyozie-ld dyozie-ld commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

What

Fixes a functional error in the FileData docstring example. The segments object uses "includes" for the list of context keys:

"segments": {
  "segment-key-1": {
    "key": "segment-key-1",
    "includes": [ "user-key-1" ]
  }
}

Why

The segment model (LaunchDarkly::Impl::Model::Segment) deserializes included / excluded, never includes:

@included = data[:included] || []
@excluded = data[:excluded] || []

An unknown "includes" key is silently dropped and included defaults to an empty array, so a context listed under includes is never actually added to the segment. The example doesn't work as written.

Change

"includes""included" in the FileData docstring (lib/ldclient-rb/integrations/file_data.rb). Docstring-only; no code behavior change.

Note

The same example is shared across LaunchDarkly's SDK docs; a companion fix to the canonical snippet source is in launchdarkly/sdk-meta#541.

🤖 Generated with Claude Code


Note

Low Risk
Documentation-only change in a comment example; no production code paths are modified.

Overview
Corrects the FileData integration docstring JSON example so segment membership uses "included" instead of "includes".

That matches how LaunchDarkly::Impl::Model::Segment reads segment data (data[:included]); copying the old example would leave included empty and segment targeting would not work as documented. Docstring-only—no runtime behavior change.

Reviewed by Cursor Bugbot for commit bf1ab30. Bugbot is set up for automated code reviews on this repo. Configure here.

The FileData docstring example used "includes" for the segment's list of
context keys, but the segment model deserializes "included" (and
"excluded"). A key under "includes" is silently ignored, so the context
is never actually added to the segment. Correct the example so it works
as written.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dyozie-ld dyozie-ld requested a review from a team as a code owner July 10, 2026 15:06
@jsonbailey jsonbailey changed the title docs: fix segment key in FileData example (includes → included) chore: Fix segment key in FileData example (includes → included) Jul 10, 2026
@jsonbailey jsonbailey merged commit d29622f into launchdarkly:main Jul 10, 2026
13 checks passed
@jsonbailey

Copy link
Copy Markdown
Contributor

Thanks @dyozie-ld

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.

2 participants