react-native-community / rn-diff-purge

Easier React Native upgrades by clearly exposing changes from a version to another. :rocket: And what better way than to purge, init, then diff? Spoiler: there's no better way. ๐Ÿ˜Ž
https://react-native-community.github.io/upgrade-helper
MIT License
1.26k stars 76 forks source link

0.74.0 diff was generated as empty #73

Closed cortinico closed 5 months ago

cortinico commented 5 months ago

Yesterday, during the release of 0.74.0, we faced an incident where the diffs for such version where generated as empty.

The upgrade helper looked as follows:

Screenshot 2024-04-22 at 17 31 34

Root Cause Investigation

Apparently the reason was that the RnDiffApp was empty.

Specifically the release/0.74.0 branch was generated, but the RnDiffApp was a git submodule (why?). Here the commit where the RnDiffApp for 0.74.0 was generated:

https://github.com/react-native-community/rn-diff-purge/commit/2ce7e79a4cdde1600f429af9a9818745509cff14

I'm unsure why this happened, but we'll need to investigate further, as this could affect future releases.

Remediation

I've force pushed release/0.74.0 to the HEAD of release/0.74.0-rc.9 + I've applied manually the changes to patch the template. See https://github.com/react-native-community/rn-diff-purge/commits/release/0.74.0/

I've also had to regenerate the diffs for all the react-native version, which was really painful as we have 180K diffs (I believe they should be pruned, as generating the diff from 0.20.0 to 0.74.0 is pointless at this stage).

I had to manually force the diff re-creation in this way: https://github.com/react-native-community/rn-diff-purge/commit/4ff103a9cdb0532bb63395116bd1bd3fa9e27369

I've reverted my commit on main to force diff recreation.

Can we fix this for good?

cortinico commented 5 months ago

cc @pvinis

pvinis commented 5 months ago

Hm, the submodule thing is weird. I will investigate a bit.

Good to know that just regenerating fixed this ๐Ÿ‘.

Also, pruning is a nice idea. maybe generating back to like 10 minor version for each new is something that would help so that 0.20->0.74 doesnt happen, and if you do need to do this jump, you do it like 0.20->0.30->0.40->....->0.70->0.74.

Or do you mean removing any diff older than some version X.Y.Z?

cortinico commented 5 months ago

Or do you mean removing any diff older than some version X.Y.Z?

I think we could just remove everything from this repo that is older than 0.50 The problem is also that git cloning and checking out the diffs branch takes 10 minutes

pvinis commented 5 months ago

On it ๐Ÿ‘. No need to archive anywhere, if we need them, they will be on the history.

pvinis commented 5 months ago

Ok, updating here with what I did, and closing the issue. Anything else, please ping me.

Basically at some point (I'm guessing very recently) when running npx react-native init, a git repo is generated for you. Either the template or the cli. When the new-release.sh script was running, it starts a new branch for the new release, and runs npx react-native init. Before it was not creating a git repo, so we could just git add all files and then run the diffs, but now we need to rm -rf the newly created .git dir within that newly init-ed app, and then continue with our flow as normal. Added line: https://github.com/react-native-community/rn-diff-purge/blob/master/scripts/new-release.sh#L60

cortinico commented 5 months ago

Amazing thanks for fixing it so quickly @pvinis ๐Ÿ‘