Repository navigation
Fix debug Buy scene crash on amount entry (RN attributed-string hash) - #6224
Conversation
There was a problem hiding this comment.
Claude Code Review
Claude Code Review is paused for this repository. To reconnect it, an admin of this repository's GitHub organization (or the account owner, for personal repositories) who can also manage your Claude organization's Code Review settings needs to re-link GitHub in Code Review settings. This is a one-time step.
Tip: disable this comment in your organization's Code Review settings.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Debug builds abort in the TextInput measure cache on the Buy scene. React Native 0.79.2 hashes an AttributedString::Fragment by its whole parent ShadowView (props, event emitter and state pointers), while equality compares only the tag and layout metrics. Two equal strings can then land in different buckets, and folly's F14 fallback set trips a debug-only FOLLY_SAFE_DCHECK when it finds the equal key by linear scan on a small cache. Backport the hash and equality changes from upstream react/react-native#50147 (in 0.80.0): hash the parent tag instead of the whole ShadowView, and include the base text attributes in both the AttributedString hash and equality. TextAttributes equality already covers textAlignVertical in 0.79.2, so that part of the upstream change is not needed.
359f0aa to
417ac87
Compare
There was a problem hiding this comment.
Claude Code Review
Claude Code Review is paused for this repository. To reconnect it, an admin of this repository's GitHub organization (or the account owner, for personal repositories) who can also manage your Claude organization's Code Review settings needs to re-link GitHub in Code Review settings. This is a one-time step.
Tip: disable this comment in your organization's Code Review settings.
Description
Asana task
Debug builds on the iOS simulator abort with SIGABRT when an amount is typed on the Buy scene. The crash is in React Native's text-measure cache:
safe_assert_terminateinEvictingCacheMap<AttributedString>::find, reached fromRCTTextLayoutManagermeasuring the TextInput.Root cause: React Native 0.79.2 hashes an
AttributedString::Fragmentby its whole parentShadowView(props, event emitter and state pointers), but fragment equality compares only the parent tag and layout metrics. Two equal attributed strings can land in different hash buckets. folly's F14 fallback set then finds the equal key by linear scan on a small cache (3 entries or fewer) and tripsFOLLY_SAFE_DCHECK, which is compiled only into debug builds.This backports the upstream fix from facebook/react-native#50147 (shipped in 0.80.0, not in any 0.79.x release) into the existing
patches/react-native+0.79.2.patch:ShadowViewAttributedStringhash and equality both include the base text attributesTextAttributesequality and hash already covertextAlignVerticalin 0.79.2, so that part of the upstream change is not needed. The upstreamoperator!=removals are a C++20 cleanup and are left out.Testing on the iOS simulator. Each entry logs in, opens Buy, types exactly 500 USD and holds for the quote while a liveness check runs:
hideKeyboardcannot close the decimal pad on its own, so these entries runhideKeyboardand then tap the keypad's Done bar, and the final frame shows the keypad closed. On develop code both crashes came during that dismissal, with the same stack as the baseline. On this branch the Done tap succeeded in all 10 entries with no crash.CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
none
Requirements
If you have made any visual changes to the GUI. Make sure you have:
Note
Low Risk
Native renderer patch only; production Release is unaffected, and the change aligns hash with equality rather than altering app business logic.
Overview
Fixes iOS Debug crashes when entering a buy amount by extending
patches/react-native+0.79.2.patchwith the upstream React Native fix (facebook/react-native#50147):AttributedStringequality and hashing now stay aligned (fragment hash uses the parent shadow tag instead of the wholeShadowView, and base text attributes participate in hash andoperator==). That stops the text-measurement cache from tripping a debug-only Folly assertion duringTextInputlayout on the Buy scene.The same patch hunk also caps shadow-tree commit retries (
MAX_COMMIT_ATTEMPTS_BEFORE_LOCKING) and routes commit locking through helper lock types—matching more of the upstream 0.80 renderer changes bundled with this backport.CHANGELOG: adds an Unreleased note for the iOS debug Buy amount-entry crash. Release builds are unchanged (assertions compiled out); impact is developer/simulator stability and slightly better cache behavior in production.
Reviewed by Cursor Bugbot for commit 417ac87. Bugbot is set up for automated code reviews on this repo. Configure here.
Test evidence
359f0aaBackport RN attributed-string hash fix
2026-09-27
1. fixed debug buy 500 quote under polling
2. fixed debug buy 500 quote unpolled
3. unfixed release buy 500 no crash
4. fixed debug buy 500 keyboard dismissed