Autodelegation based on more complex rules

Ali Alnubani alialnu at
Mon Feb 15 23:14:47 AEDT 2021

Hi all,

There are currently 2 ways in Patchwork to autodelegate patches. Patchwork can either parse the hint header (X-Patchwork-Delegate), or it can lookup the fnmatch-formatted rules for the project.

Projects using a MAINTAINERS file might want to use the same rules they already have there for delegation. These rules can be in the hundreds, and they can change very often. Managing these manually in django's admin interface can be a bit hard (I have even seen that Django will render them extremely slowly, will cause very high CPU usage, and 5xx timeouts when loading a project's admin page).
Adding these rules can be automated using django's management shell, however, there are cases where more complex rules might be needed to find the right delegate. An example is projects with a hierarchy of trees and maintainers, were patches changing files in more than a single sub-tree usually require delegating to the maintainer of a higher-level tree. Current rule priorities don't support such a case, because we would need to consider all files changed at once, not separately.

Can we implement a hook that would call an external and project-specific script in (specifically in find_delegate_by_filename()) to resolve the issues above? The script would be expected to take the filenames as an argument, and output a delegates email. This way, any complicated rules could be managed by that script.
I realize there might be security implications to this though. Please let me know what you think.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Patchwork mailing list