You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(github): ignore organizations when looking up co-author emails - #5325
SearchGithubUserByEmail uses the first result of a GitHub user search for a co-author email. Organizations are included in that search, so an email that is also an organization's public email can match the organization.
Add type:user to the search query.
If an organization is still returned, ignore it so the lookup falls back to the database lookup.
Add tests for both.
Tested the changed function and the new tests in isolation against go-github v37, since the package depends on private modules.
@SoulPancake I'm starting review 1 of this pull request now (started 2026-11-19 14:46 UTC using review agent v0.1.34). This usually takes a few minutes. I'll update this comment with the summary when I'm done. If there's no summary here after about 45 minutes, the review stopped: push a new commit, or post a comment that begins with a mention of me followed by re-review, to start another. For help with the review agent, see https://github.com/linuxfoundation/lfx-review-agent/issues.
This pull request makes the co-author email lookup skip GitHub organizations. It adds type:user to the search query and ignores an organization result that still comes back. The change is small and focused, and both new tests cover it.
Decision
⚠️Review passed, human approval required
This pull request passed automated review, but its author isn't a verified member of the linuxfoundation GitHub organization, so I can't approve it. A maintainer needs to review and approve it before merge.
Details
Overall impression:SearchGithubUserByEmail in cla-backend-go/github/github_repository.go now sends <email> in:email type:user. If the first result still has type Organization, the function returns nil, nil. The caller GetCoAuthorCommits then moves on to the database lookup by email, as the PR describes. I followed that caller path and found no side effects: a nil user from this step leaves the later lookups unchanged, which matches how a "no result" case already behaved. The tests check the exact query string and the organization fallback. I found no correctness, security, performance, privacy or documentation issues. CO_AUTHORS.md describes the email lookup only in general terms, and this change keeps that description accurate.
Other reviewers and CI checks: The required check DCO passed on 3cc28a9. CodeRabbit's status was still pending when I read it. I did not wait for it, and its findings, if any, are not reflected here.
No actionable comments were generated in the recent review.
Walkthrough
The GitHub email search now filters for users and returns no user when its first result is an organization. Tests cover the query and both result types.
Changes
GitHub Email Search
Layer / File(s)
Summary
Filter and validate search results cla-backend-go/github/github_repository.go, cla-backend-go/github/github_repository_test.go
The search query includes type:user. The function ignores organization results and returns other results. Tests verify the query and user and organization handling.
Co-author email lookups now skip organizations and fall back to the existing lookup path, matching the linked issue. No concrete merge-blocking risk was identified.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the fix (ignoring organizations) and its scope (co-author email lookup). The raw summary confirms the change adds type:user to the GitHub search and skips organization results in Searc…
Description check
The description states the problem (organizations matching co-author email searches), lists the changes (type:user in the query, ignoring returned organizations, new tests), and notes the testing appr…
Linked Issues check
Issue #5324 requires that a co-author email matching both a user and an organization resolve to the user. The head commit meets this in two ways. First, SearchGithubUserByEmail in cla-backend-go/git…
Out of Scope Changes check
The whole-PR diff against the merge base (6abee94) touches only cla-backend-go/github/github_repository.go and github_repository_test.go. Every changed hunk relates to issue #5324. The hunks are: the…
Full details: Title check
Explanation
The title names the fix (ignoring organizations) and its scope (co-author email lookup). The raw summary confirms the change adds type:user to the GitHub search and skips organization results in SearchGithubUserByEmail, so the title matches the main change.
Full details: Description check
Explanation
The description states the problem (organizations matching co-author email searches), lists the changes (type:user in the query, ignoring returned organizations, new tests), and notes the testing approach. This matches the changeset in cla-backend-go/github.
Full details: Linked Issues check
Explanation
Issue #5324 requires that a co-author email matching both a user and an organization resolve to the user. The head commit meets this in two ways. First, SearchGithubUserByEmail in cla-backend-go/github/github_repository.go now builds the query as %s in:email type:user, which removes organizations from the GitHub search. Second, if an organization is still returned, the function checks strings.EqualFold(user.GetType(), "Organization") and returns (nil, nil). A nil result sends the lookup to the database fallback, as the PR description states. The issue allows either approach, and the change uses both. The test file adds TestSearchGithubUserByEmailExcludesOrganizationsFromQuery, which asserts the exact query contact@example.com in:email type:user and checks that a user result is returned. It also adds TestSearchGithubUserByEmailIgnoresOrganizationResult, which asserts that an organization result yields a nil user with no error. Both automated tests cover the requirement. The strings package is already imported in the source file. The test helper newTestGithubClient is not added in this diff, so it must already exist in the package. The diff does not show its definition, so this is a minor unverified point.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff against the merge base (6abee94) touches only cla-backend-go/github/github_repository.go and github_repository_test.go. Every changed hunk relates to issue #5324. The hunks are: the added doc comment, the type:user query change, the organization check that returns nil, the switch from result.Users[0].Login to user.GetLogin() in the log calls and return path, and the two new tests. The GetLogin() and GetType() accessors are nil-safe and do not change behavior for the user path. No unrelated behavior or file is changed.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Essentials
Run ID: d0d88abb-5310-4f97-a5c3-2e8834feead5
Commits
Reviewing files that changed from the base of the PR and between 6abee94 and 3cc28a9.
Files selected for processing: 2
cla-backend-go/github/github_repository.go
cla-backend-go/github/github_repository_test.go
Included review availability: This review used your included allowance. 4 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.
The reason will be displayed to describe this comment to others. Learn more.
I found no blocking or minor issues in this change. The search query now excludes organizations, and an organization that still comes back is ignored, so the lookup falls through to the database lookup. Both new tests cover those paths.
This pull request passed automated review, but its author isn't a verified member of the linuxfoundation GitHub organization, so I can't approve it. A maintainer needs to review and approve it before merge.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5324
SearchGithubUserByEmailuses the first result of a GitHub user search for a co-author email. Organizations are included in that search, so an email that is also an organization's public email can match the organization.type:userto the search query.Tested the changed function and the new tests in isolation against go-github v37, since the package depends on private modules.