Proposal: Add Code Owners file

Hey everyone and happy coming new year!

Not sure we’ve ever looked into or discussed the idea of adding the code owners file, so here we go :slight_smile:

The code owners file allows to automatically assign developers that own specified code/file/directory when a PR is open that modifies those files/directories. Draft PRs do not automatically assign reviewers.

Here is a proposal: add .gitea/CODEOWNERS and allow people to opt-in to claim ownership. I wouldn’t “mandate” to have full list of owners or try to match it with the module owners, but I’d really love to be assigned as a reviewer for areas like Libmv, depsgraph, maybe even Cycles. It’ll simplify the process of keeping an eye on an open PRs that I might be very interested in. Maybe it is something other developers would like to do as well?

A bit terse explanation of the code owners in Gitea documentation, and a bit fuller explanation on the Github documentation.

Any thoughts? Do we just do it? Any strong objections?

7 Likes

I was not aware of such feature, and… I like it a lot!

I’d also love to be automatically kept up to date with PRs affecting several core areas (ID management, RNA, BLO, bpy…). Not necessarily to actually review all of it, but at least be aware of what’s happening in these areas.

So big plus one from me!

It could be quite helpful, especially for new contributors to find reviewers. There could be some issues to work out for (large) code cleanups or unclear ownership. But might as well try with a few developers to see how it goes, and then if it works well try to map almost the whole code to owners.

Thanks for the quick replies. Seems like there is interest, fantastic!

I’ve created a PR: https://projects.blender.org/blender/blender/pulls/152272
Not sure how we can test it. Feel free to adjust the code in the pR before the initial merge.

For the large cleanups: I’m personally fine with seeing a cleanup and un-assigning self if I am not really interested in review.

This is maybe being somewhat ‘semantic’, but anyway, my very very first thought was that the term ‘owner’ for an open source project felt a little business/commercial like.

Maybe, Maintainer or Custodian or Guardian or something more along a FOSS line rather then I wrote this code, I’m the Owner, its my IP, etc, etc.

Anyway, just a thought and yes, Happy New Year, at least it is for me.

This is how the file is expected to be called.

KiCad has an interesting explanation in their file: .gitlab/CODEOWNERS · master · KiCad / KiCad Source Code / kicad · GitLab

I was thinking about writing something similar, but we do have module owners, which are responsible for their area.

OK, fair enough, guess it is what it is.

I’ve committed the current state of the PR as a “test drive”. Will see how well it works etc.
Meanwhile, if someone wants to participate in the experiment please feel free to add self to the owners file :slight_smile:

1 Like

Ok, first experiment results: it broke PR creation with the following error: Error 500: <!DOCTYPE html> <html lang="en-US" data-theme="bthree-dark"> <head> <meta name="viewport" content=

The change is reverted for now. Will test it on staging to see whats going on.

The error seemed to not be related to the CODEOWNERS, but to a stale lock files. Somehow the issue coincided with us landing the change (which seemed to cause the issue) and reverting it back (which seemed to solve the problem).

The CODEOWNERS file is now live, with fixed syntax (Gitea expects actual regex, not wildcard), and we’ve quickly tested that PRs against Cycles are automatically assigning reviewers.

Let me know if there are any issues which you believe are related to this file!

2 Likes

Reviewers will be automatically added after:

  • Clicking “Create Pull Request”
  • Changing the title and removing WIP
  • Pushing new commits

It make some sense to keep the reviewers list up to date as the PR gets updated. But it’s something to be aware of if you see unexpected changes to reviewers.

No reviewers will be added if you create a pull request with WIP in the title, to prevent people getting notified too early.

1 Like

While objectively an improvement this does expose an issue we had since the phab migration:

How do i tell the difference between “I must have this reviewers blessing before landing” vs “this person just subscribed to stay informed and i can safely land without this person explicitly signing off” ?

In the phab days we had the concept of a “blocking reviewer” to differentiate between these two rather distinct options, while things are a lot less clear now.

6 Likes

People should not see CODEOWNERS as a “subscription” to the PR. If someone adds themselves to the file they are responsible for the review, or removing self from the reviewers if they think it is not up to them to review.

One annoying thing I noticed today is that even after someone declined to review, the person is added back as reviewer on the next PR update.. That happened e.g. in https://projects.blender.org/blender/blender/pulls/151544

Yes, there is nothing in Gitea preventing that. It just adds reviewers on every update.

Another problem is that on the timeline there is no indication that reviewers were added automatically by CODEOWNERS, it looks the same as manually adding a reviewer.

This feature could certainly use some polish, but not sure where it ranks in priorities.

Another problem is that on the timeline there is no indication that reviewers were added automatically by CODEOWNERS, it looks the same as manually adding a reviewer.

@sybren reported it upstream, and there is a PR to address it, so that should hopefully work itsself out

1 Like

If that PR introduces a new “reserved username”, we may need to update our BlenderID-to-Gitea bridge as well, to prevent errors when somebody has gitea-codeowners (or whatever they settle on) as username in Blender ID.

Edit: Lunny writes “I don’t think we need a system bot user here”, so hopefully this won’t be necessary.

1 Like