Repository navigation
fix(auth): name a Google user who was already signed up - #4
Merged
Merged
Conversation
Signing in with Google still showed "Hello, there". Capturing the profile name covered creating an account and linking Google to an existing one, and missed the case that applies to everyone who had used the button before: a returning user is found by google_sub, which skips both of those branches outright. So every Google account predating the change stayed nameless, permanently — and unlike a local account there is nowhere to fix it, because a Google-only account never sees a password section and the profile page does not ask for a name twice. Filled on the returning path too, under the same rule as the other two: only when the account has none, so a name someone chose is never replaced by their Google profile. Guarded on both the name being absent and Google actually supplying one, so an ordinary sign-in issues no write at all. That is deliberate rather than tidy: this runs on every Google login against a database billed by the minute it is awake, and a write that stores null over null would wake it for nothing. The fake user repository now counts writes so that can be asserted rather than assumed. Confirmed red-path: disabling the new branch fails the test. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Signing in with Google still showed "Hello, there".
The name capture I added covered two paths — creating an account, and linking Google to an existing one. Both live inside
if (user is null). A returning Google user is found bygoogle_suband skips that block entirely, so every Google account that existed before the change stayed nameless.Permanently, too. Unlike a local account there is nowhere to fix it: a Google-only account never sees a password section, and the profile page does not ask for a name twice.
Now filled on the returning path under the same rule as the other two — only when the account has none, so a name someone chose is never replaced by their Google profile.
The branch is guarded on both the name being absent and Google actually supplying one, so an ordinary sign-in issues no write at all. That is deliberate: it runs on every Google login against a database billed by the minute it is awake, and writing null over null would wake it for nothing. The fake repository now counts writes so that is asserted rather than assumed.
Red path confirmed — disabling the new branch fails the test.
dotnet format, Release-warnaserror🤖 Generated with Claude Code