-
-
Notifications
You must be signed in to change notification settings - Fork 336
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
feat: add method unswizzling #4647
Conversation
🚨 Detected changes in high risk code 🚨High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:
|
|
🚨 Detected changes in high risk code 🚨High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4647 +/- ##
=============================================
+ Coverage 91.140% 91.232% +0.091%
=============================================
Files 621 622 +1
Lines 71497 71791 +294
Branches 25311 26147 +836
=============================================
+ Hits 65163 65497 +334
+ Misses 6239 6194 -45
- Partials 95 100 +5
... and 50 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
fcde045 | 1260.71 ms | 1275.00 ms | 14.29 ms |
b16d18c | 1245.60 ms | 1250.94 ms | 5.34 ms |
51ffd8c | 1194.60 ms | 1215.70 ms | 21.10 ms |
a9dece3 | 1224.96 ms | 1245.27 ms | 20.31 ms |
27f970b | 1223.48 ms | 1239.51 ms | 16.03 ms |
7bb0873 | 1226.18 ms | 1247.30 ms | 21.12 ms |
4bdf3dc | 1232.56 ms | 1252.81 ms | 20.25 ms |
8aba9c4 | 1236.94 ms | 1248.29 ms | 11.35 ms |
1734d1b | 1200.15 ms | 1214.06 ms | 13.92 ms |
e9fa2b0 | 1226.22 ms | 1248.47 ms | 22.24 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
fcde045 | 20.76 KiB | 435.26 KiB | 414.50 KiB |
b16d18c | 20.76 KiB | 437.12 KiB | 416.36 KiB |
51ffd8c | 21.58 KiB | 418.70 KiB | 397.11 KiB |
a9dece3 | 21.58 KiB | 546.20 KiB | 524.62 KiB |
27f970b | 21.58 KiB | 706.97 KiB | 685.39 KiB |
7bb0873 | 22.85 KiB | 407.09 KiB | 384.24 KiB |
4bdf3dc | 20.76 KiB | 434.94 KiB | 414.18 KiB |
8aba9c4 | 21.58 KiB | 544.72 KiB | 523.14 KiB |
1734d1b | 21.58 KiB | 418.82 KiB | 397.23 KiB |
e9fa2b0 | 21.58 KiB | 629.61 KiB | 608.03 KiB |
Previous results on branch: philprime/unswizzling
Startup times
Revision | Plain | With Sentry | Diff |
---|---|---|---|
a9a5b1c | 1234.60 ms | 1254.16 ms | 19.56 ms |
1f239e8 | 1233.94 ms | 1253.76 ms | 19.82 ms |
4c753cb | 1218.83 ms | 1236.60 ms | 17.77 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
a9a5b1c | 22.32 KiB | 761.25 KiB | 738.94 KiB |
1f239e8 | 22.30 KiB | 760.63 KiB | 738.32 KiB |
4c753cb | 22.31 KiB | 766.22 KiB | 743.91 KiB |
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.
FYI, we already tried that in the past and it always blew up the tests. We instead chose a different approach: We don't unswizzle, but we make sure the operations are NoOps when closing the SDK. I mean we can try again, but we need some good reasons. What drove you to open this PR?
@philipphofmann in #4634 I added unit tests initializing the SentrySDK with an experimental feature flag enabled or disabled. If the SentrySDK is enabled, and swizzling happens, the swizzling remains even after closing and re-enabling the SentrySDK without swizzling. We could also change this PR to only unswizzle in unit tests, i.e. using |
I agree with this!! |
🚨 Detected changes in high risk code 🚨High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:
|
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.
I added a few comments. I'm fine to give this a shot for the tests, but definitely not in production cause swizzling can have drastic unwanted side effects.
🚨 Detected changes in high risk code 🚨High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:
|
1 similar comment
🚨 Detected changes in high risk code 🚨High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:
|
🚨 Detected changes in high risk code 🚨High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:
|
🚨 Detected changes in high risk code 🚨High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:
|
🚨 Detected changes in high risk code 🚨High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:
|
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.
LGTM, thanks.
🚨 Detected changes in high risk code 🚨High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:
|
FYI @philipphofmann I had to remove an |
📜 Description
I adapted the method swizzling helper to keep a reference to the original implementation, so that the
unswizzle
methods can revert swizzling.💡 Motivation and Context
We are introducing a new experimental flag in #4634 to conditionally swizzle Objective-C methods. Therefore some unit tests (e.g
testFoo
) swizzle methods, while others (e.g.testBar
) do not. If we do not offer a functionality to unswizzle methods, they are leaking isolation, i.e.testFoo
runs beforetestBar
therefore methods are swizzled, even tough we don't want that.This is required for #4634 to pass tests.
💚 How did you test it?
I added a unit test to test the unswizzling.
📝 Checklist
You have to check all boxes before merging:
sendDefaultPII
is enabled.🔮 Next steps
#if TEST
to not be used in production