Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Risky cherry-pick step in release guide (LTS) #771

Closed
targos opened this issue Aug 16, 2022 · 8 comments
Closed

Risky cherry-pick step in release guide (LTS) #771

targos opened this issue Aug 16, 2022 · 8 comments

Comments

@targos
Copy link
Member

targos commented Aug 16, 2022

While promoting the v16.17.0 release today, I checked the diff after cherry-picking the release commit to main (to verify I resolved the conflicts correctly) and found out that the cherry-pick can end up modifying the wrong lines!
It happened in test.md and I think there are two causes:

  • added: sections always consist of the same 5 identical lines
  • More APIs were added to the documentation between me updating the staging branch and the release being promoted.

What happened is that the cherry-pick modified added: lines that are not in a v18.x release yet (so no conflict was generated).
I don't know if we can do something about it at the Git level to avoid the mistake.

@targos
Copy link
Member Author

targos commented Aug 16, 2022

Here's the state of the repo right after doing git cherry-pick 16.x^: targos/node@d6880e5

You can see for example that it changed the added: for --snapshot-blob=path (which doesn't exist in the release) instead of --test:

image

@RafaelGSS
Copy link
Member

@targos would you mind providing the workflow you used to diff and check if the patch is correct? I believe this information is pretty relevant to reside in our release tutorial.

@targos
Copy link
Member Author

targos commented Aug 16, 2022

I used VSCode. See the screen recording below.

I hope that we can solve the issue without having to ask the releasers to always check the diff though.

Screen.Recording.2022-08-16.at.14.53.16.mov

@ruyadorno
Copy link
Member

ruyadorno commented Aug 26, 2022

Cherry-picking is inherently risky, given that we're taking a changeset that comes from a given state and applying that to a (possibly) very different state.

That said, I've hit a similar type of problem with my latest (Current) release, so while it might not be exactly the same type of problem, I do wonder if by adding this step in the guide would have avoided (or helped with) your issue here.

richardlau added a commit to richardlau/node-1 that referenced this issue Dec 14, 2022
When cherry-picking the release commit for Node.js 16.19.0 to the `main`
branch git updated the metadata for the wrong item in `doc/api/test.md`.
The incorrectly updated item has been fixed in a subsequent commit (the
merge for the 19.3.0 release commit). This commit updates the intended
item that should have been updated when the 16.19.0 release commit was
merged.

Refs: nodejs#45506 (comment)
Refs: nodejs/Release#771
@richardlau
Copy link
Member

Another example: nodejs/node#45863
When I merged nodejs/node@2adea16 into main the first change had (correctly) a merge conflict which I fixed up before landing. The second change applied without conflict but to the wrong item and I didn't catch that.

@richardlau
Copy link
Member

richardlau commented Dec 14, 2022

I tried a different diff algorithm for the 16.19.0 cherry-pick (onto nodejs/node@c7946b1 which was the parent commit):

git cherry-pick --strategy-option=diff-algorithm=patience v16.x^

which resulted in this diff for doc/api/test.md (correctly updating the metadata for TapStream):

diff --cc doc/api/test.md
index 169c657994,680cd29dd5..0000000000
--- a/doc/api/test.md
+++ b/doc/api/test.md
@@@ -457,7 -319,7 +457,11 @@@ test('spies on an object method', (t) =
  ## `run([options])`

  <!-- YAML
++<<<<<<< HEAD
 +added: v18.9.0
++=======
+ added: v16.19.0
++>>>>>>> 2adea16e39... 2022-12-13, Version 16.19.0 'Gallium' (LTS)
  -->

  * `options` {Object} Configuration options for running tests. The following
@@@ -1050,7 -597,7 +1054,11 @@@ set to `true`
  ## Class: `TapStream`

  <!-- YAML
++<<<<<<< HEAD
 +added: v18.9.0
++=======
+ added: v16.19.0
++>>>>>>> 2adea16e39... 2022-12-13, Version 16.19.0 'Gallium' (LTS)
  -->

  * Extends {ReadableStream}

The patience algorithm is described up to git 2.33.0 (later versions change this text to say it is is a deprecated synonym for diff-algorithm=patience) as:

patience
With this option, merge-recursive spends a little extra time to avoid mismerges that sometimes occur due to unimportant matching lines (e.g., braces from distinct functions). Use this when the branches to be merged have diverged wildly. See also git-diff[1] --patience.

I'll open a PR to update the release process docs.

Refs: https://git-scm.com/docs/git-cherry-pick#Documentation/git-cherry-pick.txt--Xltoptiongt
Refs: https://git-scm.com/docs/git-merge#Documentation/git-merge.txt-diff-algorithmpatienceminimalhistogrammyers

richardlau added a commit to richardlau/node-1 that referenced this issue Dec 14, 2022
Switch to the `patience` git diff algorithm to reduce the likelihood of
mismerges when the release commit is cherry-picked to the `main` branch.

Refs: nodejs/Release#771 (comment)
@richardlau
Copy link
Member

I'll open a PR to update the release process docs.

nodejs/node#45864

richardlau added a commit to richardlau/node-1 that referenced this issue Dec 15, 2022
When cherry-picking the release commit for Node.js 16.19.0 to the `main`
branch git updated the metadata for the wrong item in `doc/api/test.md`.

Refs: nodejs#45506 (comment)
Refs: nodejs/Release#771
nodejs-github-bot pushed a commit to nodejs/node that referenced this issue Dec 16, 2022
When cherry-picking the release commit for Node.js 16.19.0 to the `main`
branch git updated the metadata for the wrong item in `doc/api/test.md`.

Refs: #45506 (comment)
Refs: nodejs/Release#771
PR-URL: #45863
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Tierney Cyren <hello@bnb.im>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
nodejs-github-bot pushed a commit to nodejs/node that referenced this issue Dec 16, 2022
Switch to the `patience` git diff algorithm to reduce the likelihood of
mismerges when the release commit is cherry-picked to the `main` branch.

Refs: nodejs/Release#771 (comment)
PR-URL: #45864
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
targos pushed a commit to nodejs/node that referenced this issue Jan 1, 2023
Switch to the `patience` git diff algorithm to reduce the likelihood of
mismerges when the release commit is cherry-picked to the `main` branch.

Refs: nodejs/Release#771 (comment)
PR-URL: #45864
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
juanarbol pushed a commit to nodejs/node that referenced this issue Jan 26, 2023
Switch to the `patience` git diff algorithm to reduce the likelihood of
mismerges when the release commit is cherry-picked to the `main` branch.

Refs: nodejs/Release#771 (comment)
PR-URL: #45864
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
@ruyadorno
Copy link
Member

Closing this issue since we already landed two improvements to the docs that will hopefully avoid this issue again in the future.

Feel free to reopen if anyone hits it again or wants to discuss more 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@ruyadorno @targos @richardlau @RafaelGSS and others