Skip to content

fix(ios): make Podfile.lock SPEC CHECKSUMS deterministic across machines#56977

Open
IsaacIsrael wants to merge 1 commit into
facebook:mainfrom
IsaacIsrael:fix/podfile-lock-determinism
Open

fix(ios): make Podfile.lock SPEC CHECKSUMS deterministic across machines#56977
IsaacIsrael wants to merge 1 commit into
facebook:mainfrom
IsaacIsrael:fix/podfile-lock-determinism

Conversation

@IsaacIsrael
Copy link
Copy Markdown

@IsaacIsrael IsaacIsrael commented May 27, 2026

Summary

Two sources of non-determinism cause Podfile.lock SPEC CHECKSUMS to differ between machines, breaking pod install --deployment in CI and creating unnecessary churn in PRs.

Fix 1: Sort Dir.glob results in Yoga.podspec

Dir.glob returns files in filesystem-dependent order (varies across macOS APFS volumes, case sensitivity settings, and Linux ext4/xfs). Since CocoaPods evaluates the podspec at install time, the resulting array order differs between machines, producing different spec checksums.

# Before
spec.private_header_files = Dir.glob(all_header_files) - Dir.glob(public_header_files)

# After
spec.private_header_files = Dir.glob(all_header_files).sort - Dir.glob(public_header_files).sort

Fix 2: Use Pods-relative path in hermes-engine.podspec

require.resolve with __dir__ resolves to an absolute path containing the developer's home directory (e.g., /Users/alice/project/node_modules/...). This absolute path gets baked into user_target_xcconfig, which differs per machine.

Replaced with $(PODS_ROOT)/../../node_modules/hermes-compiler/hermesc/osx-bin/hermesc — a Pods-relative Xcode build variable that resolves at build time instead of pod install time.

Changelog:

[IOS] [FIXED] - Make Podfile.lock SPEC CHECKSUMS deterministic across machines by sorting Dir.glob results in Yoga.podspec and using a Pods-relative path in hermes-engine.podspec

Test Plan

  1. Run pod install on machine A, record Podfile.lock
  2. Run pod install on machine B (different username/home directory)
  3. Verify SPEC CHECKSUMS are identical between both runs

We have verified this fix in our production app — after patching, running pod install consecutively produces zero diff in Podfile.lock.

Fixes #56975

Two sources of non-determinism cause Podfile.lock to differ between
machines, breaking `pod install --deployment` in CI:

1. Yoga.podspec: Dir.glob returns files in filesystem-dependent order.
   Add .sort to ensure consistent ordering regardless of OS/filesystem.

2. hermes-engine.podspec: require.resolve with __dir__ produces an
   absolute path containing the user's home directory. Replace with a
   $(PODS_ROOT)-relative path that resolves at build time instead.

Fixes facebook#56975

Co-authored-by: Cursor <cursoragent@cursor.com>
@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented May 27, 2026

Hi @IsaacIsrael!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented May 27, 2026

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 27, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label May 27, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented May 27, 2026

@fabriziocucci has imported this pull request. If you are a Meta employee, you can view this in D106499747.


spec.user_target_xcconfig = {
'HERMES_CLI_PATH' => "#{hermes_compiler_path}/hermesc/osx-bin/hermesc"
'HERMES_CLI_PATH' => '$(PODS_ROOT)/../../node_modules/hermes-compiler/hermesc/osx-bin/hermesc'
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.

his won't work with RNTester because RNTester doesn't have an iOS folder. This assumes that the structure is always:

app
|-> node_modules
|-> ios
    |-> Pods

But many apps might have different setups and layouts.

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Podfile.lock SPEC CHECKSUMS are non-deterministic across machines (Dir.glob ordering + absolute paths from __dir__)

2 participants