fix(webhooks): handle GitHub repository renamed and transferred events#748
Open
drazisil-codecov wants to merge 1 commit intomainfrom
Open
fix(webhooks): handle GitHub repository renamed and transferred events#748drazisil-codecov wants to merge 1 commit intomainfrom
drazisil-codecov wants to merge 1 commit intomainfrom
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #748 +/- ##
=======================================
Coverage 92.25% 92.25%
=======================================
Files 1304 1304
Lines 47923 47947 +24
Branches 1628 1628
=======================================
+ Hits 44210 44234 +24
Misses 3404 3404
Partials 309 309
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
GitHub
repositorywebhook events forrenamedandtransferredactions were previously dropped with a warning log. Both are now handled by triggering aSyncRepostask using the GitHub App installation token (using_integration=True), which avoids any dependency on user OAuth tokens.For
transferred, the webhook payload contains the new owner — but the repo is still stored under the old owner in our DB. We bypass_get_repoand look up byservice_iddirectly, then sync both the old owner (to reconcile their repo list) and the new owner (to pick up the repo). If the new owner isn't in Codecov yet, we log and move on.Fixes CCMRG-40, CCMRG-725
Note
Medium Risk
Changes webhook side effects by initiating additional background sync tasks on rename/transfer events; risk is mainly around increased task volume or incorrect owner/repo lookups during transfers.
Overview
GitHub
repositorywebhooks now handlerenamedandtransferredactions by triggeringTaskService.refreshwithusing_integration=Trueto resync repository lists.For
transferred, the handler bypasses_get_repoand looks up the repo byservice_id(since the payload owner is the new owner), then refreshes both the old owner and—if present in Codecov—the new owner (scoped viarepos_affectedwhennode_idis provided); missing repo/new owner cases are treated as no-ops with logging. Tests were added to cover rename/transfer sync behavior and edge cases (repo missing, new owner not in DB).Written by Cursor Bugbot for commit 9ce750d. This will update automatically on new commits. Configure here.