Skip to content

Delete abandoned SentrySDKWrapper init surface and migrate tests to RNSentryStart #6015

@antonis

Description

@antonis

Context

When the iOS init path was moved from SentrySDKWrapper to RNSentryStart in v8 (via #5582 / sub-PR #4442), only the call sites were repointed — the old option-parsing methods in SentrySDKWrapper were left in place "just in case," along with their XCTest suite. Nothing in production calls them anymore, but the tests kept passing, which is precisely how two bugs shipped in every 8.x release until we noticed:

The dead code also parses enableLogs (harmless — Cocoa's dict parser handles it), enableNativeCrashHandling, spotlight, etc. — all duplicated in RNSentryStart today.

Why this matters

As long as SentrySDKWrapper.createOptionsWithDictionary and its test coverage exist, any future author who wants to add a new option or _experiments.* field has two visually-equivalent files to update, no signal about which one is live, and XCTest runs that pass even when the live path is broken. That's exactly the setup that produced the two bugs above — the #5611 author added the profiling block to SentrySDKWrapper because it looked like the right file.

What to do

  1. In packages/core/ios/SentrySDKWrapper.{h,m}, delete:

    • createOptionsWithDictionary:isSessionReplayEnabled:error:
    • setupWithDictionary:isSessionReplayEnabled:error:
    • startWithOptions: (the internal one that the above methods call)

    Keep the methods that are still used from RNSentry.mm: crash, close, crashedLastRun, configureScope:, debug, releaseName, enableAutoSessionTracking, enableWatchdogTerminationTracking. (Grep SentrySDKWrapper in RNSentry.mm for the exact list; it's ~10 call sites.)

  2. In packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryTests.m, delete the [SentrySDKWrapper createOptionsWithDictionary:…] tests (~lines 34–1065 in the current file). For any assertion in there that covers behavior still worth testing but not already covered by the RNSentryStart Tests block (e.g., the ignoreErrors filtering tests), migrate the test to use RNSentryStart createOptionsWithDictionary: / startWithOptions: instead.

  3. Keep the remaining RNSentryStart-based tests as the single source of truth for init-path behavior.

Acceptance

  • grep -r 'SentrySDKWrapper createOptionsWithDictionary\|SentrySDKWrapper setupWithDictionary' packages/core returns nothing.
  • xcodebuild test (Cocoa suite) stays green.
  • No orphaned #import "SentrySDKWrapper.h" in the tests if nothing else from the header is used.

Notes

Metadata

Metadata

Assignees

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions