-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
fix(commit-context): do not create suspect commits older than 1 year #55013
fix(commit-context): do not create suspect commits older than 1 year #55013
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #55013 +/- ##
==========================================
- Coverage 79.95% 79.92% -0.03%
==========================================
Files 5034 5035 +1
Lines 214531 214862 +331
Branches 36444 36502 +58
==========================================
+ Hits 171521 171739 +218
- Misses 37741 37849 +108
- Partials 5269 5274 +5
|
"event": self.event.event_id, | ||
"group": self.event.group_id, | ||
"organization": self.event.group.project.organization_id, | ||
"reason": "could_not_fetch_commit_context", |
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.
Would it make sense for the reason
to be more specific? e.g. "commit_is_older_than_a_year"
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.
Ehh it could be that only one of the code mappings/installations had the old commit. find_commit_context_for_event
is a function that will return a list of commit contexts. I think this is valid when there is only 1 code mapping and that resulted in the old commit.
"organization": self.event.group.project.organization_id, | ||
"reason": "could_not_fetch_commit_context", | ||
"code_mappings_count": 1, | ||
"fallback": True, |
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.
Does the fallback mean that we would use the previous version of suspect commits?
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.
return { | ||
"commitId": commitInfo.get("oid"), | ||
"committedDate": commitInfo.get("committedDate"), | ||
"committedDate": committed_date, |
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.
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.
added a test to increase coverage.
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.
Thanks for doing so!
Objective:
Update on the reverted PR: #54866
Fixes SENTRY-14ZG
The problem was the wrong key. copy-paste error.
But I noticed from the captured exceptions that some of the results from the github API does not return a date for the commit. So I added a filter for to exclude those commits from the
max
function that determines the most recent commit.