-
Notifications
You must be signed in to change notification settings - Fork 86
Thread allocationKey into ResolutionDetails flagMetadata #3534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
gh-worker-dd-mergequeue-cf854d
merged 10 commits into
develop
from
typo/thread-allocation-key-to-resolution-details-metadata
Jun 12, 2026
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
515f8c4
Thread allocationKey into ResolutionDetails flagMetadata
typotter 50de9b0
Remove dead extractMetadata; add blank allocationKey edge-case test
typotter 3ca40b9
Explicit allocationKey skip in extraLogging; add conflict-case test
typotter cfa979d
Remove explicit allocationKey skip; shorten test names for detekt
typotter 535077e
Fix stale stubs, add null/whitespace edge-case tests for flagMetadata
typotter 78020e9
Surface allocationKey in OpenFeature ProviderEvaluation metadata
typotter 658837b
Add OpenFeature Builder methods to detekt safe calls whitelist
typotter 669747a
ci: re-trigger after detekt fix
typotter 3aafb4b
Fix nullable safe-call warning on non-null EvaluationMetadata
typotter b0593c8
Document Long→String fallback behavior with test
typotter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -135,6 +135,44 @@ internal class ConvertersTest { | |
| assertThat(result.reason).isEqualTo("ERROR") | ||
| } | ||
|
|
||
| @Test | ||
| fun `M surface allocationKey in metadata W toProviderEvaluation() {flagMetadata contains allocationKey}`( | ||
| @BoolForgery fakeValue: Boolean, | ||
| @StringForgery fakeAllocationKey: String | ||
| ) { | ||
| // Given | ||
| val resolution = ResolutionDetails( | ||
| value = fakeValue, | ||
| reason = ResolutionReason.TARGETING_MATCH, | ||
| flagMetadata = mapOf("allocationKey" to fakeAllocationKey) | ||
| ) | ||
|
|
||
| // When | ||
| val result = resolution.toProviderEvaluation() | ||
|
|
||
| // Then | ||
| assertThat(result.metadata.getString("allocationKey")).isEqualTo(fakeAllocationKey) | ||
| } | ||
|
|
||
| @Test | ||
| fun `M serialize Long to string W toProviderEvaluation() {flagMetadata contains Long value}`( | ||
| @BoolForgery fakeValue: Boolean | ||
| ) { | ||
| // Given — Builder has no putLong (only putInt/putDouble/putString/putBoolean); | ||
| // Long values fall through to the else branch and are stored as their toString() representation. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| val resolution = ResolutionDetails( | ||
| value = fakeValue, | ||
| reason = ResolutionReason.TARGETING_MATCH, | ||
| flagMetadata = mapOf("count" to 42L) | ||
| ) | ||
|
|
||
| // When | ||
| val result = resolution.toProviderEvaluation() | ||
|
|
||
| // Then — Long stored as string via putString fallback | ||
| assertThat(result.metadata.getString("count")).isEqualTo("42") | ||
| } | ||
|
|
||
| // endregion | ||
|
|
||
| // region toOpenFeatureErrorCode | ||
|
|
||
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: do we not need to worry about Long with builder.putLong? https://github.com/open-feature/kotlin-sdk/blob/cfe7ac44d92aef0366e4e6cb8bd01ce070ea06d7/kotlin-sdk/src/commonMain/kotlin/dev/openfeature/kotlin/sdk/FlagEvaluationMetadata.kt#L48