Skip to content

Conversation

@itaybre
Copy link
Contributor

@itaybre itaybre commented Jan 22, 2026

📜 Description

Not ready for review yet

💡 Motivation and Context

Swift conversion

💚 How did you test it?

📝 Checklist

You have to check all boxes before merging:

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

#skip-changelog

Closes #7275

@linear
Copy link

linear bot commented Jan 22, 2026

@github-actions
Copy link
Contributor

github-actions bot commented Jan 22, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


This PR will not appear in the changelog.


🤖 This preview updates automatically when you update the PR.

@codecov
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.032%. Comparing base (7c58690) to head (918e252).
✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##              main     #7255       +/-   ##
=============================================
+ Coverage   85.025%   85.032%   +0.006%     
=============================================
  Files          471       472        +1     
  Lines        28388     28401       +13     
  Branches     12463     12470        +7     
=============================================
+ Hits         24137     24150       +13     
+ Misses        4204      4202        -2     
- Partials        47        49        +2     
Files with missing lines Coverage Δ
Sources/Sentry/SentryBaseIntegration.m 70.666% <ø> (-1.486%) ⬇️
Sources/Sentry/SentryCoreDataSwizzlingHelper.m 100.000% <100.000%> (ø)
Sources/Sentry/SentrySDKInternal.m 84.120% <100.000%> (-0.068%) ⬇️
Sources/Swift/Core/Integrations/Integrations.swift 100.000% <100.000%> (ø)
...Performance/CoreData/SentryCoreDataSwizzling.swift 100.000% <100.000%> (ø)
...e/CoreData/SentryCoreDataTrackingIntegration.swift 100.000% <100.000%> (ø)
Sources/Swift/SentryDependencyContainer.swift 96.385% <100.000%> (+0.021%) ⬆️

... and 5 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 7c58690...918e252. Read the comment docs.

Base automatically changed from itaybrenner/cocoa-1000-refactor-sentryfileiotrackingintegrationm-in-swift_2 to main January 23, 2026 15:14
@itaybre itaybre added the ready-to-merge Use this label to trigger all PR workflows label Jan 23, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Jan 23, 2026

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1215.19 ms 1248.59 ms 33.40 ms
Size 24.14 KiB 1.08 MiB 1.06 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
83bf9af 1213.30 ms 1234.18 ms 20.89 ms
5d67f5d 1225.33 ms 1262.76 ms 37.43 ms
e01eafa 1223.36 ms 1252.43 ms 29.07 ms
86b8951 1211.20 ms 1247.92 ms 36.72 ms
9a0a3cd 1220.85 ms 1243.69 ms 22.83 ms
e701dc8 1215.89 ms 1254.06 ms 38.17 ms
fd24b7c 1222.39 ms 1259.67 ms 37.28 ms
013fd4d 1216.02 ms 1242.16 ms 26.14 ms
0d145c3 1224.04 ms 1255.34 ms 31.30 ms
37bc095 1210.00 ms 1242.69 ms 32.69 ms

App size

Revision Plain With Sentry Diff
83bf9af 24.14 KiB 1.04 MiB 1.02 MiB
5d67f5d 24.14 KiB 1.06 MiB 1.04 MiB
e01eafa 24.14 KiB 1.07 MiB 1.04 MiB
86b8951 24.14 KiB 1.08 MiB 1.06 MiB
9a0a3cd 24.14 KiB 1.08 MiB 1.06 MiB
e701dc8 24.14 KiB 1.06 MiB 1.04 MiB
fd24b7c 24.14 KiB 1.07 MiB 1.04 MiB
013fd4d 24.14 KiB 1.04 MiB 1.02 MiB
0d145c3 24.14 KiB 1.07 MiB 1.05 MiB
37bc095 24.14 KiB 1.06 MiB 1.04 MiB

Previous results on branch: itaybrenner/cocoa-988-refactor-sentrycoredatatrackingintegrationm-in-swift

Startup times

Revision Plain With Sentry Diff
7c41873 1212.56 ms 1239.45 ms 26.88 ms
6736902 1223.02 ms 1250.51 ms 27.49 ms

App size

Revision Plain With Sentry Diff
7c41873 24.14 KiB 1.08 MiB 1.06 MiB
6736902 24.14 KiB 1.08 MiB 1.06 MiB

…nner/cocoa-988-refactor-sentrycoredatatrackingintegrationm-in-swift
…nner/cocoa-988-refactor-sentrycoredatatrackingintegrationm-in-swift
@itaybre itaybre marked this pull request as ready for review January 23, 2026 20:23
@github-actions
Copy link
Contributor

🚨 Detected changes in high risk code 🚨

High-risk code can easily blow up and is hard to test. We had severe bugs in the past. Be extra careful when changing these files, and have an extra careful look at these:

  • Sources/Sentry/SentryCoreDataSwizzling.m

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

originalImp:^NSArray *(NSFetchRequest *request, NSError **outError) {
return SentrySWCallOriginal(request, outError);
}]
: SentrySWCallOriginal(originalRequest, error);
Copy link

Choose a reason for hiding this comment

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

Race condition when accessing weak tracker reference twice

Medium Severity

The __weak static _tracker variable is accessed twice in the ternary expression: once for the nil check and once for the method call. Between these accesses, the tracker could be deallocated on another thread, causing the second access to return nil. This would result in the message being sent to nil, returning nil/NO instead of calling the original Core Data implementation. The old code avoided this by capturing the weak reference into a local strong variable first. This could cause fetch operations to silently return empty results or save operations to report false failures.

Additional Locations (1)

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.

refactor: Convert SentryCoreDataTrackingIntegration to Swift

2 participants