Skip to content

[llvm][docs] Add notes on upstreaming code from downstream projects #129743

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

Merged

Conversation

banach-space
Copy link
Contributor

Copy link
Contributor

@chelini chelini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment on lines 284 to 285
* Ensure that the original author(s) are aware of and approve the upstreaming
of their code, and that they are comfortable with you leading the process.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The straight-forward reading of this does not cover the situation where an employee develops code for an employer and the employer directs another employee to work on the upstreaming (potentially after the employee who wrote the code is not longer employed with the employer).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly to the employer/employee scenario, a contributor to a Downstream Community project may have distanced themselves from said Downstream Community. Said Downstream Community, if their licensing is compatible, need not be beholden to the individual contributor as to whether or not the code is upstreamed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for raising this! Admittedly, I hadn’t really considered the employer-employee relationship in this context. That said, should LLVM’s Code Review policies (or any other Open Source project) mandate, guide, or influence what that relationship should be?

Let me clarify where I was coming from when writing this. My focus was on cases where some code exists in an Open Source repository, and a community volunteer decides to move that code from the downstream project to LLVM - either with or without additional changes. To me, it seems natural that the original author should be consulted, and that any changes should be properly attributed in such cases.

Regarding your point about employer-employee relationships, I’m not sure what we could add to make this clearer, as it seems highly context-dependent. And very different to what I originally had in mind. Are there any specific licensing and/or copyright issues that we should consider? I’d hope that the existing LLVM Developer Policy is sufficient here.

Ping @kbeyls , who has spent a considerable amount of time on LLVM's relicensing and is my go-to expert this kind of things.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While waiting for Kristof to chime in, do you have any suggestions how to re-phrase this? Here's what I have in mind:

Ensure that there are no obstacles to upstreaming the code. In some cases, this simply means checking with the original author(s) to ensure they are aware of and approve the upstreaming.

Would that address your concerns? From my perspective, this conveys everything that I originally intended.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would that address your concerns? From my perspective, this conveys everything that I originally intended.

Yes, I believe that addresses my original concerns. It leaves me wondering what obstacles there may be though. Perhaps append:

In other cases, licensing considerations may be more complex.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

Comment on lines 289 to 290
additional reviewers. Specifically, an LGTM from a (co-)author does not
constitute approval to land a change.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The straight-forward reading of this precludes approval of code where all of the qualified experts were involved in the development of the code. Is a code owner for a component or the lead for a specific platform (e.g., for Clang driver changes for that platform) unable to give approval to land a change if they developed part of it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is a code owner for a component or the lead for a specific platform (e.g., for Clang driver changes for that platform) unable to give approval to land a change if they developed part of it?

Wouldn’t this essentially equate to self-approving your own code?

LLVM's developer policy already allows one to commit patches without review in certain cases:

You are allowed to commit patches without approval which you think are obvious.

When we do this, it's effectively self-approval, but the intent is clear - we typically justify direct pushes with reasons like "trivial typo" or "fix broken bot to unblock people."

I’d prefer to avoid creating a new category of "code-owner reviewing their own code submitted by another community member." That seems like an unnecessary distinction and could blur the lines of our review process.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not necessarily the same as self-approval though. For example, the person could have been involved in the downstream development, but perhaps only for a limited part of the whole patch.

If the community relies upon or generally defers to said person for the approval of patches in the area being modified, it stands to reason that, absent comments from other reviewers within a reasonable wait period, their approval should be considered valid for landing the change (if they indicate that to be their intent).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, the person could have been involved in the downstream development, but perhaps only for a limited part of the whole patch.

Sure, but that still makes them a co-author, right? I believe we should always list all co-authors and avoid introducing overly refined rules in LLVM.

For instance, a rule like:

"Only add a person as a co-author if they contributed > N lines of code"

would be arbitrary and hard to enforce. I also wouldn’t know how to define a reasonable threshold. I'd prefer to avoid such distinctions altogether.

If the community relies upon or generally defers to said person for the approval of patches in the area being modified, it stands to reason that, absent comments from other reviewers within a reasonable wait period, their approval should be considered valid for landing the change (if they indicate that to be their intent).

Agreed—this does happen occasionally, and as you mentioned, transparency about intent is key. My suggestion primarily applies to cases where, for example, a patch has two co-authors, but no attempt is made to involve a third reviewer. In such cases, I’d expect co-authors to proactively seek additional reviewers (within reason).

By the way, if there's an area in LLVM that relies solely on one person to review all patches, that’s a separate issue worth discussing elsewhere. Even in those cases, I’d still expect a clear expression of intent from the co-author before landing a change.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are on the same page with respect to what we believe is acceptable practice. I just think that the proposed wording is too definitive. What do you think about wording it as a recommendation instead?:

Specifically, an LGTM from a (co-)author does not constitute should not be taken as approval to land a change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for suggesting this. Let me incorporate it.

@banach-space banach-space requested a review from kbeyls March 5, 2025 16:32
@banach-space
Copy link
Contributor Author

I've added Kristof as a reviewer. Kristof added the existing note on using GitHub's Co-authored-by:

…downstream projects

Refine per comments from Hubert
Copy link
Collaborator

@hubert-reinterpretcast hubert-reinterpretcast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, this LGTM (with minor comment).

…e from downstream projects

Fix link formatting
@banach-space
Copy link
Contributor Author

FWIW, this LGTM (with minor comment).

Updated. Could you approve it using the GitHub UI? Once that’s done, I’ll post an update on Discourse and invite more reviewers if anyone wishes to comment.

Copy link
Collaborator

@hubert-reinterpretcast hubert-reinterpretcast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@banach-space banach-space merged commit 77b55c7 into llvm:main Mar 12, 2025
12 checks passed
@banach-space banach-space deleted the andrzej/docs/add_note_on_upstreaming branch March 12, 2025 11:21
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

Successfully merging this pull request may close these issues.

3 participants