Skip to content

feat!: Return private attributes as a Set - #476

Open
keelerm84 wants to merge 2 commits into
feat/9.xfrom
mk/SDK-84/private-attribute-sets
Open

keelerm84 wants to merge 2 commits into
feat/9.xfrom
mk/SDK-84/private-attribute-sets

Conversation

@keelerm84

@keelerm84 keelerm84 commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Config#private_attributes now returns a Set of attribute reference
strings instead of an Array. The :private_attributes option still
accepts any Enumerable, and the SDK converts it to a Set.

LDContext#private_attributes now returns a frozen Set of Reference
objects instead of an Array. The context already stored a Set
internally and copied it to an Array on every call. Private attributes
have no meaningful order or duplicates, so a Set is the correct type.

Code that indexes into the result or calls Array-only methods on it
must change. LDContext#to_h and #to_json still emit privateAttributes
as an Array, so serialized contexts and event payloads do not change.


Note

Overview
Breaking change: Config#private_attributes and LDContext#private_attributes now expose Set values instead of Array. The :private_attributes config option still accepts any Enumerable, which the SDK normalizes into a set (deduping entries).

On LDContext, the internal set is frozen after construction, the accessor no longer copies to an array on each call, and equality checks use set comparison directly. ContextFilter stores global private refs in a set and merges them with per-context refs via set union (|) instead of array concatenation.

Wire format unchanged: LDContext#to_h / serialization still emit privateAttributes as an array (private_attributes.to_a). Callers that indexed into or relied on Array-only APIs on the getters must migrate to set-friendly usage.

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

Config#private_attributes now returns a Set of attribute reference
strings instead of an Array. The :private_attributes option still
accepts any Enumerable, and the SDK converts it to a Set.

LDContext#private_attributes now returns a frozen Set of Reference
objects instead of an Array. The context already stored a Set
internally and copied it to an Array on every call. Private attributes
have no meaningful order or duplicates, so a Set is the correct type.

Code that indexes into the result or calls Array-only methods on it
must change. LDContext#to_h and #to_json still emit privateAttributes
as an Array, so serialized contexts and event payloads do not change.
@keelerm84
keelerm84 marked this pull request as ready for review November 2, 2026 16:51
@keelerm84
keelerm84 requested a review from a team as a code owner November 2, 2026 16:51

This branch has not been deployed

No deployments
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