feat(auth): auto-username on OAuth sign-in (discord/github/twitch) - #13997
Open
h0lybyte wants to merge 10 commits into
Open
feat(auth): auto-username on OAuth sign-in (discord/github/twitch)#13997h0lybyte wants to merge 10 commits into
h0lybyte wants to merge 10 commits into
Conversation
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.
Summary
After a new OAuth sign-in (Discord / GitHub / Twitch, web + mobile), auto-claim the user's provider handle as their KBVE username. On collision the DB retries with a random suffix, so it almost always resolves silently + a welcome toast. Only handle-less accounts fall through to a friendly "Hey! We need you to create a username?" prompt.
Changes
POST /api/v1/profile/username/auto(auto_claim_username_handler); base-handle resolver (hint → priority discord→github→twitch) +ProfileService::auto_claim_username; convergedvalidate_usernameto the DB rule (^[a-z0-9_-]{3,63}$— hyphens, leading digit, 3–63) so auto-claimed names round-trip. OpenAPI updated.tracker.ensure_oauth_username(advisory-locked retry-with-suffix viaservice_add_username);ensure_discord_usernameuntouched.api.auto_claim_usernameexactly once per session with the sign-in provider as a hint.Welcome! Your username is @handle — change it in settings.), refresh session.SetUsernameScreengets the friendly copy, the converged regex, andsuggestion+variant:'modal'props.Spec / Plan
docs/superpowers/specs/2026-07-09-discord-auto-username-design.mddocs/superpowers/plans/2026-07-09-oauth-auto-username.mdTest evidence
nx test axum-kbve: 74 passed (validator parity + base-handle resolver).nx test rn: 45 passed (SetUsernameScreen copy + suggestion prefill).Deploy / rollout notes
NOTIFY pgrst, 'reload schema') beforeensure_oauth_usernameresolves — until then calls 404 and users fall through to the manual prompt (best-effort, no error surfaced).Known follow-ups (non-blocking)
SetUsernameScreenbutAuthGatestill renders the full-screen gate with the friendly title only. Wiringvariant="modal"+ a backend-returned sanitized suggestion on theclaimed:falsepath is a small follow-up; deferred because it changes native onboarding UX.Manual verification pending
End-to-end OAuth drive with fresh test accounts (auto-claim → toast → handle-less fallback) not run in this environment — needs a live backend + provider test accounts.