fix: Fix native matchVersion not allowing patch version mismatches#9018
Merged
tjzel merged 1 commit intoFeb 26, 2026
Merged
Conversation
kitten
force-pushed
the
@kitten/fix/native-version-majmin-comparator
branch
from
February 26, 2026 14:17
c43d73b to
d834760
Compare
While this looked correct and we looked at this for the SDK 54 release in September, we again found warnings when the patch versions mismatch, and assume that when we reviewed this, we missed something. Coming back to this and looking closer, the old code compared `std::smatch` directly against each other from both searches. However, `std::smatch` is an iterator, and, presumably, the comparison is iterating all values and comparing them. The string at the zero-index, like in JS, is a full match string. If that match string contains the full `version` string, then the comparison can never succeed. This means that this was always comparing exact version matches rather than allowing patch versions to differ. Instead, the new version matches two explicit groups on major and minor versions for clarity, then compares index 1 and 2's (match 1 and 2's ) strings.
kitten
force-pushed
the
@kitten/fix/native-version-majmin-comparator
branch
from
February 26, 2026 14:17
d834760 to
3fbfefb
Compare
tjzel
approved these changes
Feb 26, 2026
tjzel
left a comment
Collaborator
There was a problem hiding this comment.
I tested and all works well!
Contributor
Author
|
I updated the test plan. I also checked the check still fails when the minor version mismatches, as expected, to make sure the check isn't a noop 👍 |
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
While this looked correct and we looked at this for the SDK 54 release in September, we again found warnings when the patch versions mismatch, and assume that when we reviewed this, we missed something.
Coming back to this and looking closer, the old code compared
std::smatchdirectly against each other from both searches. However,std::smatchis an iterator, and, presumably, the comparison is iterating all values and comparing them. The string at the zero-index, like in JS, is a full match string. If that match string contains the fullversionstring, then the comparison can never succeed.This means that this was always comparing exact version matches rather than allowing patch versions to differ.
Instead, the new version matches two explicit groups on major and minor versions for clarity, then compares index 1 and 2's (match 1 and 2's ) strings.
Test plan
react-native-reanimated@4.2.2andreact-native-worklets@0.7.2react-native-reanimated@4.2.1andreact-native-worklets@0.7.4package.jsonto bump minorjsVersionto bump minor