Skip to content

fix(ios): make the RNSentry SPEC CHECKSUM in Podfile.lock machine-independent#6474

Open
Cryptoteep wants to merge 2 commits into
getsentry:mainfrom
Cryptoteep:fix/podspec-machine-specific-checksum
Open

fix(ios): make the RNSentry SPEC CHECKSUM in Podfile.lock machine-independent#6474
Cryptoteep wants to merge 2 commits into
getsentry:mainfrom
Cryptoteep:fix/podspec-machine-specific-checksum

Conversation

@Cryptoteep

@Cryptoteep Cryptoteep commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Closes #6467

The problem

Since #6413, RNSentry.podspec points FRAMEWORK_SEARCH_PATHS at the absolute pod-install-time path of the cached Sentry.xcframework (~/Library/Caches/sentry-react-native/xcframeworks/…). CocoaPods computes the SPEC CHECKSUM it writes into Podfile.lock over the evaluated spec — including those xcconfig values — so the $HOME component leaks into the checksum. Two machines installing the same SDK version get different RNSentry checksums, and a committed Podfile.lock flips on every pod install (full analysis in #6467).

The fix

Stage the cached bundle behind a machine-independent reference instead of putting the absolute path into the spec:

  • stage_sentry_xcframework_in_pods (new, sentry_utils.rb) symlinks Pods/sentry-xcframeworks/<sentry-cocoa version>/Sentry.xcframework → the cached bundle, recreating the link when it's missing or stale (e.g. SENTRY_XCFRAMEWORK_CACHE_DIR changed between installs).
  • The podspec now writes "$(PODS_ROOT)/sentry-xcframeworks/<version>/Sentry.xcframework/<slice>" into FRAMEWORK_SEARCH_PATHS — the same string on every machine, so the checksum is deterministic. $(PODS_ROOT) is defined in both per-pod and user/aggregate xcconfigs (unlike $(PODS_TARGET_SRCROOT)), and because the link lives inside Pods/ there is no Podfile-layout detection — the objections that originally motivated the absolute path don't apply to this shape.
  • If the symlink can't be created, it warns and falls back to the absolute cache path — exactly the previous behaviour.

The download/cache/SHA256-verification flow is unchanged; the cache stays in ~/Library/Caches (still shared across projects, still safe under pnpm's read-only store and Yarn PnP).

Notes

  • Existing projects will see a one-time RNSentry checksum change in Podfile.lock on their next pod install; after that the value is stable across developers and CI.
  • Teams that adopted the SENTRY_XCFRAMEWORK_CACHE_DIR=/tmp/… workaround from iOS: RNSentry SPEC CHECKSUM is machine-specific (absolute xcframework path in FRAMEWORK_SEARCH_PATHS) → Podfile.lock churn across devs/CI #6467 can drop it — and mixed setups (some machines with the override, some without) now converge on the same checksum, since the override no longer appears in the spec.
  • Verified by inspection + CI: the sample-app pod install jobs exercise the new staging path end-to-end. I don't have a macOS machine at hand, so I couldn't run the two-$HOME determinism check from the issue locally — happy to adjust if anything shakes out in CI.

🤖 Generated with Claude Code

FRAMEWORK_SEARCH_PATHS pointed at the absolute per-user xcframework
cache path (~/Library/Caches/...), and everything in the evaluated spec
feeds the SPEC CHECKSUM CocoaPods writes into Podfile.lock — so the
checksum differed per machine and the lockfile churned on every
pod install.

Stage the cached bundle behind a Pods/sentry-xcframeworks/<version>
symlink and reference it as $(PODS_ROOT)/sentry-xcframeworks/..., which
is the same string on every machine. If the symlink cannot be created,
fall back to the absolute path (previous behaviour).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

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


  • fix(ios): make the RNSentry SPEC CHECKSUM in Podfile.lock machine-independent by Cryptoteep in #6474

🤖 This preview updates automatically when you update the PR.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d3276eb. Configure here.

# (e.g. `SENTRY_XCFRAMEWORK_CACHE_DIR` changed between installs).
unless File.symlink?(link_path) && File.readlink(link_path) == xcframework_dir
FileUtils.rm_rf(link_path)
File.symlink(xcframework_dir, link_path)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Relative cache path breaks xcframework symlink

Medium Severity

When SENTRY_XCFRAMEWORK_CACHE_DIR is a relative path, ensure_sentry_xcframework still resolves the xcframework using the Podfile working directory, but File.symlink treats a relative target as relative to the staging directory under Pods/sentry-xcframeworks/…. The symlink can point at the wrong location while staging still returns the stable $(PODS_ROOT) reference, so pod install succeeds and Xcode later fails to find Sentry.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d3276eb. Configure here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

worth checking

@alwx

alwx commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Thank you for the fix, @Cryptoteep! can you update the sentry-utils.rb as suggested above?

File.symlink(xcframework_dir, link_path)
end

"$(PODS_ROOT)/sentry-xcframeworks/#{version}/#{product}.xcframework"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

a small thing: could you please use ${PODS_ROOT} to match CocoaPods' generated xcconfig style? with {} instead of ()

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.

iOS: RNSentry SPEC CHECKSUM is machine-specific (absolute xcframework path in FRAMEWORK_SEARCH_PATHS) → Podfile.lock churn across devs/CI

2 participants