[FIX] [RUM-13466] iOS: fix AnyEncodable attribute decoding#1216
Merged
marco-saia-datadog merged 1 commit intodevelopfrom Mar 20, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes iOS attribute decoding by removing the module-local AnyEncodable implementation and standardizing on DatadogInternal.AnyEncodable, matching what the iOS SDK expects when decoding nested/dictionary-like attributes.
Changes:
- Import
DatadogInternalin the attribute-casting utilities and rely on itsAnyEncodableinstead of a local wrapper. - Update unit tests to cast nested attributes using
AnyEncodable(fromDatadogInternal). - Add
DatadogInternalimport inAnyEncodableTests.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
packages/core/ios/Sources/AnyEncodable.swift |
Switches to DatadogInternal.AnyEncodable and removes the local AnyEncodable type implementation. |
packages/core/ios/Tests/DdSdkTests.swift |
Updates nested extraInfo assertions to cast using AnyEncodable (expected SDK type). |
packages/core/ios/Tests/AnyEncodableTests.swift |
Imports DatadogInternal so tests compile against the SDK’s AnyEncodable. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9d02758 to
50f4c7b
Compare
cdn34dd
approved these changes
Mar 20, 2026
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.
What does this PR do?
On iOS, it replaces usages of the existing
AnyEncodableinternal definition with the importedAnyEncodablefromDatadogInternal.Motivation
When the IOS SDK decodes attributes before attaching them to the events, it expects dictionary-like objects to be of
AnyEncodable(DatadogInternal), while currently they are of typeDdSdkReactNative.AnyEncodable. This results in the final object to benil.In this specific case, it is blocking us from propagating the request and response headers from the JS layer down to the native event.
TODO: Regression Testing
setUserwith anextraInfocontaining nested objects and verify the data arrives correctly on the native eventsetAccountwith anextraInfocontaining nested objects and verify the data arrives correctly on the native eventaddAttribute/addAttributeswith a nested object value and verify it appears correctly on RUM eventsaddAttribute/addAttributeswith an array value and verify it appears correctly on RUM events{ a: { b: 1 } }is not flattened)Review checklist (to be filled by reviewers)