Skip to content

Conversation

@kinyoklion
Copy link
Member

Updates ldclient:new_multi_from to support merging single and multi-kind contexts into a single multi-kind context.

Fixes: #126

@kinyoklion kinyoklion force-pushed the rlamb/sdk-244385/multi-context-merging branch from 0ee2c24 to 5f7479c Compare February 2, 2026 23:33
@kinyoklion kinyoklion marked this pull request as ready for review February 2, 2026 23:50
@kinyoklion kinyoklion requested a review from a team as a code owner February 2, 2026 23:50
case maps:size(MultiContext) of
2 ->
%% One kind plus 'kind' key - convert back to single context.
[SingleKind] = get_kinds(MultiContext),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
  kind => <<"multi">>,
  <<"user">> => #{}
}
{
  kind => <<"multi">>,
  <<"user">> => #{},
  <<"organization">> => #{}
}

2 ->
%% One kind plus 'kind' key - convert back to single context.
[SingleKind] = get_kinds(MultiContext),
#{SingleKind := ContextPart} = MultiContext,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[<<"user">>]
SingleKind = <<"user">>

#{SingleKind := ContextPart} = MultiContext

#{<<"user">> := ContextPart} = #{ <<"user">> => #{}}

JS
ContextPart = MultiContext["user"];
ContextPart["kind"] = "multi"

@kinyoklion kinyoklion merged commit 7c9f934 into main Feb 9, 2026
6 checks passed
@kinyoklion kinyoklion deleted the rlamb/sdk-244385/multi-context-merging branch February 9, 2026 20:53
kinyoklion pushed a commit that referenced this pull request Feb 9, 2026
🤖 I have created a release *beep* *boop*
---


##
[3.9.0](v3.8.1...v3.9.0)
(2026-02-09)


### Features

* Support combining multi-contexts using ldcontext:new_multi_from.
([#167](#167))
([7c9f934](7c9f934)),
closes
[#126](#126)


### Bug Fixes

* Fix an issue where &lt;<kind&gt;> would be included in the list of
context kinds when kind was binary.
([#168](#168))
([8cdee5c](8cdee5c))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

Support merging an ld_context and an ld_multi_context

2 participants