Repository navigation
Conversation
In a multi-kind context the top-level attribute name decides each context's kind. A nested "kind" attribute fell through to the catch-all LDContextBuilder::set(), which treats "kind" as the context kind and replaced it. Two nested contexts could then end up with the same kind, making the whole multi-kind context invalid with nothing logged. Skip "kind" alongside "key" and "targetingKey" when copying attributes, matching the Python provider. Single contexts are unaffected, since the kind passed to the builder already comes from the same attribute.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Member
|
Hello @zigzagdev, Thank you for the contribution! We are adding a couple tests, and we will get this change propagated to other provider as well. Thank you, |
kinyoklion
added a commit
to launchdarkly/openfeature-java-server
that referenced
this pull request
Nov 18, 2026
**Requirements** - [x] I have added test coverage for new or changed functionality - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [x] I have validated my changes against all supported platform versions **Related issues** Same fix as launchdarkly/openfeature-php-server#39; the Python provider already behaves this way. **Describe the solution you've provided** In a multi-kind evaluation context, the sub-context's kind comes from its top-level attribute name (OFP Req 2.2.1 / 2.4.1). `EvaluationContextConverter` skipped only `key`/`targetingKey` when copying a sub-context's attributes, so a nested `kind` (e.g. `org: { kind: "user", key: ... }`) overwrote the sub-context's kind and could produce an invalid context. The converter now also skips `kind` there. Tests cover a nested `kind` equal to another kind (`"user"`), `kind: "multi"`, and a non-string `kind` (`42`). Each one checks that the result is a valid two-kind context, that the `org` sub-context keeps kind `org`, and that `kind` is not a custom attribute. The existing single-context kind tests pass unchanged. **Describe alternatives you've considered** Logging a warning for a nested `kind`. Not done, to match the PHP and Python providers. **Additional context** `./gradlew build` and `jacocoTestReport` pass locally (66 tests). <!-- devin-bot-banner-begin --> --- <p><picture><source srcset="https://app.devin.ai/api/presigned_proxy?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjpudWxsLCJidWNrZXRfbmFtZSI6ImRldmluYXR0YWNobWVudHMiLCJidWNrZXRfa2V5IjoiYXR0YWNobWVudHNfcHJpdmF0ZS9vcmdfaGVBMWRpc2owVHVLd2VVSy83NTFkNTYyOC03NDkzLTRkMGItODdlZi05NjJlYzQ0MmYyYzkiLCJpYXQiOjE3OTQ5OTUwODUsIm9yZ19pZCI6Im9yZ19oZUExZGlzajBUdUt3ZVVLIiwiZmlsZW5hbWUiOiJib3QtYmFubmVyLnBuZyJ9.Zd1pKxyFYPQrECgilM1NaCBRegVltTL2BZehKDn1lqI"><img height="63" alt="" align="left"></picture><strong><a href="https://app.devin.ai/bots/649040a7a000452fbe03eca40165f725">OpenFeature Maintainer</a> opened this PR for Ryan</strong><br> Implemented in session <a href="https://app.devin.ai/sessions/969bed84d8c94be39e7934812e681471">Ignore nested kind in Java multi-context conversion</a><br> <a href="https://app.devin.ai/review/launchdarkly/openfeature-java-server/pull/72">Review with Devin</a> · <a href="https://app.devin.ai/desktop/session/969bed84d8c94be39e7934812e681471?variant=devin">Open in Devin Desktop</a></p> <br clear="left"> <!-- devin-bot-banner-end --> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > Fixes **multi-kind** OpenFeature → LaunchDarkly conversion when a sub-context (e.g. `org`) incorrectly includes a nested **`kind`** attribute alongside `key`. > > `EvaluationContextConverter.BuildSingleContext` already ignored `key` and `targetingKey` when copying attributes; it now **also skips `kind`**, since sub-context kind is defined by the **top-level attribute name** in a `kind: multi` context. That prevents a nested `kind` (wrong string, `"multi"`, or non-string) from corrupting the built `LDContext` or landing in custom attributes. > > A new test **`itIgnoresNestedKindInMultiKindContexts`** checks string and non-string nested `kind` values and asserts a valid two-kind result with `org` staying kind `org` and no `kind` custom attribute, with no error logs. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 0a428fe. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
kinyoklion
added a commit
to launchdarkly/openfeature-dotnet-server
that referenced
this pull request
Nov 18, 2026
**Requirements** - [x] I have added test coverage for new or changed functionality - [x] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions (net6.0/net8.0 tests run on Linux; net471 compiled only) **Related issues** OFP Req 2.2.1 and 2.4.1 (`sdk-specs`): in a multi-kind context the top-level attribute name is the kind, and `kind` must not be copied as an attribute. Matches the Python provider and launchdarkly/openfeature-php-server#39. **Describe the solution you've provided** `EvalContextConverter.ProcessValue` skipped only `key`/`targetingKey`, so a nested `kind` inside a sub-context structure overwrote that sub-context's kind (e.g. `user: { kind: "org" }` next to `org: {...}`, or `kind: "multi"`), producing an invalid context. It now also skips `kind`; kind is determined outside attribute conversion, so single-kind contexts with a top-level `kind` are unchanged. The nested value is ignored silently, as in PHP. Tests cover nested `kind` equal to another kind, `"multi"`, a number, empty string and null (kinds/keys preserved, context valid, `kind` absent from custom attributes, no log output), plus a single-context `kind: "org"` regression. The collision and `"multi"` cases fail without the fix. **Describe alternatives you've considered** Logging a warning for the ignored nested `kind`; not done to match the PHP and Python behavior. **Additional context** None. <!-- devin-bot-banner-begin --> --- <p><picture><source srcset="https://app.devin.ai/api/presigned_proxy?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjpudWxsLCJidWNrZXRfbmFtZSI6ImRldmluYXR0YWNobWVudHMiLCJidWNrZXRfa2V5IjoiYXR0YWNobWVudHNfcHJpdmF0ZS9vcmdfaGVBMWRpc2owVHVLd2VVSy8yYzEwNjhiOS0xZTQ0LTRhYzEtODUzZS0xNTc3Y2QyNTNmNzYiLCJpYXQiOjE3OTQ5OTUwMDEsIm9yZ19pZCI6Im9yZ19oZUExZGlzajBUdUt3ZVVLIiwiZmlsZW5hbWUiOiJib3QtYmFubmVyLnBuZyJ9.L9phxaOOCtDujoEJ1AdY3YiURUZ0SFOOB7C4BIblSCY"><img height="63" alt="" align="left"></picture><strong><a href="https://app.devin.ai/bots/649040a7a000452fbe03eca40165f725">OpenFeature Maintainer</a> opened this PR for Ryan</strong><br> Implemented in session <a href="https://app.devin.ai/sessions/ef86cba726a147a0805937efbf276e79">Ignore nested kind in .NET multi-context conversion</a><br> <a href="https://app.devin.ai/review/launchdarkly/openfeature-dotnet-server/pull/84">Review with Devin</a> · <a href="https://app.devin.ai/desktop/session/ef86cba726a147a0805937efbf276e79?variant=devin">Open in Devin Desktop</a></p> <br clear="left"> <!-- devin-bot-banner-end --> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > Fixes **multi-kind** OpenFeature → LaunchDarkly context conversion when a sub-context structure includes a **`kind`** field (e.g. `user: { kind: "org", ... }`). That value is no longer passed through attribute mapping; **`kind`** is skipped in `ProcessValue` like **`key`** / **`targetingKey`**, so each sub-context keeps the kind implied by its top-level key and stays valid per OFP spec. > > Adds tests for nested `kind` values (another kind, `"multi"`, non-strings, empty, null)—contexts remain valid, **`kind`** is not a custom attribute, and nothing is logged—and a regression test that a top-level **`kind`** still sets the single-context kind. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 81e2af6. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
Thank you for the reviewing and for taking care of the other providers!
Ok. |
This branch has not been deployed
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.
Requirements
Related issues
N/A
Describe the solution you've provided
In a multi-kind context, the top-level attribute name decides each context's kind.
However,
buildSingleContextdoes not skip a nestedkindattribute, so it falls through toLDContextBuilder::set(), which overwrites the context kind.In this example, both contexts become
user. The multi-kind context is then invalid, and nothing is logged.This PR skips
kindalongsidekeyandtargetingKey.This matches the behaviour of the Python provider.
Single contexts are unaffected.
As a result, a nested
kindno longer overrides the top-level name. For example,'org' => ['kind' => 'device']now producesorginstead ofdevice.Describe alternatives you've considered
Logging a warning when a nested
kinddiffers from the top-level name. Happy to add this if you'd prefer.Note
Overview
Fixes multi-kind OpenFeature → LaunchDarkly conversion when nested contexts include a
kindfield. InbuildSingleContext,kindis now skipped during attribute iteration (withkeyandtargetingKey) so it is not applied via the genericset()path, which would override the kind derived from the multi-context key name.Adds regression tests for nested string,
multi, and non-stringkindvalues, plus a single-context case ensuringkindsets the context type without becoming a custom attribute.Reviewed by Cursor Bugbot for commit dfe37aa. Bugbot is set up for automated code reviews on this repo. Configure here.