Skip to content

Conversation

@itaybre
Copy link
Contributor

@itaybre itaybre commented Dec 12, 2025

Converts SentryFramesTrackingIntegration to Swift as part of the Swift project

#skip-changelog

Closes #7066

@linear
Copy link

linear bot commented Dec 12, 2025

@itaybre
Copy link
Contributor Author

itaybre commented Dec 12, 2025

Lint fails, and that's expected for now, enable ready-to-merge to run all tests

@itaybre itaybre added the ready-to-merge Use this label to trigger all PR workflows label Dec 12, 2025
@codecov
Copy link

codecov bot commented Dec 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.893%. Comparing base (feaf817) to head (f09049f).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@              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     
Files with missing lines Coverage Δ
Sources/Sentry/SentrySDKInternal.m 84.773% <100.000%> (-0.063%) ⬇️
Sources/Swift/Core/Integrations/Integrations.swift 100.000% <100.000%> (ø)
...amesTracking/SentryFramesTrackingIntegration.swift 100.000% <100.000%> (ø)
Sources/Swift/SentryDependencyContainer.swift 98.319% <ø> (ø)

... and 9 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update feaf817...f09049f. Read the comment docs.

Comment on lines +43 to +45
#if (os(iOS) || os(tvOS) || targetEnvironment(macCatalyst) || (swift(>=5.9) && os(visionOS))) && !SENTRY_NO_UIKIT
integrations.append(.init(SentryFramesTrackingIntegration<SentryDependencyContainer>.self))
#endif
Copy link

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

@github-actions
Copy link
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1216.77 ms 1245.51 ms 28.74 ms
Size 24.14 KiB 1.03 MiB 1.01 MiB

Baseline results on branch: main

Startup times

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Use this label to trigger all PR workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: Convert SentryFramesTrackingIntegration to Swift

1 participant