feat(smart-assignment): Fuzzy-match candidates - #124232
Merged
Merged
Conversation
shayna-ch
approved these changes
Sep 14, 2026
Comment on lines
+472
to
+473
| if len(parts) == 1: | ||
| return re.escape(parts[0]) |
Contributor
There was a problem hiding this comment.
Bug: The fuzzy user matching logic creates an overly strict regex for single-word names, causing it to fail to match users with multi-word names (e.g., "Dana" won't match "Dana Smith").
Severity: MEDIUM
Suggested Fix
Modify the _name_pattern function to generate a more flexible regex for single-word names. Instead of returning a pattern for an exact match, it should return a pattern that allows for additional words, similar to how multi-word names are handled. For example, for the name "Dana", the pattern should match names that start with "Dana", such as "Dana Smith".
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: src/sentry/users/services/user/impl.py#L472-L473
Potential issue: The `_name_pattern()` function generates an overly restrictive regular
expression for single-word names. When provided with a single-word name like "Dana", it
creates the pattern `^Dana$`, which requires an exact match. This prevents matching
users with multi-word names like "Dana Smith". The issue manifests when fuzzy matching
is performed with a single-word name and an email that does not otherwise match the
target user. This leads to a failure in finding a valid user, even when a reasonable
match exists in the organization.
Did we get this right? 👍 / 👎 to inform future reviews.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
There have been clear instances, even with Sentry employees, where hidden GitHub emails prevent us from resolving the actual person responsible for an issue. Here we attempt to fuzzy-match names (newly emitted by the Smart Assignment agent in https://github.com/getsentry/seer/pull/8185) and email addresses to users in the database, with some hopefully-comprehensive regexes that match across email domains, added/missing middle names/initials, various separators, etc.
If even 2 users match the input, we give up fuzzy matching. Better to not match than to match the OTHER John Smith.
For now, we log the results and don't actually use the fuzzy match. I want to monitor the results carefully and only enable if they look solid.