fix: make an interrupted React-Core-prebuilt swap recoverable - #57831
Open
adityasingh2400 wants to merge 1 commit into
Open
fix: make an interrupted React-Core-prebuilt swap recoverable#57831adityasingh2400 wants to merge 1 commit into
adityasingh2400 wants to merge 1 commit into
Conversation
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.
|
@fabriziocucci has imported this pull request. If you are a Meta employee, you can view this in D114900617. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
replace-rncore-version.jswrites.last_build_configurationonly after it has already replacedReact.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 forProps,DebugStringConvertibleand 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 withENOENTon.last_build_configurationbecause 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 --checkis 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.