Skip to content

Conversation

@emily8rown
Copy link
Contributor

@emily8rown emily8rown commented Dec 8, 2025

Not for merging

Summary:

Experiment to reproduce false positive breaking changes bot reactNativeApi.d.ts
Example commit 79b09ce added new api to reactNativeApi
so this branch checked out 630f80c (the commit just before)
Danger bot checks look like we have removed api despite not touching it

Changelog:

[GENERAL] [FIXED] - Message

Test Plan:

@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 Dec 8, 2025
@react-native-bot
Copy link
Collaborator


Warnings
⚠️ ❗ JavaScript API change detected - This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API. Please include a clear changelog message. This change will be subject to extra review.

This change was flagged as: BREAKING

Generated by 🚫 dangerJS against ee93b6c

@emily8rown emily8rown closed this Dec 8, 2025
meta-codesync bot pushed a commit that referenced this pull request Dec 10, 2025
…54819)

Summary:
Updates the `diff-js-api-breaking-changes` action to compare the PR's changes against the merge base (where the branch diverged from main) instead of the current tip of main.

### Problem
The previous implementation compared the current state of `main` to the PR head. This could produce false positive results when main had new commits to reactNativeApi.d.ts reporting breaking changes from main as if they were introduced by the PR.

### Solution
- Calculate the merge base between the PR head and `origin/main`
- Compare the API snapshot at the merge base to the snapshot at the PR head

## Changelog:

[GENERAL] [FIXED] - Updates the `diff-js-api-breaking-changes` action to compare the PR's changes against the merge base (where the branch diverged from main) instead of the current tip of main.

Pull Request resolved: #54819

Test Plan:
(outputs shown for #54815)
Tested locally on branch that previously got false positive:
Mirror old approach:
```
mkdir -p /tmp/api-diff-old
git show origin/main:packages/react-native/ReactNativeApi.d.ts > /tmp/api-diff-old/before.d.ts
git show HEAD:packages/react-native/ReactNativeApi.d.ts > /tmp/api-diff-old/after.d.ts
node ./scripts/js-api/diff-api-snapshot /tmp/api-diff-old/before.d.ts /tmp/api-diff-old/after.d.ts
```
output:
```
{
  "result": "BREAKING",
  "changedApis": [
    "ActivityIndicatorProps",
    "Animated",
    "DrawerLayoutAndroidProps",
    "FlatList",
    "FlatListProps",
    "ImageBackground",
    "ImageBackgroundProps",
    "ImageProps",
    "ImagePropsBase",
    "KeyDownEvent",
    "KeyEvent",
    "KeyUpEvent",
    "KeyboardAvoidingView",
    "KeyboardAvoidingViewProps",
    "ModalProps",
    "PressableProps",
    "ProgressBarAndroidProps",
    "RefreshControl",
    "RefreshControlProps",
    "ScrollViewProps",
    "SectionList",
    "SectionListProps",
    "SwitchProps",
    "TextInputProps",
    "ViewProps",
    "VirtualizedListProps",
    "VirtualizedSectionListProps"
  ]
}
```
Mirror new approach:
```
git fetch origin main
MERGE_BASE=$(git merge-base HEAD origin/main)
echo "Merge base: $MERGE_BASE"
mkdir -p /tmp/api-diff
git show $MERGE_BASE:packages/react-native/ReactNativeApi.d.ts > /tmp/api-diff/before.d.ts
git show HEAD:packages/react-native/ReactNativeApi.d.ts > /tmp/api-diff/after.d.ts
node ./scripts/js-api/diff-api-snapshot /tmp/api-diff/before.d.ts /tmp/api-diff/after.d.ts
```
output:
```
{
  "result": "NON_BREAKING",
  "changedApis": []
}
```

Reviewed By: huntie

Differential Revision: D88654826

Pulled By: emily8rown

fbshipit-source-id: 5dc2e295d7d527899b5cb6a643c4878aeebf7f0b
@emily8rown emily8rown reopened this Jan 20, 2026
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. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants