-
-
Notifications
You must be signed in to change notification settings - Fork 372
chore: Convert SentryFramesTrackingIntegration to Swift
#7044
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
base: main
Are you sure you want to change the base?
chore: Convert SentryFramesTrackingIntegration to Swift
#7044
Conversation
|
Lint fails, and that's expected for now, enable |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7044 +/- ##
=============================================
- Coverage 84.925% 84.893% -0.033%
=============================================
Files 457 457
Lines 27616 27630 +14
Branches 12139 12147 +8
=============================================
+ Hits 23453 23456 +3
- Misses 4121 4134 +13
+ Partials 42 40 -2
... and 9 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
…coa-999-refactor-sentryframestrackingintegrationm-in-swift
| #if (os(iOS) || os(tvOS) || targetEnvironment(macCatalyst) || (swift(>=5.9) && os(visionOS))) && !SENTRY_NO_UIKIT | ||
| integrations.append(.init(SentryFramesTrackingIntegration<SentryDependencyContainer>.self)) | ||
| #endif |
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.
Bug: The conditional compilation directives for SentryFramesTrackingIntegration are inconsistent. It's enabled for macCatalyst in Integrations.swift but disabled in its implementation and protocol conformance, causing a build failure.
Severity: CRITICAL | Confidence: High
🔍 Detailed Analysis
There is a conditional compilation mismatch for macCatalyst builds. The Integrations.swift file attempts to register SentryFramesTrackingIntegration<SentryDependencyContainer> when targetEnvironment(macCatalyst) is true. However, the class definition for SentryFramesTrackingIntegration and the FramesTrackingProvider protocol conformance for SentryDependencyContainer are not compiled for macCatalyst, as they are missing targetEnvironment(macCatalyst) in their #if directives. This discrepancy will lead to a Swift compilation error on macCatalyst builds because the compiler will be unable to find the specified type and protocol conformance.
💡 Suggested Fix
Add targetEnvironment(macCatalyst) to the conditional compilation directives in SentryFramesTrackingIntegration.swift and SentryDependencyContainer.swift to match the directive in Integrations.swift. This will ensure the frames tracking feature is consistently compiled across all necessary files for macCatalyst builds.
🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: Sources/Swift/Core/Integrations/Integrations.swift#L43-L45
Potential issue: There is a conditional compilation mismatch for macCatalyst builds. The
`Integrations.swift` file attempts to register
`SentryFramesTrackingIntegration<SentryDependencyContainer>` when
`targetEnvironment(macCatalyst)` is true. However, the class definition for
`SentryFramesTrackingIntegration` and the `FramesTrackingProvider` protocol conformance
for `SentryDependencyContainer` are not compiled for macCatalyst, as they are missing
`targetEnvironment(macCatalyst)` in their `#if` directives. This discrepancy will lead
to a Swift compilation error on macCatalyst builds because the compiler will be unable
to find the specified type and protocol conformance.
Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 7664119
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| bbe6658 | 1221.00 ms | 1248.51 ms | 27.51 ms |
| 1fe932f | 1231.92 ms | 1253.44 ms | 21.52 ms |
| 51f74d7 | 1236.31 ms | 1247.43 ms | 11.12 ms |
| 04f41a1 | 1215.82 ms | 1252.36 ms | 36.54 ms |
| 3b4b557 | 1234.59 ms | 1254.02 ms | 19.43 ms |
| b714cb9 | 1224.71 ms | 1238.04 ms | 13.33 ms |
| ac4739e | 1236.55 ms | 1258.89 ms | 22.34 ms |
| b045d0a | 1227.48 ms | 1252.22 ms | 24.75 ms |
| be6a4ee | 1226.33 ms | 1249.77 ms | 23.44 ms |
| 21efa18 | 1227.73 ms | 1250.04 ms | 22.31 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| bbe6658 | 23.75 KiB | 908.02 KiB | 884.27 KiB |
| 1fe932f | 23.75 KiB | 913.63 KiB | 889.88 KiB |
| 51f74d7 | 23.74 KiB | 874.08 KiB | 850.34 KiB |
| 04f41a1 | 24.14 KiB | 1.01 MiB | 1015.39 KiB |
| 3b4b557 | 23.75 KiB | 908.39 KiB | 884.64 KiB |
| b714cb9 | 23.75 KiB | 858.69 KiB | 834.93 KiB |
| ac4739e | 23.75 KiB | 872.67 KiB | 848.92 KiB |
| b045d0a | 23.75 KiB | 880.21 KiB | 856.46 KiB |
| be6a4ee | 23.75 KiB | 913.14 KiB | 889.39 KiB |
| 21efa18 | 23.75 KiB | 919.70 KiB | 895.95 KiB |
Converts
SentryFramesTrackingIntegrationto Swift as part of the Swift project#skip-changelog
Closes #7066