Skip to content
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

fix: discarding invalid numbers sent as part of RudderTraits, RudderProperty, RudderOptions #145

Closed
wants to merge 3 commits into from

Conversation

desusai7
Copy link
Contributor

fix: discarding invalid numbers sent as part of RudderTraits, RudderProperty, RudderOptions

Stopped accepting invalid numbers like double.nan, double.infinity, double.negativeInfinity, double.maxFinite, double.minPositive when passed to RudderProperty, RudderTraits, RudderOptions object as it is leading to crashes when serializing them on Android, iOS SDKs.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklists

Development

  • Lint rules pass locally
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
  • "Ready for review" label attached to the PR and reviewers mentioned in a comment
  • Changes have been reviewed by at least one other engineer
  • Issue from task tracker has a link to this pull request

@desusai7 desusai7 self-assigned this Dec 19, 2023
Copy link

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@desusai7 desusai7 marked this pull request as ready for review December 19, 2023 15:17
@bardisg
Copy link
Contributor

bardisg commented Dec 19, 2023

@desusai7 I am not convinced this is the correct approach.
Infinity is a valid number and my opinion is that it should be send correctly to Android and iOS SDKs as their respective platforms support it.

Seems like the Obj-C library for serializatin does not support them tough https://developer.apple.com/documentation/foundation/jsonserialization#overview

Also NaN probably needs to be handled in the native SDKs directly not the hybrid SDK wrappers.

@pallabmaiti & @ChryssaAliferi whats your take on this one?

@desusai7
Copy link
Contributor Author

@desusai7 I am not convinced this is the correct approach. Infinity is a valid number and my opinion is that it should be send correctly to Android and iOS SDKs as their respective platforms support it.

Seems like the Obj-C library for serializatin does not support them tough https://developer.apple.com/documentation/foundation/jsonserialization#overview

Also NaN probably needs to be handled in the native SDKs directly not the hybrid SDK wrappers.

@pallabmaiti & @ChryssaAliferi whats your take on this one?

Values Nan, Infinity & negativeInfinity are not being supported for serialisation by default in iOS & Android. However, Android has a workaround where we must use a different method to support the serialization of special floating point values.

Closing this PR for now as we've decided to tackle this issue in native Android and iOS SDKs

@desusai7 desusai7 closed this Dec 20, 2023
@github-actions github-actions bot deleted the fix/sdk-1003-invalid-numbers branch February 20, 2024 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants