Skip to content

Conversation

@itaybre
Copy link
Contributor

@itaybre itaybre commented Dec 2, 2025

Converts SentryAutoSessionTrackingIntegration to Swift in preparation for some fixes for System Extensions (see this issue)

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

codecov bot commented Dec 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.120%. Comparing base (3c70f95) to head (25d4906).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #6961       +/-   ##
=============================================
+ Coverage   85.043%   85.120%   +0.076%     
=============================================
  Files          453       453               
  Lines        27681     27683        +2     
  Branches     12166     12165        -1     
=============================================
+ Hits         23541     23564       +23     
+ Misses        4094      4076       -18     
+ Partials        46        43        -3     
Files with missing lines Coverage Δ
Sources/Sentry/SentryBaseIntegration.m 97.368% <ø> (+1.605%) ⬆️
Sources/Sentry/SentrySDKInternal.m 85.080% <100.000%> (ø)
Sources/Swift/Core/Integrations/Integrations.swift 100.000% <100.000%> (ø)
...Session/SentryAutoSessionTrackingIntegration.swift 100.000% <100.000%> (ø)
Sources/Swift/SentryDependencyContainer.swift 98.496% <ø> (ø)

... and 7 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 3c70f95...25d4906. Read the comment docs.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1221.84 ms 1255.78 ms 33.94 ms
Size 24.14 KiB 1.02 MiB 1017.04 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
83e9b16 1223.25 ms 1250.94 ms 27.69 ms
8745cc0 1228.13 ms 1250.48 ms 22.35 ms
abafa5d 1228.91 ms 1257.11 ms 28.20 ms
39e3732 1193.96 ms 1219.51 ms 25.55 ms
ea5a59b 1222.87 ms 1253.47 ms 30.60 ms
e5773c1 1235.10 ms 1264.15 ms 29.04 ms
2609f7a 1218.17 ms 1241.34 ms 23.17 ms
827b50c 1233.27 ms 1267.28 ms 34.01 ms
daf8077 1202.78 ms 1235.52 ms 32.74 ms
1ed7bf6 1215.78 ms 1255.78 ms 40.00 ms

App size

Revision Plain With Sentry Diff
83e9b16 23.75 KiB 947.72 KiB 923.97 KiB
8745cc0 23.74 KiB 971.81 KiB 948.07 KiB
abafa5d 23.74 KiB 1023.00 KiB 999.25 KiB
39e3732 24.15 KiB 1.01 MiB 1014.59 KiB
ea5a59b 23.75 KiB 874.46 KiB 850.71 KiB
e5773c1 23.75 KiB 1.00 MiB 1005.08 KiB
2609f7a 23.75 KiB 867.04 KiB 843.29 KiB
827b50c 23.75 KiB 1.00 MiB 1005.07 KiB
daf8077 23.75 KiB 971.82 KiB 948.07 KiB
1ed7bf6 24.14 KiB 1.01 MiB 1012.91 KiB

Previous results on branch: itay/convert_autosessionintegration_to_swift

Startup times

Revision Plain With Sentry Diff
c130777 1222.88 ms 1255.96 ms 33.08 ms

App size

Revision Plain With Sentry Diff
c130777 24.14 KiB 1.02 MiB 1017.04 KiB

@itaybre itaybre marked this pull request as ready for review December 2, 2025 20:44

autoSessionTrackingIntegration = SentryAutoSessionTrackingIntegration()
autoSessionTrackingIntegration.install(with: options)
autoSessionTrackingIntegration = SentryAutoSessionTrackingIntegration(with: options, dependencies: SentryDependencyContainer.sharedInstance())
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Test crashes due to nil integration with disabled tracking

The test sets options.enableAutoSessionTracking = false to prevent automatic SDK installation, then manually creates SentryAutoSessionTrackingIntegration. However, the new Swift implementation's failable initializer returns nil when enableAutoSessionTracking is false. Since autoSessionTrackingIntegration is declared as an implicitly unwrapped optional (!), subsequent calls to .stop() in tearDown() and throughout the test will crash due to force-unwrapping nil.

Additional Locations (2)

Fix in Cursor Fix in Web

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.

2 participants