This is intended as a continuation of previous discussions around code review on GitHub, in light of the GitHub support for the pull request stack as a reified object in their code review model.
It seems like GitHub has chosen to codify:
- The requirement that stacked PR head branches be pushed to the target repo (i.e. not to user forks)
- The requirement that the head branch of a “parent” PR in the stack is the same as the base branch of its “child” PR
- This means, in practice, that force pushes are required for just about every operation with the new stacked PRs
- Edit: as @jh7370 points out, there is also the option of letting the code of each PR diverge as changes are added to its “parents”, although it seems like (at least presently) there isn’t any way to automate this (or at the very least, the official
gh stackcannot do this)
We currently discourage force pushes (LLVM GitHub User Guide - Rebasing Pull Requests and Force Pushes) and AFAICT the new stack support doesn’t come with significant improvements to the problems that force pushing can cause for reviewers:
- By-line comments from the old versions of the PR branch generally lose their context, unless some narrow conditions are met (the line they reference not moving or being edited?)
- The link to “view reviewed changes” for those unmoored comments doesn’t show them in their original “reviewed” context: it either shows them in the latest version or can’t show them at all
- The “changes since you last reviewed” may break, and there is no way to compare versions of the PR
- Even if the relevant versions have not been garbage-collected, if there was an intervening rebase there is no way to see only the diff relevant to the PR in question (unless you use something like @nhaehnle’s diff-modulo-base or
git range-diff)
- Even if the relevant versions have not been garbage-collected, if there was an intervening rebase there is no way to see only the diff relevant to the PR in question (unless you use something like @nhaehnle’s diff-modulo-base or
Gerrit
In light of what I consider to be a pretty poor showing from GitHub on implementing the stack feature, I took a look at other options again. The one which seems the most viable to me is to support (but not require) using a hosted Gerrit for review of patch series. See Code Review Process Update - #23 by jyknight for some background from when this has been discussed before. The basic idea boils down to:
- PRs are still the “default”, and the on-ramp for new developers.
- If a change is easier to review in parts (e.g. an NFC refactor, followed by the core change, followed by an NFC “strangling fig” type cleanup) it can be reviewed on GerritHub.
- The GitHub PR can be “imported” into GerritHub, so the decisions doesn’t even need to be made ahead of time, the review can move to Gerrit as-needed.
- Once the review is complete on GerritHub, the result can be merged back into the Github PR.
- The PR can be merged in the usual way.
This flow would mean that there is still always a PR for every change going into the repo, it may just not contain all of the review comments and patch versions. I don’t think this really represents an issue, since GitHub tends to throw these artifacts away for stacks anyway. Also, if GerritHub is ever about to go away, we can always mirror the relevant reviews and host them read-only in the same way we have with Phabricator reviews.
In looking into this option, I came across CUE, which explicitly supports both GitHub PRs and GerritHub CLs.
It seems like LLVM could also get a subdomain just for our org; see https://cue.gerrithub.io/ where the CUE project works on GerritHub.
From looking at some Gerrit issues releated to GerritHub, along with what little discussion I could find online, it seems like support is very prompt and competent. I also think the risks are relatively small, in that the worst case scenario is that we just go back to exclusively PRs (where we are already).
The status quo on GitHub is abysmal in my experience, so I would be willing to take on the role of engaging with the GerritHub folks to get a better idea of how everything would work, if there is any interest in this.
