-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
fix(suspect commits): Add commitId to RELEASE_BASED suspect commits #103006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| "user_id": owner_id, | ||
| "project_id": project.id, | ||
| "organization_id": project.organization_id, | ||
| "context__asjsonb__commitId": owner_commits[owner_id], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Owner Duplication: Lookup Prevents Record Updates
Including commitId in lookup_kwargs prevents updating existing GroupOwner records when the same author has a new suspect commit. Instead of updating the existing owner's commitId, a new GroupOwner is created, causing duplicate owners for the same user/group combination and breaking the PREFERRED_GROUP_OWNERS limit enforcement. The lookup should match on (group_id, type, user_id, project_id, organization_id) to update existing records, not create duplicates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want separate GroupOwners for separate commits. This record does not represent a Group + User, it represents a Group + Commit
| "user_id": owner_id, | ||
| "project_id": project.id, | ||
| "organization_id": project.organization_id, | ||
| "context__asjsonb__commitId": owner_commits[owner_id], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have any tests which will test that this task will successfully update a group owner with the right fields?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes - take a look at test_update_existing_entries https://github.com/getsentry/sentry/pull/103006/files#diff-b6e0afbaeb8ea99203894d42f9693cc2acc50110771a7ded33a4115cd26c62f0R272
Just added a better check for commitId
This shows we would not create duplicates but LMK if there are other test cases I should cover 👍
JoshFerge
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good!
…103006) ## Problem `EventFileCommittersEndpoint` uses `_get_serialized_committers_from_group_owners` which filters for GroupOwners with `commitId` in context: ```python owner = next(filter(lambda go: go.context.get("commitId"), group_owners), None) ``` RELEASE_BASED suspect commits only store `suspectCommitStrategy`, not `commitId`, so they're never displayed on the Issue detail page. ## Solution Match the SCM_BASED pattern by: 1. Tracking the highest-scoring commit for each author 2. Storing `commitId` in `context_defaults` 3. Including `commitId` in `lookup_kwargs` for proper deduplication
…103006) ## Problem `EventFileCommittersEndpoint` uses `_get_serialized_committers_from_group_owners` which filters for GroupOwners with `commitId` in context: ```python owner = next(filter(lambda go: go.context.get("commitId"), group_owners), None) ``` RELEASE_BASED suspect commits only store `suspectCommitStrategy`, not `commitId`, so they're never displayed on the Issue detail page. ## Solution Match the SCM_BASED pattern by: 1. Tracking the highest-scoring commit for each author 2. Storing `commitId` in `context_defaults` 3. Including `commitId` in `lookup_kwargs` for proper deduplication
Problem
EventFileCommittersEndpointuses_get_serialized_committers_from_group_ownerswhich filters for GroupOwners withcommitIdin context:RELEASE_BASED suspect commits only store
suspectCommitStrategy, notcommitId, so they're never displayed on the Issue detail page.Solution
Match the SCM_BASED pattern by:
commitIdincontext_defaultscommitIdinlookup_kwargsfor proper deduplication