- Notifications
You must be signed in to change notification settings - Fork697
Use oauth_github table for sync_admins#12964
Use oauth_github table for sync_admins#12964carols10cents wants to merge 5 commits intorust-lang:mainfrom
Conversation
Uh oh!
There was an error while loading.Please reload this page.
3328d0f todc50798Comparecarols10cents commentedFeb 17, 2026
@Turbo87 Ok, I've substantially rewritten this change. Instead of doing a bunch of complex queries, this is now doing one SELECT for all the information this job needs from the database, then filtering through that and collecting user IDs for the various situations, and sending UPDATEs using only user IDs. Also nevermind my comment before about needing to switch the output from github ID to user ID, because all the information is in the The only case that can't use user IDs is for github IDs in the team repo that have never logged into crates.io and therefore don't have crates.io users we can find. |
dc50798 to5395001CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Because some of these are going to be changing to crates.io user IDs,but some will need to remain GitHub IDs. Hopefully having `github` inthe variable name will make it clearer.
Rather than switching back and forth between github IDs and user IDs anddoing lots of queries.Use oauth_github.account_id rather than users.gh_id to prepare foreventual deprecation of that field to allow for multiple oauthproviders.Continue to use users.gh_login anticipating that that field will becomea crates.io username independent of any login.This does one query for all the user info we might need for currentadmins and new admins, then is able to issue UPDATEs to only the userstable using crates.io user IDs.The only case that must still use github IDs is when there's a user inthe teams repo that has never logged in to crates.io.
For a world where admins can remove their GitHub association someday, tomake sure we don't miss removing them if they also leave the crates.ioadmin team.Fails as of this commit; will be fixed in the next one.
5395001 to71e8662CompareTo future-proof sync admins for a time when it will be possible toremove association between crates.io account and GitHub account.When querying for current admins, use a LEFT JOIN and makeoauth_github::account_id optional to account for the case of a userremoving their GitHub account from their crates.io account, leaving thecrates.io admin team, and then sync admins running. Because they werepreviously an admin and now they're not, they should still get the emailnotification of the change in admins, and they should be removed as anadmin in crates.io.
b4f8f9a to507e107Comparecarols10cents commentedFeb 19, 2026
@Turbo87 ready for rereview! |
This is a tiny, low-risk way to start using the
oauth_githubtable as the source of truth for GitHub IDs in the background process that syncs from the team repo to set the admin flag on users.I volunteer as tribute to be removed (and then readded 🤞🏻 ) as an admin in the team repo to test this out 😁