Skip to content

feat: map maintainers by email if username not found (CM-773)#3598

Merged
mbani01 merged 2 commits into
mainfrom
feat/map_maintainers_identity_by_emails
Nov 12, 2025
Merged

feat: map maintainers by email if username not found (CM-773)#3598
mbani01 merged 2 commits into
mainfrom
feat/map_maintainers_identity_by_emails

Conversation

@mbani01
Copy link
Copy Markdown
Contributor

@mbani01 mbani01 commented Nov 12, 2025

This pull request enhances the maintainer extraction and identification process by introducing support for email-based identity lookup as a fallback when a GitHub username is unavailable. It also updates the maintainer data model and extraction prompt to include email addresses, improving the robustness and accuracy of maintainer identification.

Maintainer identity lookup improvements:

  • Added the find_maintainer_identity_by_email function to search for maintainer identities by email in the database, supporting cases where the GitHub username is unknown.
  • Updated the maintainer processing logic to use email-based lookup as a fallback if the GitHub username is "unknown", enhancing the reliability of identity resolution. [1] [2]

Data model and prompt updates:

  • Extended the MaintainerInfoItem model to include an email field, ensuring that email addresses are captured and stored for maintainers.
  • Modified the maintainer extraction prompt to require an email field for each maintainer object, specifying extraction instructions and fallback behavior if the email is not found. [1] [2]

Note

Adds email to maintainer extraction/model and uses a new verified email lookup to resolve identities when GitHub username is missing.

  • Maintainer resolution:
    • Use email-based identity lookup when github_username is "unknown"; skip entries where both username and email are "unknown".
    • Upserts proceed with found identity; logging updated accordingly.
  • Database:
    • Add find_maintainer_identity_by_email querying verified identities across github, git, gitlab in memberIdentities.
  • Models:
    • Extend MaintainerInfoItem with email.
  • AI prompt:
    • Require email in each maintainer object with extraction rules and "unknown" fallback.

Written by Cursor Bugbot for commit 2253555. This will update automatically on new commits. Configure here.

@mbani01 mbani01 requested a review from joanagmaia November 12, 2025 14:00
@mbani01 mbani01 self-assigned this Nov 12, 2025
Comment on lines +231 to +233
platform IN ('github', 'git', 'gitlab')
AND "verified" = TRUE
AND value = $1
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@joanagmaia FYI, I didn't limit the type to email only, because for git, we don't have usernames only email with type username, that should be fine, right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah that's ok. Makes sense. And for git yeah we actually have to use type username since type emails are not verified. So all good

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on December 12

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

await find_github_identity(github_username)
if github_username != "unknown"
else await find_maintainer_identity_by_email(email)
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: Missing Null Checks Break Identity Logic

The logic doesn't handle None values for github_username and email. When github_username is None, the condition github_username != "unknown" evaluates to True, causing find_github_identity(None) to be called instead of falling back to email-based lookup. Similarly, when both are None, the early return check fails since None != "unknown", allowing invalid lookups to proceed. The code only checks for the string "unknown" but the model fields are nullable.

Fix in Cursor Fix in Web

Comment on lines +80 to +89
email = maintainer.email

if github_username == "unknown" and email == "unknown":
self.logger.warning("username & email with value 'unknown' aborting")
return
identity_id = await find_github_identity(github_username)
identity_id = (
await find_github_identity(github_username)
if github_username != "unknown"
else await find_maintainer_identity_by_email(email)
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you give me a bit more context on this unknown logic?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The LLM return "unknown" if it didn't manage to extract the expected values. That was the logic from the v1 I didn't change it as it was working fine

Comment on lines +231 to +233
platform IN ('github', 'git', 'gitlab')
AND "verified" = TRUE
AND value = $1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah that's ok. Makes sense. And for git yeah we actually have to use type username since type emails are not verified. So all good

@mbani01 mbani01 merged commit 9b94e63 into main Nov 12, 2025
17 checks passed
@mbani01 mbani01 deleted the feat/map_maintainers_identity_by_emails branch November 12, 2025 14:34
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.

2 participants