Skip to content

Conversation

@itaybre
Copy link
Contributor

@itaybre itaybre commented Oct 24, 2025

This PR disable the SessionReplayIntegration instead of disabling SentrySessionReplay to avoid running any SessionReplay logic if not needed.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 24, 2025

Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

### Fixes

- Disable SessionSentryReplayIntegration if the environment is unsafe ([#6539](https://github.com/getsentry/sentry-cocoa/pull/6539))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description or adding a skip-changelog label.

Generated by 🚫 dangerJS against 82adc05

@codecov
Copy link

codecov bot commented Oct 24, 2025

❌ 3 Tests Failed:

Tests completed Failed Passed Skipped
3998 3 3995 55
View the top 3 failed test(s) by shortest run time
SentryTests.PrivateSentrySDKOnlyTests::testAddIgnoreContainer
Stack Traces | 0s run time
.../Tests/SentryTests/PrivateSentrySDKOnlyTests.swift:450 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.PrivateSentrySDKOnlyTests::testAddRedactContainer
Stack Traces | 0s run time
.../Tests/SentryTests/PrivateSentrySDKOnlyTests.swift:450 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.SentrySessionReplayIntegrationTests::testInstallWithSwizzlingHasTouchTracker
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:51 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.SentrySessionReplayIntegrationTests::testMaskViewFromSDK
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:51 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.SentrySessionReplayIntegrationTests::testMoveCurrentReplay_whenLastFileExistsWithCurrent_shouldBeReplaced
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:51 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.SentrySessionReplayIntegrationTests::testMoveCurrentReplay_whenLastFileExistsWithoutCurrent_shouldBeRemoved
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:51 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.SentrySessionReplayIntegrationTests::testPauseAndResumeForApplicationStateChange
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:51 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.SentrySessionReplayIntegrationTests::testPauseSessionReplayWithReacheability
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:51 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.SentrySessionReplayIntegrationTests::testPersistScreenshotProviderAndBreadcrumbConverter
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:51 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.SentrySessionReplayIntegrationTests::testQueuePriorities_processingQueueShouldHaveLowerPriorityThanWorkerQueue
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:51 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.SentrySessionReplayIntegrationTests::testRestartReplayWithNewSession
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:51 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.SentrySessionReplayIntegrationTests::testRestartReplayWithNewSessionClosePreviousReplay
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:51 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.SentrySessionReplayIntegrationTests::testScreenNameFromSentryScope
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:51 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.SentrySessionReplayIntegrationTests::testScreenNameFromSentryUIApplication
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:51 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.SentrySessionReplayIntegrationTests::testSessionReplayForCrash
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:225 - Asynchronous wait failed: Exceeded timeout of 1 seconds, with unfulfilled expectations: "Replay to be captured".
SentryTests.SentrySessionReplayIntegrationTests::testSetCustomOptions
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:51 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.SentrySessionReplayIntegrationTests::testShowMaskPreviewForDebug
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:51 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.SentrySessionReplayIntegrationTests::testStartFullSessionForError
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:51 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.SentrySessionReplayIntegrationTests::testStartWithBufferSessionReplay
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:51 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.SentrySessionReplayIntegrationTests::testStartWithSessionReplayRunning
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:51 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.SentrySessionReplayIntegrationTests::testStop
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:51 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.SentrySessionReplayIntegrationTests::testStopBecauseOfAllRateLimit
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:51 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.SentrySessionReplayIntegrationTests::testStopBecauseOfReplayRateLimit
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:51 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.SentrySessionReplayIntegrationTests::testStopReplayAtEndOfSession
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:51 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
SentryTests.SentrySessionReplayIntegrationTests::testWaitForNotificationWithNoWindow
Stack Traces | 0s run time
.../Integrations/SessionReplay/SentrySessionReplayIntegrationTests.swift:51 - XCTUnwrap failed: expected non-nil value of type "SentrySessionReplayIntegration"
iOS_SwiftUI_UITests.LaunchUITests::testCaptureErrorReturnsValidId
Stack Traces | 0s run time
.../iOS-SwiftUI/iOS-SwiftUI-UITests/LaunchUITests.swift:56 - Failed to tap "Capture Error" Button: Timed out while evaluating UI query.

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@objc public static let processInfoWrapper: SentryProcessInfoSource = ProcessInfo.processInfo
static let infoPlistWrapper: SentryInfoPlistWrapperProvider = SentryInfoPlistWrapper()
@objc public static let sessionReplayEnvironmentChecker: SentrySessionReplayEnvironmentChecker = {
@objc public static var sessionReplayEnvironmentChecker: SentrySessionReplayEnvironmentCheckerProvider = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Only a let is thread safe. If you need it to override the value for testing I think it's better to pass the dependencies as a parameter to the class you're testing, rather than having it used from here.

Or if that's too hard to refactor just move it to SentryDependencyContainer and use the lock with a lazy var

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is only for testing.

Moving this to SentryDependencyContainer won't work on the v8 branch, which also needs this fix

@github-actions
Copy link
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1219.43 ms 1257.72 ms 38.29 ms
Size 23.75 KiB 1.00 MiB 1004.85 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
db9572a 1200.27 ms 1234.80 ms 34.53 ms
5258fb8 1207.92 ms 1234.51 ms 26.59 ms
2481950 1221.04 ms 1248.98 ms 27.94 ms
2be5991 1228.55 ms 1264.65 ms 36.10 ms
7d88965 1228.86 ms 1248.53 ms 19.67 ms
ab0ba7e 1216.08 ms 1242.40 ms 26.31 ms
139db8b 1231.50 ms 1258.19 ms 26.69 ms
78af7a9 1225.75 ms 1256.98 ms 31.23 ms
5db87fa 1218.88 ms 1251.53 ms 32.65 ms
b5a7583 1238.22 ms 1263.94 ms 25.71 ms

App size

Revision Plain With Sentry Diff
db9572a 23.75 KiB 858.69 KiB 834.93 KiB
5258fb8 23.75 KiB 874.45 KiB 850.70 KiB
2481950 23.74 KiB 872.74 KiB 849.00 KiB
2be5991 23.75 KiB 994.73 KiB 970.98 KiB
7d88965 23.75 KiB 994.72 KiB 970.98 KiB
ab0ba7e 23.75 KiB 904.54 KiB 880.79 KiB
139db8b 23.75 KiB 920.64 KiB 896.89 KiB
78af7a9 23.75 KiB 990.00 KiB 966.26 KiB
5db87fa 23.75 KiB 926.65 KiB 902.90 KiB
b5a7583 23.75 KiB 913.44 KiB 889.68 KiB

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants