Page MenuHomePhabricator

Make the post-commit review expectations more explicit with respect to revert
ClosedPublic

Authored by mehdi_amini on Oct 22 2020, 4:36 PM.

Diff Detail

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
silvas accepted this revision.Oct 22 2020, 4:47 PM

Looks like my original proposal so LGTM. Please wait for some more folks to chime in though.

llvm/docs/CodeReview.rst
55

What is this ! that phab is showing in the UI? Looks like some non-ascii character?

This revision is now accepted and ready to land.Oct 22 2020, 4:47 PM

Remove non-ascii char

mehdi_amini marked an inline comment as done.Oct 22 2020, 5:18 PM
mehdi_amini added inline comments.
llvm/docs/CodeReview.rst
55

thanks! Strangely it does not print in git diff.

mehdi_amini marked an inline comment as done.Oct 22 2020, 5:18 PM
rengolin accepted this revision.Oct 23 2020, 1:57 AM
rengolin added a subscriber: rengolin.

This is a great policy, thanks @silvas and @mehdi_amini.

LGTM with one small change (inline).

llvm/docs/CodeReview.rst
57

I'd say "should undergo". The way it's written sounds like something that "happens" not something that "should happen".

sivachandra added inline comments.
llvm/docs/CodeReview.rst
49–51

The wording seems to imply that this would apply even for opinion driven disagreements. I would prefer a wording which implies something more concrete. Also, in a way, it seems like the post-commit review practice is in conflict with the wording here. As in, if concerns are raised post-commit, then the post-commit review practice requires the original author to address those concerns even post-commit. I would think a revert will only happen if the original author is not acting on/addressing the concerns. Even in such cases, the revert should be justified. An example justifiable reason can be that progress cannot be made with out a revert.

There are of course other obvious reasons to revert, but I am assuming that this discussion is not about those reasons.

mehdi_amini added inline comments.Oct 23 2020, 5:51 PM
llvm/docs/CodeReview.rst
49–51

The wording seems to imply that this would apply even for opinion driven disagreement

How to you handle this in pre-commit review? Feel free to suggest an alternative wording, but keep in mind the spirit (see below).

In general the mindset is that there shouldn't be a difference whether I express my opposition to a patch 10min before you want to push it or 10 min after you pushed it.

As in, if concerns are raised post-commit, then the post-commit review practice requires the original author to address those concerns even post-commit.

This is a case-by-case: if someone has the kind of concerns that would block a patch from landing (like design concerns), revert is the right approach I believe.

Even in such cases, the revert should be justified. An example justifiable reason can be that progress cannot be made with out a revert.

There is an obvious justification: the patch should not have been landed. A practical concern is that revert become harder quickly as other part of the codebase start to build on top of the landed change.
In the extreme what you're describing would justify that I could land anything and we would not revert it unless it is breaking or blocking someone else. This does not seem consistent with the rest of this doc, neither with the actual practices.

57

Will update! (Note that this is carried over from the existing doc, I didn't touch it other than reflow)

nhaehnle requested changes to this revision.Oct 24 2020, 1:14 PM
nhaehnle added a reviewer: arsenm.
nhaehnle added a subscriber: nhaehnle.

Considering that you are doing this in response to D83088, I think we have pre-existing evidence that this isn't workable as-is. There has to be some obligation on the people "thinking there should be more review" to actually engage in review. In particular, if they have previously demonstrated that they cannot be relied on for this, then the rule should not apply.

I'm not sure how to phrase that and whether the phrasing is even necessary. In particular, I doubt that this distinction is necessary if we were to lower the bar as I've explained inline.

llvm/docs/CodeReview.rst
47–64

This is too low a bar for reverting given how unresponsive reviewers are in practice. I would suggest instead:

If a developer identifies a problem in a recently committed patch, the patch should reverted promptly ...

This also makes more sense because it aligns with the second paragraph, which talks about "the community member who identified the problem".

You can always think that more review is better, but unless there is something concrete, we err too much on the side of review limbo.

This revision now requires changes to proceed.Oct 24 2020, 1:14 PM
rengolin added inline comments.Oct 24 2020, 1:42 PM
llvm/docs/CodeReview.rst
47–64

Actually, I agree with this statement. "thinks that ... would benefit" is a really low bar.

I originally read in the naive "standard LLVM approach" where developers are mostly sensible, but I agree with @nhaehnle in this one. Once we "encode" in a *policy*, there could be people taking it more literally.

I would also try to put some protection on the author that they must be contacted and in case of delay, other reviewers must be contacted, etc. We really want to avoid people silently reverting commits because they don't like how something is implemented.

Considering that you are doing this in response to D83088, I think we have pre-existing evidence that this isn't workable as-is.

You are refusing to adjust to the existing practices and revert: this is hardly an evidence of anything to me at the moment.

In particular, if they have previously demonstrated that they cannot be relied on for this, then the rule should not apply.

I don't know what this means or how there is anything practical about this, feel free to suggest more rules around this though through a new RFC.
I'm not trying to propose anything new here: these practices seems clear to most 4 years ago, and we have been working this way for a long time now.

llvm/docs/CodeReview.rst
47–64

Actually, I agree with this statement. "thinks that ... would benefit" is a really low bar.

Fair! What about (changes are in bold):

If a developer expresses concerns that would have prevented from landing the patch in a pre-commit review(including around the need for more design discussions) and ask for a revert, the patch should reverted promptly ..."

This addresses mainly that we shouldn't treat differently a review posted 10 min before pushing or 10 min after (or a post-commit review): revert fast is the default.

We really want to avoid people silently reverting commits because they don't like how something is implemented.

(the same can be said of pre-commit review about blocking a revision because "they don't like how something is implemented", seems like something to be addressed uniformly)

This is in the parenthesis actually: (preferably by the original author, unless they are unresponsive). In practice people are reasonable about this I think, but we can tweak it further, what about changing the end to say:

If a developer expresses concerns that would have prevented from landing the patch in a pre-commit review (including around the need for more design discussions), they may ask for a revert to the original author who is responsible to revert the patch promptly.

We can also add an expectation of active engagement from the reviewer in paragraph that follows, by slightly changing it like this:

Before being recommitted, the patch generally undergoes further review.
The community member who identified the problem is expected to engage
actively in the review
. In cases where the patch triggered a
hardware-specific buildbot failure, a community member with access to [...]

I don't want to "take sides" and I'm only looking at this review from what it is and my own experience in the community. But looking at D83088, I see a somewhat problematic review.

@dblaikie has a long list of deep reflections on the design and goals of the patch, which indicates to me that the patch wasn't clear to begin with. The patch was approved by @arsenm but the author didn't request a final check by David, who was the main reviewer, who himself later on (I assume as soon as he could), replied he still wasn't happy with the patch. If I was the author I would have reverted as soon as David ask for it.

In this particular case, the change is in the CFG, which is a core part of the compiler and touches so many things outside of its scope that it's almost impossible to "get it right" from the beginning without breaking bots, patterns, codegen and other people's work in progress. You just have to look at Chandler's decade old attempt at changing the pass manager to see that changes deep in the compiler take time, and are very bumpy.

If some CFG design is either wrong, or could have been better, the longer we take to revert the harder, or even impossible, it will be to do so. Too much code depends on it and by extending the window we may be creating an ecosystem of current patches now relying on that design to work. That is why we have the fast revert + reapply cycle. We don't have good pre-commit validation, so we must act swiftly on post-commit review and requests.

To me, personally, @silvas and @mehdi_amini's addenda to the policy make sense and clearly apply to this particular case.

llvm/docs/CodeReview.rst
47–64

If a developer expresses concerns that would have prevented from landing the patch in a pre-commit review(including around the need for more design discussions) and ask for a revert, the patch should reverted promptly ..."

This addresses mainly that we shouldn't treat differently a review posted 10 min before pushing or 10 min after (or a post-commit review): revert fast is the default.

Agreed. Our lax policy of review and approvals does occasionally lead to soft approvals and lack of diverse reviews, which often comes after commit when the patch lands on people's CI or development trees.

We can't have it both ways. We either have a strong pre-commit validation, or we have a reasonable post-commit policy. Reverting a patch is *not* a reflection on the code quality or the author's competence, just the need for more reviews.

The longer we take to revert the patch, the harder it is and the patch can always be re-applied later.

(the same can be said of pre-commit review about blocking a revision because "they don't like how something is implemented", seems like something to be addressed uniformly)

Good point.

If a developer expresses concerns that would have prevented from landing the patch in a pre-commit review (including around the need for more design discussions), they may ask for a revert to the original author who is responsible to revert the patch promptly.

Right! This is a burden on people that want to contribute, not on everybody else working on their own parts of the project. It's a similar burden we put on new projects, back-ends, front-ends, otherwise it does not scale.

We can also add an expectation of active engagement from the reviewer in paragraph that follows, by slightly changing it like this:

Before being recommitted, the patch generally undergoes further review.
The community member who identified the problem is expected to engage
actively in the review
. In cases where the patch triggered a
hardware-specific buildbot failure, a community member with access to [...]

SGTM.

Reword after Renato's comments.

sivachandra added inline comments.Oct 25 2020, 4:30 PM
llvm/docs/CodeReview.rst
49–51

[As with my other comment, I am assuming we are not discussing the obvious cases. Also, I was not aware of the other thread before I started commenting here.]

IIUC, the current policy of post-commit review assumes good faith actors. So, if a good faith post-commit reviewer has concerns with a commit, the good faith committer is expected to address them. How they are to be addressed is something the reviewer and committer should work out. It could require a revert, or it could just be a simple follow up fix. It should be left up to the committer and the reviewer to work out the way forward. This arrangement does not make the post-commit review carry any less weight than a pre-commit review.

That said, if you want to prescribe how a post-commit review should be addressed/approached in a policy document, I have no problems with it. But, the wording should not allow bad actors to exploit it. That is why I say the prescription should be about more concrete situations. As in, prescribe exactly when a revert is required as apposed to a blanket rule to revert first. For example, does the post-commit reviewer have concrete suggestions for clear cut issues identified, or are they just listing their opinions. And, when the reviewer does have concrete suggestions, does it need a revert to address them, or can they be addressed in a follow up change? I am unable to see why a blanket revert first policy is the best approach. If you have some situations where a revert is the best way forward, then do share them here.

mehdi_amini added inline comments.Oct 25 2020, 4:39 PM
llvm/docs/CodeReview.rst
49–51

Did you read the email thread I linked in the description by the way?

That said, if you want to prescribe how a post-commit review should be addressed/approached in a policy document, I have no problems with it. But, the wording should not allow bad actors to exploit it.

What kind of "bad actors" do you expect? Have you seen "bad actors" in the community so far?
I believe our guidelines / docs in general assume good faith from the community and encode the generally acceptable practices assuming this.

I am unable to see why a blanket revert first policy is the best approach. If you have some situations where a revert is the best way forward, then do share them here.

My angle here is quite "simple": pre and post commit review should be aligned: if my concern with the design aspect of your patch would prevent you from landing it, then I should be able to also ask you to revert it if I think there is a design problem that can't be addressed in-tree.
The text here does not prescribe a "blanket revert first policy", only a "revert on request policy".

sivachandra added inline comments.Oct 25 2020, 5:28 PM
llvm/docs/CodeReview.rst
49–51

Did you read the email thread I linked in the description by the way?

Yes, I did :)

The text here does not prescribe a "blanket revert first policy", only a "revert on request policy".

Ah, sorry! I had this tab open and forgot to refresh and missed your update which changed the wording to "they may ask for a revert". I wrote my reply based on the earlier diff which said, "the patch should be reverted promptly". Sorry again, and this latest diff LGTM.

sivachandra added inline comments.Oct 25 2020, 5:36 PM
llvm/docs/CodeReview.rst
49–51

What kind of "bad actors" do you expect?

For example, someone can ask for a revert without actually showing a path forward or raising specific concerns. For example, they can just say, "this landed without enough review, please revert." Should one revert in response?

mehdi_amini added inline comments.Oct 25 2020, 6:07 PM
llvm/docs/CodeReview.rst
49–51

I would revert, and then ask them what would they like to review exactly here? Re-landing a patch is "cheap".

It is also very contextual: we could imagine someone who has never contributed to the project (or to this subproject) asking to revert a patch without being able to formulate their concerns, but has this been a problem so far? How have we dealt with this in the past?

We also added the explicit expectation for this person to engage in the review of the patch: so we're back to pre vs post commit review alignment.

rengolin added inline comments.Oct 26 2020, 2:47 AM
llvm/docs/CodeReview.rst
49–51

Indeed, very contextual. But if the original reviewer asked me to revert, providing reasons about why I should do so, I would most certainly revert immediately.

Holding on to a patch in tree is harder to fix than re-apply later, and gets harder as time passes.

Considering that you are doing this in response to D83088, I think we have pre-existing evidence that this isn't workable as-is.

I don't seem to be reading D83088 in the same light as you. To me, this proposal would have clearly solved that problem. David was the main reviewer and has given an extensive explanation on the issues he was still seeing with the patch that landed. This is as clear as it comes, that patch must be reverted as soon as possible.

There has to be some obligation on the people "thinking there should be more review" to actually engage in review. In particular, if they have previously demonstrated that they cannot be relied on for this, then the rule should not apply.

I do not understand what you see as a demonstration of lack of reliability is but I see none there. And I don't see it often in LLVM. Certainly not from David! And that review was no example of that either.

Plus, writing rules on vague concepts of reliability that are clearly interpreted by different people differently makes for bad policy.

Historically, all our policies err in the side of trust. We trust the reviewers have good intention and we trust authors will act upon it the best they can. I honestly would hate to see us moving into a position where we are second-guessing everyone's intentions. It doesn't scale.

I'm not sure how to phrase that and whether the phrasing is even necessary. In particular, I doubt that this distinction is necessary if we were to lower the bar as I've explained inline.

I agreed with the bar being low in your inline comment and Mehdi has fixed that. Please read again the text.

Overall, I think the policy change proposed here isn't entirely unreasonable, but I do think it needs to be treated as a change of policy. Not everybody is necessarily aware of a 4 year old email thread; heck, I've been working on upstream LLVM and frontends for 5 years and I wasn't aware of this supposed policy where in reality, things weren't actually done according to what's written in the policy documents. If I don't know this after 5 years, how can anybody joining in the last 4 years possibly be aware other than through mere chance. What's written in the documents needs to matter, if only as part of making LLVM a welcoming and inclusive community. Hidden tribal knowledge is the opposite of those ideals.

Back to the proposal itself: The problem I'm seeing (with post-commit review in general, but especially with this change) is that it exacerbates the dysfunction and arbitrariness of the LLVM review process. That's a practical problem because erring too much on the side of stasis blocks progress on dependent work, especially if that dependent work requires collaboration between multiple developers.

I think this needs a solution. That solution can be a separate discussion, but I think it ought to be adopted before making the problem worse. I will try to find some time to write this up.

llvm/docs/CodeReview.rst
54–55

This is incorrect. Reverting a patch can in practice block other development more than not reverting it. Please just remove this statement.

60–62

This sentence is missing a verb. Maybe something along the lines of: "In cases where the problem is identified by a buildbot, a community member with access to hardware similar to that on the buildbot is excepted to engage in the review."

Not everybody is necessarily aware of a 4 year old email thread;

That email isn't policy. It's the attempt to encode behaviour that was "common" at the time. The LLVM community doesn't create policy on emails, we only encode how we behave after a consensus is formed if that's a good idea to promote further or not.

where in reality, things weren't actually done according to what's written in the policy documents.

Don't conflate your experiences with "reality". Reality is what the thousands of us who work on LLVM have experienced, from different groups, companies, countries, cultures. LLVM is so large these days that it's entirely possible that people only interact with a small subset of the community that experiences it in a similar way as themselves.

I don't know why Sean's proposal didn't go through. It could have been because there was no consensus (which would promote your view) or just that someone drop the ball and it hasn't happened since.

The important thing, however, is that:

  1. LLVM behaviours are not *all* encoded in policy documents. Some of them are just things we do and no one has problems with it so we just let it be.
  2. We only encode into policy things that become contentious (like this review), and for that to be encoded, needs consensus (which we still don't seem to have reached).
  3. Every policy, every document, every behaviour will invariably encode the majority, not the exceptions. That's why we don't like strong policies, because that makes it hard for us to accept worthy exceptions.

What's written in the documents needs to matter, if only as part of making LLVM a welcoming and inclusive community. Hidden tribal knowledge is the opposite of those ideals.

I absolutely agree with this statement. I personally know Mehdi for a while and Sean for even longer and I'm sure neither of them want to propagate hidden knowledge. The very reason for Sean's original email and Mehdi's review proposal is to do exactly the opposite: to elucidate what our behaviour is, and reach consensus on its merits.

Back to the proposal itself: The problem I'm seeing (with post-commit review in general, but especially with this change) is that it exacerbates the dysfunction and arbitrariness of the LLVM review process. That's a practical problem because erring too much on the side of stasis blocks progress on dependent work, especially if that dependent work requires collaboration between multiple developers.

Post-commit review isn't going away, nor should be discussed here in this review. This is a fact of the size and scope of LLVM and the alternatives are far worse. Let's just accept it as a fact for now and discuss this review.

Having an arbitrary review process is *NOT* dysfunctional. It's just arbitrary. I would even say it's evolutionary. We do this because that's what the constraints have led us, and we have discussed alternatives and that's the best we could come up with.

Working upstream is *a lot* slower than downstream, and this is another fact that we cannot change, nor we should discuss here. It's a side-effect of having far too many people involved with widely different points of views, goals and responsibilities.

This means that you are responsible for pushing your changes with a lot more effort than if it was just a local project, but it also means that, once you do, it has a much larger, industry wide impact.

I think this needs a solution. That solution can be a separate discussion, but I think it ought to be adopted before making the problem worse. I will try to find some time to write this up.

You have exposed many issues, not all of them "problems". I'd advise caution before you start a long unwinding thread about many things. We can change small things much faster than big ones.

More importantly, I don't think the facts that upstream development are slower and messier than downstream or that LLVM's policies are arbitrary or that LLVM has strong post-commit review process will change soon, if at all, and no amount of discussions or policies will speed that up.

Not because it's the status-quo, not because the maintainers "said-so", not because "I know better". But because this is where we (all) got after discussing those topics non-stop for (almost?) two decades...

llvm/docs/CodeReview.rst
54–55

What this means to convey is that there are far more people working on other stuff than any one of us are working on our stuff. Perhaps it needs to be rewritten, but the idea is valid.

If a patch is still in discussion, even if it remains in the tree, than it would be disingenuous for people to commit other depending patches on top of that, so essentially, the discussion process will effectively lock your progress no matter where the patch is.

But this is the process that all code reviews follow, upstream or downstream. It's the responsibility of the authors to show the value in their patches, not the other way round.

my 2 cents:

meta-point: this discussion should be happening on llvm-dev. it's clearly outside the scope of a patch review at this point.

good faith: we have to assume everybody in the community is acting on good faith. As Renato said, it just doesn't scale otherwise. If needed, we can develop a "bad actors" policy if bad actors show up in practice. In my experience, everyone is acting on good faith, but sometimes some 1-on-1 communication is needed for two parties to see each other's perspectives and come to consensus; back-and-forth on a patch review isn't necessarily the most productive.

Overall, I think the policy change proposed here isn't entirely unreasonable, but I do think it needs to be treated as a change of policy.

I disagree strongly here.

Not everybody is necessarily aware of a 4 year old email thread; [...] Hidden tribal knowledge is the opposite of those ideals.

Hence why I'm making the policy explicit.

Back to the proposal itself: The problem I'm seeing (with post-commit review in general, but especially with this change) is that it exacerbates the dysfunction and arbitrariness of the LLVM review process. That's a practical problem because erring too much on the side of stasis blocks progress on dependent work, especially if that dependent work requires collaboration between multiple developers.

I don't necessarily disagree with this, but addressing the problem of code review practices and how to unblock such review is orthogonal 1) to the revert practice and 2) writing down the existing policy.

I think this needs a solution. That solution can be a separate discussion, but I think it ought to be adopted before making the problem worse.

This patch isn't making anything worse, it is instructing a wider range of people who haven't been very involved upstream about the current upstream expectations.

my 2 cents:

meta-point: this discussion should be happening on llvm-dev. it's clearly outside the scope of a patch review at this point.

I pinged the original thread on llvm-dev@, if anyone has concerns they can express them there of course.
This review is mostly about writing down the existing policy and so should focusing on the wordsmith of the text.

I agree that waiting months to get a patch in is an issue (a long lasting one!), and our lack of processes around making progress in situation where there is a lack of consensus: I'm interested in improving the situation on these topics as much as possible, but that seems orthogonal to the revert.

Generally, I think this patch reflects the existing expectation in the community, when the post-commit feedback is provided promptly.

Right now the suggested change is worded too strongly: it says that the author is responsible to revert promptly in response to any revert request, no matter the age of the commit. Some old commits can be easily reverted (for example, one-line changes of defaults), some can't be (I'd love if if we could undo that commit in Clang that makes Expr a subclass of Stmt, but asking to revert that right now would be unproductive).

@gribozavr2 thanks for catching this! The original patch had " a recently committed patch" but I lost it in the rewrite...

Add "If shortly after landing a commit, " before the revert expectation

@gribozavr2 the paragraph now starts with "If shortly after landing a commit, a developer expresses concerns ..." ; WDYT?

Fix the grammatical issue pointed by @nhaehnle

mehdi_amini marked an inline comment as done.Oct 28 2020, 11:04 AM
mehdi_amini added inline comments.
llvm/docs/CodeReview.rst
60–62

Applied the suggestion as-is, thanks!

mehdi_amini marked an inline comment as done.Oct 28 2020, 11:04 AM

@gribozavr2 the paragraph now starts with "If shortly after landing a commit, a developer expresses concerns ..." ; WDYT?

"If shortly after landing a commit, a developer expresses concerns" makes it sound like the developer landing and expressing are the same person. Try "If a community member expresses a concern about a recent commit, and this concern would have been significant enough to warrant a conversation during pre-commit review, ..."

Use Dmitri formulation

@gribozavr2 the paragraph now starts with "If shortly after landing a commit, a developer expresses concerns ..." ; WDYT?

"If shortly after landing a commit, a developer expresses concerns" makes it sound like the developer landing and expressing are the same person. Try "If a community member expresses a concern about a recent commit, and this concern would have been significant enough to warrant a conversation during pre-commit review, ..."

Thanks! I applied this as-is.

echristo accepted this revision.Oct 28 2020, 2:52 PM
echristo added a subscriber: echristo.

I'm going to accept this as it codifies a lot of existing intent behind how the community works. This was also fairly universally accepted 4 years ago in the original discussion and nothing has changed.

There are always going to be cases that we can chat about more frequently, but this frames the intent nicely.

-eric

Thanks Eric!
Renato let me know if you have more suggestions or if the current revision looks good to you?
@gribozavr2 I took your suggestion as-is so I suspect you're fine with this at the moment?
Added @dexonsmith because @reames and @hfinkel aren't readily available.

rengolin accepted this revision.Oct 28 2020, 3:11 PM

Accepting again. I particularly like @gribozavr2's suggestion. LGTM, thanks!

gribozavr2 accepted this revision.Oct 28 2020, 3:26 PM
dexonsmith accepted this revision.Oct 28 2020, 3:27 PM

LGTM with a couple of nits.

llvm/docs/CodeReview.rst
57

I think there should be a hyphen in "as-is"

63

typo, should be "expected"

silvas accepted this revision.Oct 28 2020, 3:31 PM

Just gave this a final read-through and it looks great. Thanks for championing this Mehdi!

LGTM with a couple of nits.

To clarify my LGTM after reading more of the discussion above, I think the wording here captures the community practice, making explicit some rules that weren't necessarily well-documented before. (This does not seem like a policy change to me, just documentation of the existing long-standing policy.)

Fix the typos spotted by Duncan

This revision was not accepted when it landed; it landed in state Needs Review.Oct 28 2020, 4:29 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.