fix(signup): email-scoped handle check (SIGNUP-HANDLE-01) - #179
Merged
Conversation
SIGNUP-HANDLE-01: Profile/Pay check against register email; friendly taken/immutable errors; persistSignupProfileIntent cannot rewrite a set handle.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR tightens hosted signup username (“handle”) handling by making availability checks email-scoped and preventing profile-handle overwrites once set, while also improving user-facing error messages during registration.
Changes:
- Added shared signup-handle helpers for immutability gating, friendly error mapping, and building the Control Plane handle-check URL.
- Updated hosted signup flow to include the registering email in
/handles/check, and to block “Continue” until the handle is confirmed available. - Updated profile intent persistence to avoid overwriting an existing handle and to surface friendlier handle-related errors.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| apps/shell/src/auth/signupHandle.ts | Adds handle immutability gate, friendly error mapping, and email+handle check URL builder. |
| apps/shell/src/auth/signupHandle.test.ts | Adds unit tests for the new signup-handle helpers. |
| apps/shell/src/auth/hostedAccount.ts | Prevents overwriting an already-set profile handle and maps handle errors to friendly messages. |
| apps/shell/src/auth/AuthWizard.tsx | Uses email-scoped handle checking, gates progression on “available”, and maps handle write errors to friendlier messages. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+8
to
+17
| describe("maySetProfileHandle", () => { | ||
| it("blocks overwrite luke → testb", () => { | ||
| const r = maySetProfileHandle({ existingHandle: "luke", requestedHandle: "testb" }); | ||
| expect(r.ok).toBe(false); | ||
| }); | ||
|
|
||
| it("allows first set", () => { | ||
| expect(maySetProfileHandle({ existingHandle: null, requestedHandle: "fresh" }).ok).toBe(true); | ||
| }); | ||
| }); |
Comment on lines
+1499
to
+1508
| if (!handleStatus?.includes("is available")) { | ||
| setError( | ||
| !handleStatus || handleStatus === "Checking username…" | ||
| ? "Wait for the username check to finish." | ||
| : handleStatus.includes("Enter your email") | ||
| ? handleStatus | ||
| : handleStatus.includes("Couldn’t check") | ||
| ? handleStatus | ||
| : "Choose a different handle.", | ||
| ); |
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
persistSignupProfileIntentcannot overwrite an already-set handle; friendly taken/immutable errorsTest plan
cd apps/shell && npx vitest run src/auth(61 passed)profiles_handle_key