From 0612b160c49a3b995a70c0fe10e9737ceffe2f20 Mon Sep 17 00:00:00 2001 From: Kevin Gozali Date: Mon, 27 Apr 2026 15:03:30 -0700 Subject: [PATCH] Delete obsolete MountingIntermediateCommits-itest.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: This test file contains a single `it.skip` test guarded by the comment "Enable once synchronous C++ state updates are re-introduced." That feature was deleted entirely (not just disabled) since 2025-07-15, with the reason: *"The current design of enableSynchronousStateUpdates is not correct and breaks `` on Android. let's delete it. Findings: A scan of `packages/react-native/src/private/featureflags`, `scripts/featureflags`, and `ReactCommon/react/featureflags` returns no replacement flag for synchronous C++ state updates. The `enableSynchronousStateUpdates` flag was removed from every layer (JS config, C++, Android Kotlin/JNI, iOS overrides, MC schemas) and the guarded code path in `EventQueue.cpp` was deleted as well. Empirical confirmation: Removed the `it.skip` and ran the test 10x via stress runs. All 10 runs failed deterministically. The test is asserting the *presence* of the bug — i.e., that an intermediate state mutation leaks through when a UI-thread commit pulls transactions from an in-flight JS commit. Without the synchronous-state-updates codepath, that leak no longer occurs, so the test's expected log never matches the actual output: Expected: [Update ScrollView, Update intermediate-state-should-not-be-visible, Update view] Actual: [Update view, Update ScrollView] The test cannot be un-skipped (the bug it documents is no longer reproducible), and rewriting the assertion would defeat the purpose of the test. Deleting it. Changelog: [Internal] Differential Revision: D102661539 --- .../MountingIntermediateCommits-itest.js | 121 ------------------ 1 file changed, 121 deletions(-) delete mode 100644 packages/react-native/src/private/renderer/mounting/__tests__/MountingIntermediateCommits-itest.js diff --git a/packages/react-native/src/private/renderer/mounting/__tests__/MountingIntermediateCommits-itest.js b/packages/react-native/src/private/renderer/mounting/__tests__/MountingIntermediateCommits-itest.js deleted file mode 100644 index 2929299384c5..000000000000 --- a/packages/react-native/src/private/renderer/mounting/__tests__/MountingIntermediateCommits-itest.js +++ /dev/null @@ -1,121 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment'; - -import type {HostInstance} from 'react-native'; - -import * as Fantom from '@react-native/fantom'; -import * as React from 'react'; -import {useLayoutEffect, useState} from 'react'; -import {ScrollView, View} from 'react-native'; - -function TestComponent({ - triggerIntermediateState, - simulateUIThreadCommit = false, -}: { - triggerIntermediateState: boolean, - simulateUIThreadCommit?: boolean, -}): React.Node { - const scrollViewRef = React.useRef(); - const [intermediateStateTriggered, setIntermediateStateTriggered] = - useState(false); - - useLayoutEffect(() => { - if (triggerIntermediateState) { - setIntermediateStateTriggered(true); - } else { - setIntermediateStateTriggered(false); - } - - // Simulate a commit from the IU thread after the commit that triggered - // this after, but before the commit that processes the state update in - // this effect. - if (simulateUIThreadCommit) { - Fantom.runOnUIThread(() => { - Fantom.enqueueScrollEvent(scrollViewRef, {x: 0, y: 10}); - }); - } - }, [simulateUIThreadCommit, triggerIntermediateState]); - - const isIntermediateState = - triggerIntermediateState && !intermediateStateTriggered; - - return ( - - - - ); -} - -/** - * This test describes an existing bug in Fabric where synchronous commits done - * in the UI thread can incorrectly apply mutations for intermediate commits - * from the JavaScript thread. - */ -describe('Mounting intermediate commits', () => { - // Enable once synchronous C++ state updates are re-introduced. - // eslint-disable-next-line jest/no-disabled-tests - it.skip('happens when commiting from the UI thread (bug)', () => { - const root = Fantom.createRoot(); - - Fantom.runTask(() => { - root.render(); - }); - - expect(root.takeMountingManagerLogs()).toEqual([ - 'Update {type: "RootView", nativeID: (root)}', - 'Create {type: "ScrollView", nativeID: "parent"}', - 'Create {type: "View", nativeID: (N/A)}', - 'Create {type: "View", nativeID: "view"}', - 'Insert {type: "View", parentNativeID: (N/A), index: 0, nativeID: "view"}', - 'Insert {type: "View", parentNativeID: "parent", index: 0, nativeID: (N/A)}', - 'Insert {type: "ScrollView", parentNativeID: (root), index: 0, nativeID: "parent"}', - ]); - - Fantom.runTask(() => { - root.render(); - }); - - expect(root.takeMountingManagerLogs()).toEqual([ - 'Update {type: "View", nativeID: "view"}', - ]); - - Fantom.runTask(() => { - root.render(); - }); - - expect(root.takeMountingManagerLogs()).toEqual([]); - - Fantom.runTask(() => { - root.render( - , - ); - }); - - expect(root.takeMountingManagerLogs()).toEqual([ - 'Update {type: "ScrollView", nativeID: "parent"}', - // This should not happen and it's only visible because the update in the - // scroll view in the UI thread pulls the transactions from this - // intermediate commit. - 'Update {type: "View", nativeID: "intermediate-state-should-not-be-visible"}', - 'Update {type: "View", nativeID: "view"}', - ]); - }); -});