Skip to content

fix: make an interrupted React-Core-prebuilt swap recoverable - #57831

Open
adityasingh2400 wants to merge 1 commit into
react:mainfrom
adityasingh2400:fix-57598-rncore-swap-marker
Open

fix: make an interrupted React-Core-prebuilt swap recoverable#57831
adityasingh2400 wants to merge 1 commit into
react:mainfrom
adityasingh2400:fix-57598-rncore-swap-marker

Conversation

@adityasingh2400

Copy link
Copy Markdown

Summary

replace-rncore-version.js writes .last_build_configuration only after it has already replaced React.xcframework, so a build cancelled between those two steps leaves the marker naming a flavor that is no longer on disk, and when the marker is absent entirely the script assumes the on-disk flavor is Debug. Either state makes the next build for that configuration take the "no need to replace" path and link against the other configuration's core, which fails with undefined C++ symbols for Props, DebugStringConvertible and the Fabric vtables, and nothing corrects it afterwards because the pod directory survives a clean.

This change writes the marker before the framework is touched, using a value that is not a valid configuration, so a later run can tell that the previous swap did not finish and replaces again. The fresh install path now also records the configuration it assumed instead of leaving that state implicit, which is sound because a swap can no longer leave the marker missing.

Fixes #57598.

Changelog:

[IOS] [FIXED] - Recover React-Core-prebuilt configuration swaps that were interrupted before the marker was updated

Test Plan

Four new cases in packages/react-native/scripts/__tests__/replace-rncore-version-test.js, driven through the real CLI entry point the podspec [RNCore] build phase uses, so no new export was needed and the production diff is logic only. Against unmodified upstream two of them fail, one with ENOENT on .last_build_configuration because the skip path never wrote the marker, and one showing the marker still naming the stale flavor after a failed swap. With the change the file is 8 passed, including all 4 pre-existing tests. prettier --check is clean on both files.

The actual iOS link failure needs a prebuilt-core CocoaPods install and an Xcode build, so that was not reproduced locally.

replace-rncore-version.js wrote .last_build_configuration only after it had
already replaced React.xcframework. A build cancelled between the two steps
left the marker naming a flavor that was no longer on disk, and when no marker
was present at all the script assumed the on-disk flavor was Debug. Either way
the next build for that configuration took the "no need to replace" path and
linked against the other configuration's core, which fails with undefined C++
symbols. Nothing corrected the state afterwards, including a clean, because the
pod directory survives it.

The marker is now written before the framework is touched, holding a sentinel
that is not a valid configuration, so a run that finds it knows the previous
swap did not finish and replaces again. The fresh install path also records the
configuration it assumed instead of leaving that state implicit, which is sound
because a swap can no longer leave the marker missing.
@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 Aug 5, 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 Aug 5, 2026
@meta-codesync

meta-codesync Bot commented Aug 5, 2026

Copy link
Copy Markdown

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

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

1 participant