-
-
Notifications
You must be signed in to change notification settings - Fork 501
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
Migrate from to_hash to to_h #2351
Merged
Merged
Conversation
This file contains 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
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 6.0-dev #2351 +/- ##
========================================
Coverage 98.63% 98.63%
========================================
Files 204 204
Lines 13286 13286
========================================
+ Hits 13104 13105 +1
+ Misses 182 181 -1
|
Thanks for tackling this! I did not expect you'd address it so quickly ❤️ This is definitely a potentially breaking change, but luckily it's easily fixable in people's codebases. |
As @solnic pointed out in #2350 (comment) `to_hash` has special meaning in Ruby and could be called implicitly in contexts like double splatting argument. So we should switch to `to_h` to avoid potential issues.
@sl0thentr0py rebased 👍 |
sl0thentr0py
approved these changes
Jul 29, 2024
sl0thentr0py
pushed a commit
that referenced
this pull request
Oct 31, 2024
* Migrate from to_hash to to_h As @solnic pointed out in #2350 (comment) `to_hash` has special meaning in Ruby and could be called implicitly in contexts like double splatting argument. So we should switch to `to_h` to avoid potential issues.
Draft
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.
As @solnic pointed out in #2350 (comment)
to_hash
has special meaning in Ruby and could be called implicitly in contexts like double splatting argument. So we should switch toto_h
to avoid potential issues.Additionally, Matz also explained that in the explicit conversion usages (which is the case for the SDK),
to_h
should be used.Compatibility Concern
Since this PR changes the serialization interface of almost all SDK's internal components, if users/libs relied on patching
to_hash
to extend/modify the data, this could become a breaking change for them. And becauseto_hash
has been that interface since the oldsentry-raven
SDK (for at least 12 years), I think we can assume at least some legacy apps had built customization on top of it.For this reason, maybe this should be shipped in 6.0?
(In cases where
Configuration#async
is set, we useEvent#to_json_compatible
instead, so they won't be affected)