Skip to content

Conversation

@noahsmartin
Copy link
Contributor

@noahsmartin noahsmartin commented Dec 3, 2025

fixes: #6966

@noahsmartin noahsmartin force-pushed the fixSwizzlingNullability branch from bca2c2a to b2eb06e Compare December 3, 2025 11:34
@noahsmartin noahsmartin added the ready-to-merge Use this label to trigger all PR workflows label Dec 3, 2025
@codecov
Copy link

codecov bot commented Dec 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.492%. Comparing base (b2295d4) to head (9526bb3).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #6970       +/-   ##
=============================================
- Coverage   85.076%   84.492%   -0.584%     
=============================================
  Files          453       453               
  Lines        27674     27664       -10     
  Branches     12166     12162        -4     
=============================================
- Hits         23544     23374      -170     
- Misses        4087      4240      +153     
- Partials        43        50        +7     
Files with missing lines Coverage Δ
Sources/Sentry/SentrySwizzleWrapperHelper.m 90.909% <ø> (-9.091%) ⬇️

... and 50 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 b2295d4...9526bb3. Read the comment docs.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1231.62 ms 1263.75 ms 32.13 ms
Size 24.14 KiB 1.02 MiB 1019.79 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
32f2329 1224.36 ms 1257.33 ms 32.98 ms
df94923 1217.35 ms 1247.44 ms 30.09 ms
e3ebff3 1223.47 ms 1249.27 ms 25.80 ms
dba2de8 1231.45 ms 1251.88 ms 20.43 ms
ee1f2ca 1227.47 ms 1251.58 ms 24.12 ms
fc6557e 1226.40 ms 1249.88 ms 23.48 ms
7cc23cf 1203.15 ms 1232.11 ms 28.96 ms
cda95fc 1231.42 ms 1247.18 ms 15.77 ms
535ebd9 1194.59 ms 1219.84 ms 25.26 ms
26f7b17 1218.47 ms 1253.82 ms 35.35 ms

App size

Revision Plain With Sentry Diff
32f2329 23.75 KiB 1.01 MiB 1016.02 KiB
df94923 24.15 KiB 1.01 MiB 1014.90 KiB
e3ebff3 23.75 KiB 878.48 KiB 854.73 KiB
dba2de8 23.75 KiB 969.25 KiB 945.50 KiB
ee1f2ca 24.15 KiB 1.01 MiB 1015.24 KiB
fc6557e 23.75 KiB 866.68 KiB 842.93 KiB
7cc23cf 23.75 KiB 913.62 KiB 889.87 KiB
cda95fc 23.75 KiB 912.77 KiB 889.02 KiB
535ebd9 23.75 KiB 1008.67 KiB 984.92 KiB
26f7b17 23.75 KiB 960.93 KiB 937.19 KiB

Previous results on branch: fixSwizzlingNullability

Startup times

Revision Plain With Sentry Diff
3669afe 1197.04 ms 1233.71 ms 36.67 ms
ced24ac 1209.42 ms 1241.28 ms 31.86 ms
05e7507 1219.73 ms 1252.80 ms 33.07 ms
20fbddf 1214.44 ms 1255.20 ms 40.76 ms

App size

Revision Plain With Sentry Diff
3669afe 24.14 KiB 1.02 MiB 1016.92 KiB
ced24ac 24.14 KiB 1.02 MiB 1016.91 KiB
05e7507 24.14 KiB 1.02 MiB 1016.91 KiB
20fbddf 24.14 KiB 1.02 MiB 1016.90 KiB

Copy link
Member

@philipphofmann philipphofmann left a comment

Choose a reason for hiding this comment

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

LGTM, @noahsmartin, I think it would be great to add a test preventing this crash from happening again.

@noahsmartin noahsmartin force-pushed the fixSwizzlingNullability branch from dba1012 to 08617b6 Compare December 3, 2025 15:20
Button(action: captureTransactionAction) {
Text("Capture Transaction")
}
Button("UIApplication sendEvent") {
Copy link
Member

Choose a reason for hiding this comment

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

l:

Suggested change
Button("UIApplication sendEvent") {
Button("UIApplication sendEmptyEvent") {

Text("Capture Transaction")
}
Button("UIApplication sendEvent") {
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
Copy link
Member

Choose a reason for hiding this comment

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

m: I think it makes sense to add a comment that this is required for a UITest, because otherwise it could be confusing what the purpose of this.


final class UIApplicationSwizzleTests: XCTestCase {

func testSendEvent() {
Copy link
Member

Choose a reason for hiding this comment

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

m: I'm unsure if we actually run these UI tests in CI. Worth double checking.


final class UIApplicationSwizzleTests: XCTestCase {

func testSendEvent() {
Copy link
Member

Choose a reason for hiding this comment

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

m: I think it's worth adding a comment to explain the purpose of this test. Basically it's a regression test for a crash we had and maybe we can add the link to the issue.

@noahsmartin noahsmartin force-pushed the fixSwizzlingNullability branch from 08617b6 to 9526bb3 Compare December 4, 2025 12:45
app.safelyLaunch()

app.buttons["UIApplication sendEmptyEvent"].tap()
fatalError()
Copy link

Choose a reason for hiding this comment

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

Bug: Unconditional fatalError() in testSendEvent prevents test from validating fix.
Severity: HIGH | Confidence: High

🔍 Detailed Analysis

The testSendEvent method in UIApplicationSwizzleTests.swift contains an unconditional fatalError() at line 15. This causes the test to crash every time it is executed, preventing it from verifying the intended fix for issue #6966. The test lacks any assertions to confirm the app's behavior after tapping the button, making it non-functional and unable to validate the fix.

💡 Suggested Fix

Remove the fatalError() and add an assertion (e.g., XCTAssertNoThrow or XCTAssertTrue that the app is still running) after the button tap to verify the app does not crash.

🤖 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: Samples/iOS-SwiftUI/iOS-SwiftUI-UITests/UIApplicationSwizzleTests.swift#L15

Potential issue: The `testSendEvent` method in `UIApplicationSwizzleTests.swift`
contains an unconditional `fatalError()` at line 15. This causes the test to crash every
time it is executed, preventing it from verifying the intended fix for issue #6966. The
test lacks any assertions to confirm the app's behavior after tapping the button, making
it non-functional and unable to validate the fix.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 5493352

app.safelyLaunch()

app.buttons["UIApplication sendEmptyEvent"].tap()
fatalError()
Copy link

Choose a reason for hiding this comment

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

Bug: Test contains fatalError() that will always crash

The test testSendEvent contains a fatalError() call at the end that will unconditionally crash when the test runs. This appears to be accidentally committed debugging code. The test is intended to verify that the app doesn't crash when sendAction:to:from:forEvent: is called with nil parameters, but the fatalError() will cause the test to fail regardless of whether the actual fix works.

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.

Crash when invoking selector on UIApplication after upgrading to v9

3 participants