Repository navigation
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. LLM Linter (✨ experimental)Possible typos and grammar issues:
2026-09-23 10:42:46 |
|
I'm not sure. We sometimes cherry-pick commits from the subtree if they contain fixes that need backporting. Is this really solving a problem? |
|
In some rare cases it is required to adjust the code for the subtree bump in the merge commit itself (to avoid build failures on the merge commit itself), so that would warn in that case and somehow encourage build failures? Also, can you explain how this simplifies "backport"? IIUC you are referring to merging the subtree merge commit as-is into several branches? I think this is nice, and good to keep in mind, but the alternative of having a second similar subtree merge (with only the commit id different) on the backport branch is also fine and harmless? |
|
And it was specifically suggested here: #33439 (comment)
|
I did that in the last update commit (fa911d8). I guess in theory one could even come up with a copy-pasteable scripted-diff to mark/check such commits. Something like: $ ./test/lint/commit-script-check.sh HEAD~..HEAD
Running script for: 84868e9b2c96a14a49cec4a8b30e95bb8857d720
# Verify last commit is also the last merge subtree commit
[ "$( git log -1)" == "$( git log -1 src/ipc/libmultiprocess )" ]
git merge 6d5f753921578eefdd3fce64cfc8ee7951b6cbc4 -m 'dummy'
Merge made by the 'ort' strategy.
src/ipc/libmultiprocess/doc/versions.md | 44 ++++++++++++++++++++++++--------------------
src/ipc/libmultiprocess/include/mp/type-data.h | 3 ++-
src/ipc/libmultiprocess/include/mp/version.h | 2 +-
src/ipc/libmultiprocess/test/mp/test/foo.capnp | 9 ++++++++-
src/ipc/libmultiprocess/test/mp/test/foo.h | 4 +++-
src/ipc/libmultiprocess/test/mp/test/test.cpp | 23 +++++++++++++++++------
6 files changed, 55 insertions(+), 30 deletions(-)
OK
$ git log
commit 84868e9b2c96a14a49cec4a8b30e95bb8857d720 (HEAD)
Merge: a9d1b652f3 6d5f753921
scripted-diff: ipc: Merge libmul subtree update
-BEGIN VERIFY SCRIPT-
# Verify last commit is also the last merge subtree commit
[ "$( git log -1)" == "$( git log -1 src/ipc/libmultiprocess )" ]
git merge 6d5f753921578eefdd3fce64cfc8ee7951b6cbc4 -m 'dummy'
-END VERIFY SCRIPT-
This way, each commit can opt-in or out, and enforce it. But 🤷♂️ |
|
@maflcko I'm mainly concerned about the author forgetting to do this, and the reviewer(s) forgetting to check. That's what this linter fixes. Presumably both the author and reviewer will run this script. If the author didn't forget, they can just suggest that reviewers confirm that cc @ryanofsky |
ryanofsky
left a comment
There was a problem hiding this comment.
Code review ACK 4ace058. I think having the warning is better than not having it, but a stricter approach would seem better here.
The only reason this check should not be satisfied is when subtree and bitcoin core changes are incompatible. The script could trigger an error instead of warning if that's not the case. Also:
- The warning text seems potentially confusing and hard to act on because it doesn't say what the mismatched hashes mean.
- The documentation seems vague when it says to use the previous subtree "when possible" and because "this makes backporting easier." It should say more specifically when to stack on the subtree and how it does makes backporting easier.
- Skipping this check when the subtree commit is not the
HEADcommit seems confusing. Previously the script could find the most recent subtree update by itself and perform a full check. Now it only does a partial check unless it is explicitly given the subtree merge commit hash (or that commit happens to be checked out).
Suggestion: I think a variation of this PR 15b44bf would address all these concerns
Also marco's verify script idea #35686 (comment) seems interesting. It's awkward because the script it is running is non-trivial and includes a hardcoded hash, but could be simplified if the scripted diff called another script in the repository.
Replace getopts with explicit argument parsing, and give -r a long option --remote. The next commit adds another long option. Co-authored-by: Ryan Ofsky <[email protected]>
4ace058 to
5b8973e
Compare
|
@ryanofsky thanks, I took your version, but added an error if I split the options handling refactor into a separate commit. Also added |
There was a problem hiding this comment.
Code review ACK 5b8973e. Thanks for the updates. New commit split makes this easier to review and I think the script messages and documentation are easier to understand now.
The main benefit I see to this PR is just documenting the practice of basing new subtrees updates on previous updates, which is nice because it allows the same update commits to be merged into multiple branches, saving reviewer effort. The PR also makes this condition easy for reviewers to check by running the normal linter command.
Note: The new linter --incompatible option could be dropped in the future by requiring a stricter commit message format for subtree merge commits, requiring a tag in the merge commit messages to indicate whether the merged changes are not compatible and should be allowed to use a newer base. But for now I think having the option is better, because it makes it straightforward for reviewers and authors to check the stricter base condition now, without requiring the stricter condition to be imposed on all subtrees going forward.
re: sedited #35686 (comment)
We sometimes cherry-pick commits from the subtree if they contain fixes that need backporting. Is this really solving a problem?
Wow I didn't know this was done. Apparently this is implemented by disabling the subtree check entirely. Examples:
This can make sense when there is an isolated fix that needs to be cherry-picked, but it requires more manual review.
This PR is primarily trying to address a different use-case, when there are wider improvements like stability fixes in the subtree that you want to backport to multiple release branches without requiring the same changes to be reviewed multiple times. Being able to merge the same commit hash into multiple branches is especially nice in that case. (It could be useful for cherry-picks too, but that's not the aim.)
|
|
||
| ```sh | ||
| git fetch libmultiprocess | ||
| git checkout <previous subtree merge commit> |
There was a problem hiding this comment.
In commit "lint: have git-subtree-check check for backportability" (5b8973e)
Note sure whether the following is a good idea because it makes the document more verbose, but we could mention a way to check out the right base commit:
previous_subtree_merge=$(git log -1 --pretty=%H src/ipc/libmultiprocess)
git checkout "$previous_subtree_merge"I think I'd lean towards keeping the current version for now though to keep the example simple.
There was a problem hiding this comment.
Going to leave this alone for now.
There was a problem hiding this comment.
I think the suggested change should be applied. Otherwise, it is harder to copy-paste the instructions here and they'll have to be figured out fresh on each invocation.
There was a problem hiding this comment.
ACK 5b8973e
Tested the new backportability check:
- fa911d8: GOOD: correctly stacked; first parent is the previous subtree merge a9d1b65
- 02afa66: ERROR: first parent is not the previous subtree merge 2063f02.
This matches the intended behaviour. Also verified that --incompatible correctly suppresses the check.
|
Any reviewers who had hesitation about this PR earlier have feedback about the latest version? I think this change is practically useful because the condition it is checking for is difficult to verify without a script. It also includes good documentation updates, and the error message ("subtree contents are valid, but [...] the subtree update may not be possible to backport directly to release branches") should be clearer now than it was before. |
I'm still not sure about the current |
|
Yeah, just doing the few-line doc update here in this pull should be sufficient? If not, then it can always be re-visited in the future. Also, it seems odd to add all this logic and Bash overhead for something that is basically a mostly irrelevant style preference. |
|
@sedited I would be fine with making I think the use cases are, in order of frequency:
For (1) the default doesn't matter. Changing the default would perhaps reduce confusion for (3), and slightly increase the odds of (2) missing the preference. |
This is intentional. Most subtree updates don't involve backwards incompatible API changes, so the new check and the new instructions are meant to encourage subtree bumps that can be directly backported with the same commit hash and more easily reviewed. This is better than the current behavior of bumping multiple times for different release branches, or disabling the subtree check in release branches (for example 53a5c7f, see #35686 (review)) when changes need to be backported. If there is a reason you think cleaner backports can't or shouldn't be used though, we can reverse the default behavior here. If we do that I would suggest naming the inverse option something like
The message says the subtree contents are valid but the changes can't be directly backported to release branches. If you think the error message isn't clear maybe we can improve it? I don't see a reason to hide this information, and don't think the current output is hard to understand. |
Not sure why this is being brought up here, as it is unrelated for several reasons:
As mentioned in my prior comment, the changes here are purely of stylistic nature and won't have any effect on the source code contents of this repo. Again, I think it would be better to just change the |
|
|
||
| ```sh | ||
| git fetch libmultiprocess | ||
| git checkout <previous subtree merge commit> |
There was a problem hiding this comment.
I think the suggested change should be applied. Otherwise, it is harder to copy-paste the instructions here and they'll have to be figured out fresh on each invocation.
There are 4 ways to update a subtree in a release branch: 1-merge an existing subtree bump commit from master, 2-create a new subtree bump commit specifically for that release branch. 3-cherry pick a change into a subtree and disable the linter. 4-edit the subtree directly and disable the linter. These approaches are all different ways to accomplish the same thing, therefore they are related. Also I did not bring up cherrypicking, it was brought up earlier here: #35686 (comment). IMO this approaches form a spectrum where the first is more reviewable and transparent and the last is the hardest to review and least transparent. This PR is a small, harmless nudge towards the earlier part of the spectrum, therefore I have ACKed it and would encourage others to review or weigh in with their opinions here. |
|
Right, but 1 and 2 are equally trivial to review. The harder part are 3 and 4. This pull is only about a possible improvement to 1 and 2. |
|
Also the reason I don't think the documentation change change is as important as the script change, is that creating a subtree bump that can be directly backported is trivial. Testing if a bump commit was created in right way is a lot more tricky. Or at least I don't know what straightforward git commands let you check this. So having the check in the subtree linter makes sense to me because it makes something complicated and annoying easy. I don't care very much if the check is turned on by default, though I do think it would be nice to turn on by default, since it seems like something that could increase transparency and decrease review burden. |
A simple Also, a simple Also, I am sure an LLM can find a third way, or help with the prior step. In any case, if way-1 falls back to way-2, it is harmless. There is no need to have a script for this. I don't see why something so trivial needs so much code or even effort that all needs to be maintained in the future (like #35980) I don't like nacking pulls, but to clarify, all my previous comments were trying to say: Approach NACK |
A subtree update PR is easier to backport when its merge commit is stacked on the previous subtree merge instead of on master. Have git-subtree-check.sh error when the latest subtree merge does not follow that structure. This is not always possible if changes in the subtree and Bitcoin Core code are not compatible, so it can be overridden with an --incompatible flag. Example without error: test/lint/git-subtree-check.sh src/ipc/libmultiprocess 66b4e30 Example with error: test/lint/git-subtree-check.sh src/ipc/libmultiprocess 02afa66 Co-authored-by: Ryan Ofsky <[email protected]>
5b8973e to
6dab31c
Compare
|
@maflcko wrote:
I think you're incorrectly assuming that most reviewers understand git as well as you do. Most mere mortals have to sit for ten minutes to wrap their heads around what an easy to backport subtree should look like. And they'll forget by the next time. Even to realize that something is not a problem takes mental effort. It's better to figure this out once, express it in a linter, and only require people to think about it (with guide from an LLM) when that linter complains. In terms of cumulative cognitive burden, that should outweigh the effort needed to occasionally maintain this script. It's not like git or our subtree workflow change frequently. Maintaining documentation (with lots of commands) is also more effort than maintaining scripts. The best way is probably an LLM that tries the instructions. |
There is no problem to solve, this is just a mostly irrelevant style preference. The set of devs that would spend mental effort to think this is a problem, but also don't understand
You are modifying the dev notes in this pull, along with scripts. I don't think any scripts or "verification" is needed here for a style preference that is harmless to get wrong. I think the 3 documented bash commands to bump the subtree are sufficient. |
|
@maflcko your input is valuable here but if you don't think this PR is solving a problem that is worth your time, it seems like you could just decline to review it. An approach nack that does not cite specific harms the PR would cause if merged is hard to react or respond to. If the current PR would negatively impact you or anyone else, what exactly is the negative impact? We've discussed numerous alternatives and variations above (default on vs. off, dropping On "no problem to solve" I don't think this is theoretical. Once people follow the new guidance to base updates on the previous subtree merge, it's easy for two non-identical subtree bumps to land on different branches unnoticed, because nothing today checks for that and nothing tells reviewers to check it by hand. |
I think the project is better off if more reviewers nack'd changes they don't like with a rationale. Of course, if a nack doesn't make sense, it is trivial to dismiss and ignore. However, discouraging nacks and telling reviewers to instead mute and walk away from harmful changes doesn't seem too useful.
Not sure why this was missed, but the negative impacts are:
This pull request doesn't change anything about that. Before and after this pull request, non-identical subtree bumps can land on different branches "unnoticed": I'll ignore that this script here isn't marked for backport, so I'll assume that reviewers will backport the script themselves and run it, and check that it is passing. However, the script only checks that the bump is backportable, not that it was backported.
So I think the goal here is to have identical commit IDs across branches. Checking that is a manual process before and after this pull request, so I don't think anything about that changes here. Also, literally the first comment on this pull explains that identical commit IDs won't be possible in all cases anyway (#35686 (comment)), so this seems like a case-by-case review anyway and not something that should be automated. Also, whether or not the commit ID of a subtree change is identical to some other commit ID should mostly be irrelevant, because what really matters is the source code that will be shipped to users. So reviewers should better spend time on reviewing that a backported subtree bump doesn't introduce incompatibility bugs in the old branch instead of distracting themselves with less relevant git metadata. The more I think about this, the stronger my NACK gets and I am slowly leaning toward a wholesale concept NACK instead of an approach NACK. |
|
Hi Marco, I think nacks are useful and I'm not trying discouraging them. I just couldn't figure out how this PR would harm you or anyone else, or cause any problems if merged. This PR seems to help increase quality and ease of reviews in an area where they seem a little weak (backports). It also cleans up linter code and adds an extra check that is difficult to perform by hand, printing clear and obvious output describing its results. One thing I would like to discourage is spending time debating benefits of PRs. If you don't think a PR is beneficial, you should definitely say that and make it clear. It is very clear that you don't think this PR is beneficial, and that is useful feedback, and it could be a good signal to close this PR, and for others not to review it, and to discourage future work in this area. And I don't have a problem with closing this PR, I just want to increase the quality of review discussion around this PR by trying to specifically identify any possible harms. Benefits of PRs are more subjective than harms because different people use different features of code and care about different aspects of it. The best way to adjudicate benefits, IMO, is for people to review PRs they are interested in, and if a PR attracts enough review for the type of change it is and does not cause harms, then it can be merged. Harms can almost always be discussed more objectively than benefits, especially if they are discussed with some specifics as in this type of person trying to do this action will be harmed because X will be the case instead of Y. Thank you for clarifying the harms you see. I guess I thought initially you were only opposed to the linter change here, not the documentation change, but now even the documentation change is bad, I guess because there are extra steps to run. And you think the linter extra check here is a maintenance burden and "will likely need to be reverted or reworked some time in the future." I don't really agree with either objection. I think the documentation is clear and simple because it literally gives you five lines of code you can paste. And it tells you how to run the linter which it didn't do before and chooses a good default base commit instead of leaving it unspecified. I also don't know why the new check would need to be changed or reverted later but maybe you can clarify what kind of scenario you have in mind. I might suggest though since this is such a low stakes area (a linter change) a better approach might not be to debate vaguely whether a change may break something in the future (when there is not a specific concern), but to just point out change seems fragile, and if it is actually is fragile, be gratified that you are right and have a very strong argument to remove it in the future if/when there is actually a real problem. Anyway thank you for the feedback, I was really only trying to clarify and understand it, and suggest a way to proceed without taking a lot of time debating very subjective concerns which are ultimately less important than more objective ones. |
|
Still kind of ~0 on this change, but also not really opposed. |
|
|
||
| Normally, the new subtree merge commit should be based on the previous subtree | ||
| merge commit, so if subtree changes need to be backported, the same commit can | ||
| be merged into release branches and the changes do not need to be rereviewed. |
There was a problem hiding this comment.
Please don't document that changes being merged into release branches don't need to be (re)reviewed.
Concept NACK. If there is a single practical (real) benefit of this change, it would be good just link to it. Subtrees have been used for many years, but the changes here wouldn't improve any situation in the past. If there is a theoretical improvement in 10 or 20 years in the future, this can trivially be added then, with a given rationale. To expand this a bit more, looking at all recent subtree updates:
Of course it is possible to come up with some imaginary use-case and then claim that this is harmless or even useful. When it is quite obvious that the change is harmful. However, I think it would be better to focus on real problems where one can measure and see the impact. |
I don't think it's that far in the future. Once IPC is no longer experimental, which I'd like to propose after Windows support lands, changes to libmultiprocess that are breaking changes to clients, have to be shipped more carefully.
That's true, we could defer until then. And discuss then if this particular check matters. |



A subtree update is easier to backport when its merge commit is based on the previous subtree merge instead of on a newer
mastercommit. The exact same merge commit can then be reused on release branches, making the backport trivial to verify without rereviewing a newly generated subtree merge.Update
git-subtree-check.shto locate the merge that introduced the latest subtree squash reachable fromCOMMITand error if its first parent is not the previous subtree merge.Sometimes subtree and Bitcoin Core API changes are incompatible, making it necessary to base an update on a later commit. Add
--incompatibleto explicitly skip the backportability check in that case.The CI lint job always sets
--incompatible, so we rely on reviewers to run the new check.As a preparatory refactor, replace
getoptswith explicit option parsing and add--remoteas the preferred long alias for-r.Example that passes:
Example that errors because the update is not based on the previous subtree merge: