Skip to content

Stop updating user.username when a user renames or deletes their github account#14072

Draft
moskirathe wants to merge 3 commits into
rust-lang:mainfrom
moskirathe:stop-updating-username-when-user-deletes-gh-ac
Draft

Stop updating user.username when a user renames or deletes their github account#14072
moskirathe wants to merge 3 commits into
rust-lang:mainfrom
moskirathe:stop-updating-username-when-user-deletes-gh-ac

Conversation

@moskirathe

@moskirathe moskirathe commented Jun 26, 2026

Copy link
Copy Markdown

fixes #13761

Stop updating a user's username when a user updates or deletes their github account. This update currently happens on background job added in #13143 and on login.

@moskirathe moskirathe changed the title Stop updating user username via background job and on login Stop updating user.username when a user renames or deletes their github account Jun 26, 2026
@moskirathe moskirathe force-pushed the stop-updating-username-when-user-deletes-gh-ac branch 2 times, most recently from 2f822b7 to 815f295 Compare June 26, 2026 03:30
@moskirathe moskirathe force-pushed the stop-updating-username-when-user-deletes-gh-ac branch from 815f295 to f4d2a97 Compare June 26, 2026 03:38
@Turbo87 Turbo87 marked this pull request as draft June 26, 2026 04:46
@Turbo87

Turbo87 commented Jun 26, 2026

Copy link
Copy Markdown
Member

sorry, but we can't do this yet without offering users a way to rename their accounts themselves and a way to disambiguate cargo owner add calls

@moskirathe

moskirathe commented Jun 26, 2026

Copy link
Copy Markdown
Author

sorry, but we can't do this yet without offering users a way to rename their accounts themselves and a way to disambiguate cargo owner add calls

@Turbo87 sounds good, we can keep this in draft until its unblocked. are there other issues in #13758 you think i could help with in the meantime?

@carols10cents

Copy link
Copy Markdown
Member

are there other issues in #13758 you think i could help with in the meantime?

The cargo owner add disambiguation is #13769, would you like to work on that? Even though it's not currently possible to have a crates.io username that's different from your GitHub username in the live crates.io site, it should be possible to create a user record with a username value that's different from the associated oauth_github.login in tests.

@carols10cents carols10cents left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions for test improvements I'd like to see :)

View changes since this review

// For now, we want to update the `User` record too
let user_after_update = User::find(&conn, user_id).await?;
assert_eq!(user_after_update.gh_login, expected_username);
assert_eq!(user_after_update.username, expected_username);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than removing this assertion, I think it should change to assert that user_after_update.username still equals existing_gh_user.login.

.do_update()
.set((
users::gh_login.eq(excluded(users::gh_login)),
users::username.eq(excluded(users::username)),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably have a test for this change in behavior; I'm a little surprised that we don't have one that failed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha, this test would have failed, but it's checking users.gh_login rather than users.username. That test should be changed to username, which should pass without this change, then fail with the change, then the assertion should be changed to assert that users.username stays the same but that the oauth_github.login changes.

@moskirathe

Copy link
Copy Markdown
Author

Some suggestions for test improvements I'd like to see :)

View changes since this review

thanks for the review @carols10cents! addressed in 2a601ce

@moskirathe

Copy link
Copy Markdown
Author

are there other issues in #13758 you think i could help with in the meantime?

The cargo owner add disambiguation is #13769, would you like to work on that? Even though it's not currently possible to have a crates.io username that's different from your GitHub username in the live crates.io site, it should be possible to create a user record with a username value that's different from the associated oauth_github.login in tests.

@carols10cents yes, i'd love to tackle #13769. I'll get started on it this weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stop updating user.username when a user renames or deletes their github account

4 participants