Skip to content

fix(webhooks): handle GitHub repository renamed and transferred events#748

Open
drazisil-codecov wants to merge 1 commit intomainfrom
joebecher/ccmrg-725-ccmrg-40-gh-webhook-repo-rename-transfer
Open

fix(webhooks): handle GitHub repository renamed and transferred events#748
drazisil-codecov wants to merge 1 commit intomainfrom
joebecher/ccmrg-725-ccmrg-40-gh-webhook-repo-rename-transfer

Conversation

@drazisil-codecov
Copy link
Contributor

@drazisil-codecov drazisil-codecov commented Mar 10, 2026

GitHub repository webhook events for renamed and transferred actions were previously dropped with a warning log. Both are now handled by triggering a SyncRepos task 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_repo and look up by service_id directly, 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 repository webhooks now handle renamed and transferred actions by triggering TaskService.refresh with using_integration=True to resync repository lists.

For transferred, the handler bypasses _get_repo and looks up the repo by service_id (since the payload owner is the new owner), then refreshes both the old owner and—if present in Codecov—the new owner (scoped via repos_affected when node_id is 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.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sentry
Copy link
Contributor

sentry bot commented Mar 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.25%. Comparing base (cb5abf0) to head (9ce750d).
⚠️ Report is 7 commits behind head on main.
✅ All tests successful. No failed tests found.

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           
Flag Coverage Δ
apiunit 96.37% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codecov-notifications
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@drazisil-codecov drazisil-codecov requested a review from a team March 10, 2026 16:33
@drazisil-codecov drazisil-codecov marked this pull request as ready for review March 10, 2026 16: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.

1 participant