Skip to content

Support requiring owners from both base and head refs#84

Merged
BakerNet merged 9 commits intomainfrom
issue-83-summing-owners
Jan 12, 2026
Merged

Support requiring owners from both base and head refs#84
BakerNet merged 9 commits intomainfrom
issue-83-summing-owners

Conversation

@BakerNet
Copy link
Copy Markdown
Collaborator

@BakerNet BakerNet commented Jan 8, 2026

Related Issue(s)

closes: #83

Summary / Background

Refer to the Issue for a well-written write up

Adds config require_both_branch_reviewers config option to merge base branch and head branch .codeowners rules such that if there is a change in ownership both teams would be required to review.

@pooyaw
Copy link
Copy Markdown

pooyaw commented Jan 8, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @BakerNet, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant enhancement to the code ownership system by implementing a "sum owners" feature. This new functionality allows for a more secure and explicit process for transferring file ownership by requiring approvals from both the current owners (from the base branch) and the prospective new owners (from the PR branch). This prevents unilateral ownership changes and ensures mutual agreement during handoffs, making the ownership transfer process more robust and transparent.

Highlights

  • Introduced 'sum_owners' configuration: A new boolean option 'sum_owners' (default 'false') has been added to 'codeowners.toml' to enable a new merging behavior for code ownership.
  • Enabled dual-branch codeowner evaluation: When 'sum_owners' is true, the system now evaluates codeowner rules from both the base branch and the pull request's head branch, requiring approval from both sets of owners for affected files.
  • Implemented codeowner merging logic: A new 'MergeCodeOwners' function and supporting utilities were added to combine reviewer groups from base and head branches using an AND logic, ensuring comprehensive approval requirements.
  • Enhanced documentation for ownership handoffs: The 'README.md' has been updated to clearly explain the purpose and usage of 'sum_owners', specifically highlighting its utility for managing ownership transfers between teams.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the sum_owners feature, which requires approvals from codeowners in both the base and head branches, useful for ownership handoffs. The implementation involves adding a new merger.go to combine codeowner rules, updating the application logic to use this merger when the feature is enabled, and adding configuration and tests. The documentation in README.md is also updated to explain the new feature.

The changes are well-implemented and tested. I've found a minor issue related to an unused parameter (reviewerGroupManager) in the new merger logic, which makes the code slightly misleading. I've left comments with suggestions to clean this up. Overall, this is a great addition.

Comment thread internal/app/app.go Outdated
Comment thread pkg/codeowners/merger.go Outdated
Comment thread pkg/codeowners/merger.go Outdated
@BakerNet BakerNet changed the title Support summing owners from base and head refs Support requiring owners from both base and head refs Jan 8, 2026
@BakerNet BakerNet marked this pull request as ready for review January 9, 2026 19:01
@github-actions github-actions Bot requested a review from zbedforrest January 9, 2026 19:01
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 9, 2026

Codeowners approval required for this PR:

zbedforrest
zbedforrest previously approved these changes Jan 12, 2026
Comment thread pkg/codeowners/merger.go Outdated

for _, owners := range fileToOwner {
// Process required reviewers
for _, rg := range owners.requiredReviewers {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

could extract repeated logic into a local closure

@github-actions github-actions Bot dismissed zbedforrest’s stale review January 12, 2026 23:03

Changes in owned files since last approval

@BakerNet BakerNet requested review from zbedforrest and removed request for zbedforrest January 12, 2026 23:07
@BakerNet BakerNet requested a review from zbedforrest January 12, 2026 23:25
@BakerNet BakerNet merged commit 29a0480 into main Jan 12, 2026
11 of 12 checks passed
@BakerNet BakerNet deleted the issue-83-summing-owners branch January 12, 2026 23:28
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.

Feature Request: Sum owners from base branch and current (require both)

3 participants