Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
Separate sign-in screens and remember only successful logins (#1136)
Gustavo Yeb2ac3b322b0f
diff --git a/src/web/src/app/(auth)/sign-in/sign-in-client.dom.test.ts b/src/web/src/app/(auth)/sign-in/sign-in-client.dom.test.tsindex a8c8f0a3c..f7df021fc 100644--- a/src/web/src/app/(auth)/sign-in/sign-in-client.dom.test.ts+++ b/src/web/src/app/(auth)/sign-in/sign-in-client.dom.test.ts@@ -13,7 +13,6 @@ const mocks = vi.hoisted(() => ({getLastUsedLoginMethod: vi.fn<() => string | null>(() => null),rememberLastLoginMethod: vi.fn(),verifyInput: undefined as undefined | ((value: string) => Promise<void>),- selectSocial: undefined as undefined | ((method: "github" | "google" | "apple") => void),}))vi.mock("@/lib/product-analytics", () => ({ captureProductAnalytics: mocks.capture }))@@ -55,14 +54,11 @@ vi.mock("./social-sign-in", () => ({postLoginUrl,appleEnabled,lastUsedMethod,- onSelectMethod,}: {postLoginUrl: stringappleEnabled: booleanlastUsedMethod?: LoginMethod | null- onSelectMethod?: (method: "github" | "google" | "apple") => void}) => {- mocks.selectSocial = onSelectMethodreturn createElement("div", {"data-testid": "social-sign-in-props","data-post-login-url": postLoginUrl,@@ -96,40 +92,25 @@ describe("sign-in client layout, consent-on-continue, and last-used method", ()mocks.verify.mockResolvedValue({ error: { code: "INVALID_OTP", status: 400 } })mocks.getLastUsedLoginMethod.mockReturnValue(null)mocks.verifyInput = undefined- mocks.selectSocial = undefinedmocks.searchParams = new URLSearchParams("redirect=%2Fc%2Fme")window.matchMedia = vi.fn(() => ({- matches: false,+ matches: true,addEventListener: vi.fn(),removeEventListener: vi.fn(),})) as never})- it("places social quick-sign-in above the separator, email form, and passive terms footer without auto-focusing email", () => {+ it("shows only method buttons before opening a separate email screen", async () => {render(createElement(SignInPageClient, { isProd: true, appleEnabled: true }))-- expect(screen.queryByRole("checkbox")).toBeNull()- expect(screen.queryByRole("dialog")).toBeNull()-- const heading = screen.getByRole("heading", { name: /Welcome to\s+Alook/i })- expect(heading).toHaveClass("whitespace-nowrap")- expect(heading.querySelector('img[src="/alook.svg"]')).not.toBeNull()-- const social = screen.getByTestId("social-sign-in-props")- const emailInput = screen.getByRole("textbox", { name: "Email" })- const emailButton = screen.getByRole("button", { name: "Continue with email" })- const terms = screen.getByTestId("sign-in-terms")-- expect(emailInput).not.toHaveFocus()- expect(- social.compareDocumentPosition(emailInput) & Node.DOCUMENT_POSITION_FOLLOWING,- ).toBeTruthy()- expect(- emailInput.compareDocumentPosition(emailButton) & Node.DOCUMENT_POSITION_FOLLOWING,- ).toBeTruthy()- expect(- emailButton.compareDocumentPosition(terms) & Node.DOCUMENT_POSITION_FOLLOWING,- ).toBeTruthy()+ expect(screen.queryByRole("textbox")).toBeNull()+ expect(screen.getByRole("heading", { name: /Welcome to\s+Alook/i })).toBeVisible()+ expect(screen.getByTestId("social-sign-in-props")).toBeVisible()+ await setupUser().click(screen.getByRole("button", { name: "Continue with email", exact: true }))+ expect(screen.getByRole("textbox", { name: "Email" })).toBeVisible()+ expect(screen.queryByTestId("social-sign-in-props")).toBeNull()+ expect(screen.queryByTestId("sign-in-mobile-typewriter")).toBeNull()+ expect(mocks.send).not.toHaveBeenCalled()+ expect(mocks.rememberLastLoginMethod).not.toHaveBeenCalled()})it("does not claim removal is complete while deletion remains pending", () => {@@ -144,14 +125,15 @@ describe("sign-in client layout, consent-on-continue, and last-used method", ()render(createElement(SignInPageClient, { isProd: true, appleEnabled: true }))const user = setupUser()+ await user.click(screen.getByRole("button", { name: "Continue with email", exact: true }))await user.type(screen.getByRole("textbox", { name: "Email" }), "[email protected]")- await user.click(screen.getByRole("button", { name: "Continue with email" }))+ await user.click(screen.getByRole("button", { name: "Continue" }))expect(mocks.send).toHaveBeenCalledOnce()expect(mocks.send).toHaveBeenCalledWith(expect.objectContaining({ email: "[email protected]", type: "sign-in" }),)- expect(mocks.rememberLastLoginMethod).toHaveBeenCalledWith("email")+ expect(mocks.rememberLastLoginMethod).not.toHaveBeenCalled()expect(screen.queryByTestId("social-sign-in-props")).toBeNull()expect(screen.getByRole("heading", { name: "Check your email" })).toBeVisible()@@ -165,7 +147,11 @@ describe("sign-in client layout, consent-on-continue, and last-used method", ()await user.click(screen.getByRole("button", { name: "Use a different email" }))expect(screen.getByRole("textbox", { name: "Email" })).toHaveValue("[email protected]")- expect(screen.getByTestId("last-used-email")).toHaveTextContent("Last used")+ expect(mocks.rememberLastLoginMethod).not.toHaveBeenCalled()+ await user.click(screen.getByRole("button", { name: "Back", exact: true }))+ expect(screen.queryByRole("textbox")).toBeNull()+ await user.click(screen.getByRole("button", { name: "Continue with email", exact: true }))+ expect(screen.getByRole("textbox", { name: "Email" })).toHaveValue("[email protected]")})it("preserves development sign-in and signup fallback immediately on submit", async () => {@@ -174,6 +160,7 @@ describe("sign-in client layout, consent-on-continue, and last-used method", ()render(createElement(SignInPageClient, { isProd: false, appleEnabled: false }))const user = setupUser()+ await user.click(screen.getByRole("button", { name: "Continue with email", exact: true }))await user.type(screen.getByRole("textbox", { name: "Email" }), "[email protected]")await user.click(screen.getByRole("button", { name: "Sign in", exact: true }))@@ -195,8 +182,9 @@ describe("sign-in client layout, consent-on-continue, and last-used method", ()async ({ isProd, email }) => {render(createElement(SignInPageClient, { isProd, appleEnabled: false }))const user = setupUser()+ await user.click(screen.getByRole("button", { name: "Continue with email", exact: true }))const input = screen.getByRole("textbox", { name: "Email" }) as HTMLInputElement- const label = isProd ? "Continue with email" : "Sign in"+ const label = isProd ? "Continue" : "Sign in"const request = isProd ? mocks.send : mocks.devSignInconst onInvalid = vi.fn()input.addEventListener("invalid", onInvalid)@@ -234,20 +222,14 @@ describe("sign-in client layout, consent-on-continue, and last-used method", ()"github",)- act(() => {- mocks.selectSocial?.("apple")- })- expect(screen.getByTestId("social-sign-in-props")).toHaveAttribute(- "data-last-used",- "apple",- )})it("counts login entry once and records only bounded OTP failure dimensions", async () => {render(createElement(SignInPageClient, { isProd: true, appleEnabled: false }))expect(mocks.capture).toHaveBeenCalledWith({ event: "login_page_view" })+ await setupUser().click(screen.getByRole("button", { name: "Continue with email", exact: true }))await setupUser().type(screen.getByRole("textbox", { name: "Email" }), "[email protected]")- await setupUser().click(screen.getByRole("button", { name: "Continue with email" }))+ await setupUser().click(screen.getByRole("button", { name: "Continue" }))expect(mocks.capture).toHaveBeenCalledTimes(1)await act(async () => {await mocks.verifyInput!("123456")@@ -265,8 +247,9 @@ describe("sign-in client layout, consent-on-continue, and last-used method", ()it("records send-code failure without mistaking it for successful authentication", async () => {mocks.send.mockResolvedValueOnce({ error: { status: 429 } })render(createElement(SignInPageClient, { isProd: true, appleEnabled: false }))+ await setupUser().click(screen.getByRole("button", { name: "Continue with email", exact: true }))await setupUser().type(screen.getByRole("textbox", { name: "Email" }), "[email protected]")- await setupUser().click(screen.getByRole("button", { name: "Continue with email" }))+ await setupUser().click(screen.getByRole("button", { name: "Continue" }))expect(mocks.capture).toHaveBeenLastCalledWith({event: "sign_in_failed",method: "email_otp",@@ -281,15 +264,16 @@ describe("sign-in client layout, consent-on-continue, and last-used method", ()const error = new TypeError("Failed to fetch")mocks.send.mockRejectedValueOnce(error)render(createElement(SignInPageClient, { isProd: true, appleEnabled: false }))+ await setupUser().click(screen.getByRole("button", { name: "Continue with email", exact: true }))await setupUser().type(screen.getByRole("textbox", { name: "Email" }), "[email protected]")- await setupUser().click(screen.getByRole("button", { name: "Continue with email" }))+ await setupUser().click(screen.getByRole("button", { name: "Continue" }))expect(mocks.capture).toHaveBeenLastCalledWith({event: "sign_in_failed",method: "email_otp",failureStage: "send_code",error,})- await setupUser().click(screen.getByRole("button", { name: "Continue with email" }))+ await setupUser().click(screen.getByRole("button", { name: "Continue" }))mocks.verify.mockRejectedValueOnce(error)await act(async () => {await mocks.verifyInput!("123456")@@ -311,90 +295,60 @@ describe("sign-in client layout, consent-on-continue, and last-used method", ()})it.each([- [true, "Continue with email"],+ [true, "Continue"],[false, "Sign in"],] as const)("uses the outline secondary style and 44px touch target for the email action when isProd=%s",(isProd, label) => {render(createElement(SignInPageClient, { isProd, appleEnabled: true }))+ fireEvent.click(screen.getByRole("button", { name: "Continue with email", exact: true }))const button = screen.getByRole("button", { name: label, exact: true })expect(button).toHaveClass("h-11",- "justify-start",+ "justify-center","border-border","bg-background","w-full",)- expect(button.querySelector("svg")).not.toBeNull()+ expect(button.querySelector("svg")).toBeNull()},)- it("renders the borderless mobile typewriter above login and collapses it when the viewport shrinks for keyboard or short screens", () => {- window.matchMedia = vi.fn((query: string) => ({- matches: query.includes("max-width"),- addEventListener: vi.fn(),- removeEventListener: vi.fn(),- })) as never- Object.defineProperty(window, "innerHeight", { configurable: true, value: 844 })-- render(createElement(SignInPageClient, { isProd: true, appleEnabled: true }))- const stage = screen.getByTestId("sign-in-mobile-typewriter")- expect(stage).toHaveAttribute("data-collapsed", "false")- expect(screen.getByTestId("mobile-typewriter-stub")).toBeVisible()-- act(() => {- Object.defineProperty(window, "innerHeight", { configurable: true, value: 460 })- window.dispatchEvent(new Event("resize"))- })- expect(stage).toHaveAttribute("data-collapsed", "true")- expect(screen.queryByTestId("mobile-typewriter-stub")).toBeNull()- })-- it("keeps the mobile form inside the panned visual viewport and restores it after keyboard dismissal", () => {- window.matchMedia = vi.fn((query: string) => ({- matches: query.includes("max-width"),- addEventListener: vi.fn(),- removeEventListener: vi.fn(),- })) as never- Object.defineProperty(window, "innerHeight", { configurable: true, value: 844 })+ it("leaves layout and artwork unchanged when the keyboard viewport pans or resizes", async () => {+ window.matchMedia = vi.fn((query: string) => ({ matches: query.includes("max-width") || query.includes("prefers-reduced-motion"), addEventListener: vi.fn(), removeEventListener: vi.fn() })) as neverconst original = Object.getOwnPropertyDescriptor(window, "visualViewport")const viewport = Object.assign(new EventTarget(), { height: 844, offsetTop: 0 })Object.defineProperty(window, "visualViewport", { configurable: true, value: viewport })- const remove = vi.spyOn(viewport, "removeEventListener")try {const view = render(createElement(SignInPageClient, { isProd: true, appleEnabled: true }))const root = view.container.firstElementChild as HTMLElement- expect(root).toHaveClass("fixed", "sm:relative")- act(() => {- viewport.height = 420- viewport.offsetTop = 180- viewport.dispatchEvent(new Event("resize"))- })- expect(root.style.height).toBe("420px")- expect(root.style.top).toBe("180px")+ expect(root).not.toHaveClass("fixed", "h-dvh", "overflow-hidden")+ const stage = screen.getByTestId("sign-in-mobile-typewriter")act(() => {+ viewport.height = 390viewport.offsetTop = 240- viewport.dispatchEvent(new Event("scroll"))- })- expect(root.style.top).toBe("240px")- act(() => {- viewport.height = 844- viewport.offsetTop = 0viewport.dispatchEvent(new Event("resize"))+ viewport.dispatchEvent(new Event("scroll"))})+ expect(stage).toHaveAttribute("data-collapsed", "false")+ await setupUser().click(screen.getByRole("button", { name: "Continue with email", exact: true }))+ const email = screen.getByRole("textbox", { name: "Email" })+ fireEvent.focusIn(email)+ expect(root.style.height).toBe("")+ expect(root.style.top).toBe("")+ expect(screen.queryByTestId("sign-in-mobile-typewriter")).toBeNull()+ expect(screen.getByTestId("sign-in-email-pane")).not.toHaveClass("overflow-y-auto", "overflow-hidden", "h-full")+ act(() => { viewport.height = 844; viewport.offsetTop = 0; viewport.dispatchEvent(new Event("resize")) })expect(root.style.height).toBe("")expect(root.style.top).toBe("")- view.unmount()- expect(remove).toHaveBeenCalledWith("scroll", expect.any(Function))- expect(remove).toHaveBeenCalledWith("resize", expect.any(Function))} finally {if (original) Object.defineProperty(window, "visualViewport", original)else Reflect.deleteProperty(window, "visualViewport")}})- it("slides the mobile typewriter and login pane left into a pure centered OTP pane and focuses the OTP input on completion", async () => {+ it.each([390, 1440])("slides all steps in both directions at %ipx and focuses OTP only after completion", async (width) => {const rafQueue: FrameRequestCallback[] = []const origRaf = window.requestAnimationFrameconst origCancelRaf = window.cancelAnimationFrame@@ -409,13 +363,26 @@ describe("sign-in client layout, consent-on-continue, and last-used method", ()removeEventListener: vi.fn(),})) as neverObject.defineProperty(window, "innerHeight", { configurable: true, value: 844 })+ Object.defineProperty(window, "innerWidth", { configurable: true, value: width })try {render(createElement(SignInPageClient, { isProd: true, appleEnabled: true }))const user = setupUser()+ await user.click(screen.getByRole("button", { name: "Continue with email", exact: true }))+ const methodsTrack = screen.getByTestId("sign-in-step-track")+ expect(methodsTrack).toHaveAttribute("data-step-view", "prepare-from-methods")+ expect(screen.getByRole("textbox", { name: "Email" })).toBeDisabled()+ act(() => { rafQueue.shift()?.(16) })+ expect(methodsTrack.style.transform).toBe("translate3d(-100%, 0, 0)")+ act(() => {+ const ev = new Event("transitionend", { bubbles: true })+ Object.defineProperty(ev, "propertyName", { value: "transform" })+ fireEvent(methodsTrack, ev)+ })+ expect(screen.getByRole("textbox", { name: "Email" })).toBeEnabled()await user.type(screen.getByRole("textbox", { name: "Email" }), "[email protected]")- await user.click(screen.getByRole("button", { name: "Continue with email" }))+ await user.click(screen.getByRole("button", { name: "Continue" }))const track = screen.getByTestId("sign-in-step-track")expect(track).toHaveAttribute("data-step-view", "prepare-to-code")@@ -460,122 +427,36 @@ describe("sign-in client layout, consent-on-continue, and last-used method", ()})expect(track).toHaveAttribute("data-step-view", "email")expect(screen.queryByTestId("sign-in-code-pane")).toBeNull()- expect(screen.getByTestId("sign-in-mobile-typewriter")).toBeVisible()- } finally {- window.requestAnimationFrame = origRaf- window.cancelAnimationFrame = origCancelRaf- }- })-- it("preserves delayed blur viewport recovery on mobile while deduplicating consecutive blurs and clearing pending timers on unmount", () => {- vi.useFakeTimers()- window.matchMedia = vi.fn((query: string) => ({- matches: query.includes("max-width"),- addEventListener: vi.fn(),- removeEventListener: vi.fn(),- })) as never- Object.defineProperty(window, "innerHeight", { configurable: true, value: 640 })-- try {- const firstView = render(- createElement(SignInPageClient, { isProd: true, appleEnabled: true }),- )- const stage = screen.getByTestId("sign-in-mobile-typewriter")- const email = screen.getByRole("textbox", { name: "Email" })- expect(stage).toHaveAttribute("data-collapsed", "false")-- act(() => {- fireEvent.focusIn(email)- })- expect(stage).toHaveAttribute("data-collapsed", "true")-- act(() => {- fireEvent.focusOut(email)- fireEvent.focusOut(email)- })- expect(vi.getTimerCount()).toBe(1)- expect(stage).toHaveAttribute("data-collapsed", "true")-- act(() => {- vi.advanceTimersByTime(49)- })- expect(stage).toHaveAttribute("data-collapsed", "true")-- act(() => {- vi.advanceTimersByTime(1)- })- expect(stage).toHaveAttribute("data-collapsed", "false")- expect(vi.getTimerCount()).toBe(0)-+ expect(screen.queryByTestId("sign-in-mobile-typewriter")).toBeNull()+ await user.click(screen.getByRole("button", { name: "Back", exact: true }))+ expect(track).toHaveAttribute("data-step-view", "prepare-to-methods")+ expect(track.style.transform).toBe("translate3d(-100%, 0, 0)")+ act(() => { while (rafQueue.length) rafQueue.shift()?.(48) })+ expect(track).toHaveAttribute("data-step-view", "sliding-to-methods")+ expect(track.style.transform).toBe("translate3d(0%, 0, 0)")act(() => {- fireEvent.focusOut(email)- fireEvent.focusOut(email)+ const ev = new Event("transitionend", { bubbles: true })+ Object.defineProperty(ev, "propertyName", { value: "transform" })+ fireEvent(track, ev)})- expect(vi.getTimerCount()).toBe(1)- firstView.unmount()- expect(vi.getTimerCount()).toBe(0)+ expect(track).toHaveAttribute("data-step-view", "methods")+ expect(screen.queryByRole("textbox")).toBeNull()} finally {- vi.clearAllTimers()- vi.useRealTimers()+ window.requestAnimationFrame = origRaf+ window.cancelAnimationFrame = origCancelRaf}})- it("clears pending blur timers and prevents stale mobile viewport updates after switching to desktop", () => {- vi.useFakeTimers()- let mobile = true- const mobileListeners = new Set<() => void>()- const mobileMql = {- get matches() {- return mobile- },- addEventListener: vi.fn((_event: string, listener: () => void) => {- mobileListeners.add(listener)- }),- removeEventListener: vi.fn((_event: string, listener: () => void) => {- mobileListeners.delete(listener)- }),- }- window.matchMedia = vi.fn((query: string) =>- query.includes("max-width")- ? mobileMql- : {- matches: false,- addEventListener: vi.fn(),- removeEventListener: vi.fn(),- },- ) as never- Object.defineProperty(window, "innerHeight", { configurable: true, value: 640 })-- try {- const view = render(- createElement(SignInPageClient, { isProd: true, appleEnabled: true }),- )- const stage = screen.getByTestId("sign-in-mobile-typewriter")- const email = screen.getByRole("textbox", { name: "Email" })-- act(() => {- fireEvent.focusIn(email)- fireEvent.focusOut(email)- })- expect(stage).toHaveAttribute("data-collapsed", "true")- expect(vi.getTimerCount()).toBe(1)-- act(() => {- Object.defineProperty(window, "innerHeight", { configurable: true, value: 460 })- mobile = false- for (const listener of mobileListeners) listener()- })- expect(vi.getTimerCount()).toBe(0)- expect(stage).toHaveAttribute("data-collapsed", "false")-- act(() => {- vi.advanceTimersByTime(100)- })- expect(stage).toHaveAttribute("data-collapsed", "false")- view.unmount()- } finally {- vi.clearAllTimers()- vi.useRealTimers()- }+ it("updates Last used only after OTP authentication succeeds", async () => {+ mocks.getLastUsedLoginMethod.mockReturnValue("github")+ mocks.verify.mockResolvedValueOnce({ error: null })+ render(createElement(SignInPageClient, { isProd: true, appleEnabled: true }))+ const user = setupUser()+ await user.click(screen.getByRole("button", { name: "Continue with email", exact: true }))+ await user.type(screen.getByRole("textbox", { name: "Email" }), "[email protected]")+ await user.click(screen.getByRole("button", { name: "Continue", exact: true }))+ expect(mocks.rememberLastLoginMethod).not.toHaveBeenCalled()+ await act(async () => { await mocks.verifyInput!("123456") })+ expect(mocks.rememberLastLoginMethod).toHaveBeenCalledExactlyOnceWith("email")})})diff --git a/src/web/src/app/(auth)/sign-in/sign-in-client.tsx b/src/web/src/app/(auth)/sign-in/sign-in-client.tsxindex e7cf1e83b..6f1368d24 100644--- a/src/web/src/app/(auth)/sign-in/sign-in-client.tsx+++ b/src/web/src/app/(auth)/sign-in/sign-in-client.tsx@@ -25,7 +25,6 @@ import { SocialSignIn } from "./social-sign-in"import { SignInTermsNotice } from "./sign-in-terms"import { SignInMobileTypewriter } from "./sign-in-mobile-typewriter"import { GradientBackground } from "@/components/gradient-background"-import { useIsMobile } from "@/hooks/use-mobile"import { Logo } from "@/components/logo"import { LandingShellMotion } from "@/components/home/landing-shell-motion"import {@@ -34,7 +33,7 @@ import {} from "@/components/home/landing-shell-motion-timeline"import galleryStyles from "@/components/home/landing-shell-motion.module.css"import { DEV_PASSWORD } from "@alook/shared"-import { CircleCheck, Mail } from "lucide-react"+import { ArrowLeft, CircleCheck, Mail } from "lucide-react"import Image from "next/image"import { safeRedirectPath } from "@/lib/safe-redirect"import { cn } from "@/lib/utils"@@ -55,7 +54,12 @@ function readClientLastLoginMethod(): LoginMethod | null {}type StepViewState =+ | "methods"| "email"+ | "prepare-from-methods"+ | "sliding-from-methods"+ | "prepare-to-methods"+ | "sliding-to-methods"| "prepare-to-code"| "sliding-to-code"| "code"@@ -71,9 +75,6 @@ function SignInForm({accountDeletionPending,appleEnabled,initialLastUsedMethod = null,- isMobile,- mobileTypewriterCollapsed,- onSlideActiveChange,}: {postLoginUrl: stringisProd: boolean@@ -81,9 +82,6 @@ function SignInForm({accountDeletionPending: booleanappleEnabled: booleaninitialLastUsedMethod?: LoginMethod | null- isMobile: boolean- mobileTypewriterCollapsed: boolean- onSlideActiveChange?: (active: boolean) => void}) {useEffect(() => {void captureProductAnalytics({ event: "login_page_view" })@@ -105,25 +103,33 @@ function SignInForm({const [otpError, setOtpError] = useAtom(useCreateAtom(""))const [loading, setLoading] = useAtom(useCreateAtom(false))const [code, setCode] = useAtom(useCreateAtom(""))- const [viewState, setViewState] = useAtom(useCreateAtom<StepViewState>("email"))+ const [viewState, setViewState] = useAtom(useCreateAtom<StepViewState>("methods"))const [retryAfter, setRetryAfter] = useAtom(useCreateAtom<number | null>(null))const [lastUsedMethod, setLastUsedMethod] = useAtom(useCreateAtom<LoginMethod | null>(initialLastUsedMethod),)const finishSlide = useCallback(- (target: "email" | "code") => {- onSlideActiveChange?.(false)+ (target: "methods" | "email" | "code") => {setViewState(target)},- [onSlideActiveChange, setViewState],+ [setViewState],)const shouldAnimateSlide = () =>- isMobile- && typeof window !== "undefined"+ typeof window !== "undefined"&& !window.matchMedia("(prefers-reduced-motion: reduce)").matches+ const switchMethodsStep = (target: "methods" | "email") => {+ if (isTransitioning) return+ if (document.activeElement instanceof HTMLElement) document.activeElement.blur()+ if (!shouldAnimateSlide()) {+ setViewState(target)+ return+ }+ setViewState(target === "email" ? "prepare-from-methods" : "prepare-to-methods")+ }+const enterCodeStep = () => {if (!shouldAnimateSlide()) {setViewState("code")@@ -132,7 +138,6 @@ function SignInForm({if (document.activeElement instanceof HTMLElement) {document.activeElement.blur()}- onSlideActiveChange?.(true)setViewState("prepare-to-code")}@@ -147,7 +152,6 @@ function SignInForm({if (document.activeElement instanceof HTMLElement) {document.activeElement.blur()}- onSlideActiveChange?.(true)setViewState("prepare-to-email")}@@ -165,19 +169,19 @@ function SignInForm({}, [retryAfter, setRetryAfter])useEffect(() => {- if (viewState !== "prepare-to-code" && viewState !== "prepare-to-email") return+ if (!viewState.startsWith("prepare-")) returnvoid trackRef.current?.getBoundingClientRect()const rafId = window.requestAnimationFrame(() => {setViewState(- viewState === "prepare-to-code" ? "sliding-to-code" : "sliding-to-email",+ viewState.replace("prepare-", "sliding-") as StepViewState,)})return () => window.cancelAnimationFrame(rafId)}, [setViewState, viewState])useEffect(() => {- if (viewState !== "sliding-to-code" && viewState !== "sliding-to-email") return- const target = viewState === "sliding-to-code" ? "code" : "email"+ if (!viewState.startsWith("sliding-")) return+ const target = viewState === "sliding-to-code" ? "code" : viewState === "sliding-to-methods" ? "methods" : "email"const timerId = window.setTimeout(() => {finishSlide(target)}, STEP_SLIDE_FALLBACK_MS)@@ -185,28 +189,19 @@ function SignInForm({}, [finishSlide, viewState])useEffect(() => {- if (isMobile) return- if (viewState === "prepare-to-code" || viewState === "sliding-to-code") {- finishSlide("code")- } else if (viewState === "prepare-to-email" || viewState === "sliding-to-email") {- finishSlide("email")- }- }, [finishSlide, isMobile, viewState])-- useEffect(() => {- if (!isProd || viewState !== "code") return+ if (!isProd || viewState !== "code" || loading) returnconst focusOtp = () => {const otpInput = codePaneRef.current?.querySelector<HTMLInputElement>('input[aria-label="Verification code"]',)if (otpInput && document.activeElement !== otpInput) {- otpInput.focus({ preventScroll: true })+ otpInput.focus()}}focusOtp()const rafId = window.requestAnimationFrame(focusOtp)return () => window.cancelAnimationFrame(rafId)- }, [isProd, viewState])+ }, [isProd, loading, viewState])const rateLimitHandler = {onError: (ctx: { response: Response }) => {@@ -245,8 +240,6 @@ function SignInForm({failed("send_code", error)if (error.status !== 429) setEmailError(error.message ?? "Failed to send code")} else {- rememberLastLoginMethod("email")- setLastUsedMethod("email")setEmail(targetEmail)setEmailError("")setOtpError("")@@ -330,23 +323,24 @@ function SignInForm({? "Sending...": isCoolingDown? `Wait ${retryAfter}s`- : "Continue with email"+ : "Continue"const isEmailLastUsed = lastUsedMethod === "email"- const showEmailPane = !isProd || viewState !== "code"- const showCodePane = isProd && viewState !== "email"- const isSliding = viewState === "sliding-to-code" || viewState === "sliding-to-email"- const isExitingEmail =- viewState === "prepare-to-code" || viewState === "sliding-to-code"- const isExitingCode =- viewState === "prepare-to-email" || viewState === "sliding-to-email"- const deferOtpFocus =- viewState === "prepare-to-code" || viewState === "sliding-to-code"- const trackTransform =- viewState === "sliding-to-code" || viewState === "prepare-to-email"+ const methodsTransition = viewState.endsWith("methods") && viewState !== "methods"+ const isTransitioning = viewState.startsWith("prepare-") || viewState.startsWith("sliding-")+ const showMethodsPane = viewState === "methods" || methodsTransition+ const showEmailPane = viewState === "email" || isTransitioning+ const showCodePane = isProd && (viewState === "code" || (isTransitioning && !methodsTransition))+ const isSliding = viewState.startsWith("sliding-")+ const isExitingEmail = viewState === "prepare-to-code" || viewState === "sliding-to-code"+ || viewState === "prepare-to-methods" || viewState === "sliding-to-methods"+ const isExitingCode = viewState === "prepare-to-email" || viewState === "sliding-to-email"+ const deferOtpFocus = isTransitioning+ const trackTransform = isTransitioning+ ? viewState === "sliding-to-code" || viewState === "prepare-to-email"+ || viewState === "sliding-from-methods" || viewState === "prepare-to-methods"? "translate3d(-100%, 0, 0)"- : viewState === "prepare-to-code" || viewState === "sliding-to-email"- ? "translate3d(0%, 0, 0)"- : undefined+ : "translate3d(0%, 0, 0)"+ : undefinedconst handleTrackTransitionEnd = (event: React.TransitionEvent<HTMLDivElement>) => {if (event.target !== event.currentTarget || event.propertyName !== "transform") {@@ -354,13 +348,15 @@ function SignInForm({}if (viewState === "sliding-to-code") {finishSlide("code")- } else if (viewState === "sliding-to-email") {+ } else if (viewState === "sliding-to-methods") {+ finishSlide("methods")+ } else if (viewState === "sliding-to-email" || viewState === "sliding-from-methods") {finishSlide("email")}}return (- <div className="relative flex min-h-0 w-full flex-1 overflow-clip sm:min-h-124">+ <div className="relative flex min-h-0 w-full flex-1 overflow-x-clip sm:min-h-124"><ObservedStaticContent /><divref={trackRef}@@ -374,28 +370,11 @@ function SignInForm({&& "transition-transform duration-500 ease-in-out will-change-transform motion-reduce:transition-none",)}>- {showEmailPane ? (- <div- key="email-pane"- data-testid="sign-in-email-pane"- aria-hidden={isExitingEmail || undefined}- inert={isExitingEmail || undefined}- className={cn(- "flex h-full min-h-0 w-full shrink-0 flex-col sm:h-auto sm:justify-center sm:overflow-visible sm:p-8",- mobileTypewriterCollapsed- ? "overflow-y-auto thin-scrollbar pt-[max(1rem,env(safe-area-inset-top))] pb-[max(1rem,env(safe-area-inset-bottom))]"- : "justify-center gap-4 overflow-hidden pt-[max(0.5rem,env(safe-area-inset-top))] pb-[max(1rem,env(safe-area-inset-bottom))] [@media(min-height:740px)]:gap-8",- )}- >- <SignInMobileTypewriter collapsed={mobileTypewriterCollapsed} />- <div- className={cn(- "w-full shrink-0 px-4 sm:px-0",- mobileTypewriterCollapsed && "my-auto sm:my-0",- )}- >- <div className="mx-auto w-full max-w-80 sm:max-w-88">- <FieldGroup className={cn("sm:gap-4", mobileTypewriterCollapsed ? "gap-2" : "gap-4 [@media(max-height:579px)]:gap-2")}>+ {showMethodsPane ? (+ <div aria-hidden={isTransitioning || undefined} inert={isTransitioning || undefined} className="flex min-h-svh w-full shrink-0 flex-col justify-center gap-4 pt-[max(0.5rem,env(safe-area-inset-top))] pb-[max(1rem,env(safe-area-inset-bottom))] sm:min-h-0 sm:p-8">+ <SignInMobileTypewriter collapsed={false} />+ <div className="mx-auto w-full max-w-88 px-4 sm:px-0">+ <FieldGroup className="gap-4">{accountDeleted || accountDeletionPending ? (<divclassName="flex gap-3 rounded-xl bg-muted/70 p-4 text-left"@@ -443,15 +422,41 @@ function SignInForm({postLoginUrl={postLoginUrl}appleEnabled={appleEnabled}lastUsedMethod={lastUsedMethod}- onSelectMethod={setLastUsedMethod}/><FieldSeparator className="*:data-[slot=field-separator-content]:bg-background *:data-[slot=field-separator-content]:text-xs sm:*:data-[slot=field-separator-content]:bg-card">or</FieldSeparator>+ <div className="relative">+ <Button variant="outline" size="lg" type="button" aria-describedby={isEmailLastUsed ? "last-used-email-badge" : undefined} className="h-11 w-full justify-start px-4 text-sm font-medium" onClick={() => switchMethodsStep("email")}>+ <span className="flex items-center gap-2"><span className="grid h-9 w-6 place-items-center"><Mail className="size-4" aria-hidden /></span>Continue with email</span>+ </Button>+ {isEmailLastUsed ? <span id="last-used-email-badge" data-testid="last-used-email" className="pointer-events-none absolute -top-2 right-3 rounded-md border border-border bg-background px-1.5 text-[10px] leading-4 font-medium text-muted-foreground">Last used</span> : null}+ </div>+ <SignInTermsNotice />+ </FieldGroup>+ </div>+ </div>+ ) : null}+ {showEmailPane ? (+ <div+ key="email-pane"+ data-testid="sign-in-email-pane"+ aria-hidden={isExitingEmail || undefined}+ inert={isTransitioning || undefined}+ className="flex min-h-svh w-full shrink-0 flex-col px-4 pt-[max(3rem,env(safe-area-inset-top))] pb-[max(1.5rem,env(safe-area-inset-bottom))] sm:min-h-0 sm:justify-center sm:p-8"+ >+ <div className="mx-auto w-full max-w-80 sm:max-w-88">+ <FieldGroup className="gap-4">+ <Button variant="ghost" type="button" className="h-11 w-fit gap-2 px-0" disabled={loading || isTransitioning} onClick={() => switchMethodsStep("methods")}>+ <ArrowLeft className="size-4" aria-hidden />+ Back+ </Button>+ <h1 className="text-2xl font-semibold tracking-tight">Continue with email</h1>+ <p className="text-sm text-muted-foreground">We’ll send you a sign-in code.</p><form noValidate onSubmit={handleEmailSubmit}>- <div className="flex flex-col gap-2">+ <fieldset disabled={isTransitioning} className="flex flex-col gap-2"><SignInEmailFieldemail={email}error={isProd ? emailFeedback : emailError}@@ -465,43 +470,16 @@ function SignInForm({variant="outline"size="lg"type="submit"- disabled={loading || isSliding || (isProd && isCoolingDown)}- aria-describedby={- isEmailLastUsed ? "last-used-email-badge" : undefined- }- className={cn(- "peer h-11 w-full justify-start px-4 text-sm font-medium",- isEmailLastUsed && "pr-22",- )}+ disabled={loading || isTransitioning || (isProd && isCoolingDown)}+ className="h-11 w-full justify-center px-4 text-sm font-medium">- <span className="flex min-w-0 items-center gap-2">- <span- className="grid h-9 w-6 shrink-0 place-items-center"- aria-hidden- >- <Mail className="size-4" aria-hidden />- </span>- <span className="truncate">- {isProd ? sendLabel : loading ? "Signing in..." : "Sign in"}- </span>- </span>+ {isProd ? sendLabel : loading ? "Signing in..." : "Sign in"}</Button>- {isEmailLastUsed ? (- <span- id="last-used-email-badge"- data-testid="last-used-email"- className="pointer-events-none absolute top-1/2 right-3 -translate-y-1/2 rounded-full border border-border bg-secondary px-2 py-0.5 text-[11px] leading-none font-medium text-secondary-foreground peer-disabled:opacity-50"- >- Last used- </span>- ) : null}+</div>- </div>+ </fieldset></form>-- <SignInTermsNotice />- </FieldGroup>- </div>+ </FieldGroup></div></div>) : null}@@ -512,10 +490,10 @@ function SignInForm({ref={codePaneRef}data-testid="sign-in-code-pane"aria-hidden={isExitingCode || undefined}- inert={isExitingCode || undefined}- className="flex h-full min-h-0 w-full shrink-0 flex-col overflow-y-auto px-4 pt-[max(1rem,env(safe-area-inset-top))] pb-[max(1.5rem,env(safe-area-inset-bottom))] sm:h-auto sm:justify-center sm:overflow-visible sm:p-8"+ inert={isTransitioning || undefined}+ className="flex min-h-svh w-full shrink-0 flex-col px-4 pt-[max(3rem,env(safe-area-inset-top))] pb-[max(1.5rem,env(safe-area-inset-bottom))] sm:min-h-0 sm:justify-center sm:p-8">- <div className="mx-auto my-auto w-full max-w-80 sm:my-0 sm:max-w-88">+ <div className="mx-auto w-full max-w-80 sm:max-w-88"><FieldGroup className="gap-4"><div className="mb-4 flex flex-col items-center gap-2 text-center sm:mb-0 [@media(max-height:579px)]:mb-0"><Logo size="lg" iconOnly className="size-11 justify-center rounded-lg" />@@ -530,7 +508,7 @@ function SignInForm({<SignInOtpFieldcode={code}error={otpError}- loading={loading}+ loading={loading || isTransitioning}autoFocus={!deferOtpFocus}onChange={handleVerifyCode}/>@@ -538,7 +516,7 @@ function SignInForm({variant="ghost"type="button"className="h-11 w-full sm:h-9"- disabled={isSliding}+ disabled={isTransitioning}onClick={returnToEmailStep}>Use a different email@@ -671,106 +649,14 @@ export default function SignInPageClient({const postLoginUrl = safeRedirectUrl(searchParams.get("redirect"))const accountDeleted = searchParams.get("account_deleted") === "1"const accountDeletionPending = searchParams.get("account_deleted") === "pending"- const isMobile = useIsMobile()- const mobileSlideActiveRef = useRef(false)- const syncViewportRef = useRef<(() => void) | null>(null)- const [mobileTypewriterCollapsed, setMobileTypewriterCollapsed] = useAtom(- useCreateAtom(false),- )- const [mobileViewportHeight, setMobileViewportHeight] = useAtom(- useCreateAtom<number | null>(null),- )-- const [mobileViewportTop, setMobileViewportTop] = useAtom(- useCreateAtom(0),- )-- const handleSlideActiveChange = useCallback((active: boolean) => {- mobileSlideActiveRef.current = active- if (!active) {- syncViewportRef.current?.()- }- }, [])-- useEffect(() => {- if (!isMobile) {- mobileSlideActiveRef.current = false- syncViewportRef.current = null- setMobileTypewriterCollapsed(false)- setMobileViewportHeight(null)- setMobileViewportTop(0)- return- }- let active = true- let inputFocused = false- let blurTimerId: number | null = null- const clearBlurTimer = () => {- if (blurTimerId !== null) {- window.clearTimeout(blurTimerId)- blurTimerId = null- }- }- const syncViewport = () => {- if (!active || mobileSlideActiveRef.current) return- const layoutHeight = window.innerHeight- const visualHeight = window.visualViewport?.height ?? layoutHeight- const keyboardLikelyOpen = layoutHeight - visualHeight > 80- setMobileViewportTop(keyboardLikelyOpen ? Math.round(window.visualViewport?.offsetTop ?? 0) : 0)- const shortSpace = visualHeight < 580 || (inputFocused && visualHeight < 700)- setMobileTypewriterCollapsed(keyboardLikelyOpen || shortSpace)- setMobileViewportHeight(- keyboardLikelyOpen ? Math.round(visualHeight) : null,- )- }- syncViewportRef.current = syncViewport- const onFocusIn = (event: FocusEvent) => {- if (- event.target instanceof HTMLInputElement- || event.target instanceof HTMLTextAreaElement- ) {- clearBlurTimer()- inputFocused = true- syncViewport()- }- }- const onFocusOut = () => {- inputFocused = false- clearBlurTimer()- blurTimerId = window.setTimeout(() => {- blurTimerId = null- syncViewport()- }, 50)- }- syncViewport()- window.addEventListener("resize", syncViewport)- window.visualViewport?.addEventListener("resize", syncViewport)- window.visualViewport?.addEventListener("scroll", syncViewport)- document.addEventListener("focusin", onFocusIn)- document.addEventListener("focusout", onFocusOut)- return () => {- active = false- clearBlurTimer()- syncViewportRef.current = null- window.removeEventListener("resize", syncViewport)- window.visualViewport?.removeEventListener("resize", syncViewport)- window.visualViewport?.removeEventListener("scroll", syncViewport)- document.removeEventListener("focusin", onFocusIn)- document.removeEventListener("focusout", onFocusOut)- }- }, [isMobile, setMobileTypewriterCollapsed, setMobileViewportHeight, setMobileViewportTop])return (<div- style={- isMobile && mobileViewportHeight !== null- ? { height: `${mobileViewportHeight}px`, top: `${mobileViewportTop}px` }- : undefined- }- className="fixed inset-x-0 top-0 flex h-dvh flex-col overflow-hidden p-0 sm:relative sm:h-auto sm:min-h-svh sm:items-center sm:justify-center sm:overflow-visible sm:p-8"+ className="relative flex min-h-svh flex-col p-0 sm:items-center sm:justify-center sm:p-8"><GradientBackground /><div className="flex min-h-0 w-full flex-1 flex-col sm:max-w-5xl sm:flex-none">- <Card className="min-h-0 flex-1 overflow-hidden rounded-none bg-transparent p-0 shadow-none ring-0 sm:flex-none sm:rounded-xl sm:bg-card sm:ring-1 sm:ring-foreground/10">+ <Card className="min-h-0 flex-1 overflow-visible rounded-none bg-transparent p-0 shadow-none ring-0 sm:flex-none sm:overflow-hidden sm:rounded-xl sm:bg-card sm:ring-1 sm:ring-foreground/10"><CardContent className="flex min-h-0 flex-1 flex-col p-0 sm:grid sm:flex-none sm:grid-cols-[minmax(352px,0.88fr)_minmax(0,1.25fr)]"><SignInFormpostLoginUrl={postLoginUrl}@@ -779,9 +665,6 @@ export default function SignInPageClient({accountDeletionPending={accountDeletionPending}appleEnabled={appleEnabled}initialLastUsedMethod={initialLastUsedMethod}- isMobile={isMobile}- mobileTypewriterCollapsed={mobileTypewriterCollapsed}- onSlideActiveChange={handleSlideActiveChange}/><div className="relative hidden min-h-124 overflow-hidden bg-muted sm:block"><ProductGallery />diff --git a/src/web/src/app/(auth)/sign-in/social-sign-in.dom.test.ts b/src/web/src/app/(auth)/sign-in/social-sign-in.dom.test.tsindex 1dcc674c3..4d4bd1b26 100644--- a/src/web/src/app/(auth)/sign-in/social-sign-in.dom.test.ts+++ b/src/web/src/app/(auth)/sign-in/social-sign-in.dom.test.ts@@ -70,20 +70,19 @@ const attempt = {describe("social sign-in stack and native boundary", () => {it.each([false, true])(- "starts the selected provider immediately and records last-used method, native=%s",+ "starts the selected provider without overwriting the last successful method, native=%s",async (native) => {mocks.tauri = native- const onSelectMethod = vi.fn()render(createElement(SocialSignIn, {postLoginUrl: "/c/me?tab=1",appleEnabled: true,- onSelectMethod,+ lastUsedMethod: "github",}),)await setupUser().click(button("native-oauth-apple"))- expect(mocks.remember).toHaveBeenCalledExactlyOnceWith("apple")- expect(onSelectMethod).toHaveBeenCalledExactlyOnceWith("apple")+ expect(mocks.remember).not.toHaveBeenCalled()+ expect(button("native-oauth-github")).toHaveAccessibleDescription("Last used")if (native) expect(mocks.start).toHaveBeenCalledExactlyOnceWith("apple", "/c/me?tab=1")else {expect(mocks.social).toHaveBeenCalledExactlyOnceWith({@@ -109,6 +108,7 @@ describe("social sign-in stack and native boundary", () => {})await setupUser().click(button(`native-oauth-${provider}`))expect(mocks.capture).toHaveBeenCalledOnce()+ expect(mocks.remember).not.toHaveBeenCalled()},)diff --git a/src/web/src/app/(auth)/sign-in/social-sign-in.tsx b/src/web/src/app/(auth)/sign-in/social-sign-in.tsxindex de92b9659..24a6a2de5 100644--- a/src/web/src/app/(auth)/sign-in/social-sign-in.tsx+++ b/src/web/src/app/(auth)/sign-in/social-sign-in.tsx@@ -11,13 +11,12 @@ import Image from "next/image"import { Button } from "@/components/ui/button"import { Field } from "@/components/ui/field"import { signIn } from "@/lib/auth-client"-import { rememberLastLoginMethod, type LoginMethod } from "@/lib/last-login-method"+import { type LoginMethod } from "@/lib/last-login-method"import {createNativeOauthController,nativeOauthBrowserDeps,type NativeOauthView,} from "@/lib/native-oauth-client"-import { cn } from "@/lib/utils"import {APPLE_LEFT_ALIGNED_LOGO_BLACK,APPLE_LEFT_ALIGNED_LOGO_WHITE,@@ -37,12 +36,10 @@ export function SocialSignIn({postLoginUrl,appleEnabled = false,lastUsedMethod = null,- onSelectMethod,}: {postLoginUrl: stringappleEnabled?: booleanlastUsedMethod?: LoginMethod | null- onSelectMethod?: (method: NativeOauthProvider) => void}) {const observed = useRef<Action | undefined>(undefined)const controller = useRef<ReturnType<typeof createNativeOauthController> | null>(null)@@ -69,8 +66,6 @@ export function SocialSignIn({}, [setNative])const start = (provider: NativeOauthProvider) => {- rememberLastLoginMethod(provider)- onSelectMethod?.(provider)finishAction(observed.current, "superseded")observed.current = startAction("auth_social", { capability: "limited", phase: "auth" })lastProvider.current = provider@@ -171,7 +166,7 @@ export function SocialSignIn({return (<>- <Field className="flex flex-col gap-2">+ <Field className="flex flex-col gap-3">{providers.map((provider) => {const isLastUsed = lastUsedMethod === provider.idconst badgeId = `last-used-${provider.id}-badge`@@ -182,10 +177,7 @@ export function SocialSignIn({type="button"disabled={provider.disabled}aria-describedby={isLastUsed ? badgeId : undefined}- className={cn(- "peer h-11 w-full justify-start border-0 bg-apple-signin px-4 text-sm font-medium text-apple-signin-foreground hover:bg-apple-signin hover:opacity-90",- isLastUsed && "pr-22",- )}+ className="peer h-11 w-full justify-start border-0 bg-apple-signin px-4 text-sm font-medium text-apple-signin-foreground hover:bg-apple-signin hover:opacity-90"data-testid={`native-oauth-${provider.id}`}onClick={() => start(provider.id)}>@@ -203,7 +195,7 @@ export function SocialSignIn({<spanid={badgeId}data-testid={`last-used-${provider.id}`}- className="pointer-events-none absolute top-1/2 right-3 -translate-y-1/2 rounded-full border border-apple-signin-foreground/25 bg-apple-signin-foreground/14 px-2 py-0.5 text-[11px] leading-none font-medium text-apple-signin-foreground peer-disabled:opacity-50"+ className="pointer-events-none absolute -top-2 right-3 rounded-md border border-border bg-background px-1.5 text-[10px] leading-4 font-medium text-muted-foreground peer-disabled:opacity-50">Last used</span>diff --git a/src/web/src/test/e2e-public-static-qa.test.ts b/src/web/src/test/e2e-public-static-qa.test.tsindex ccce83441..9152c7f50 100644--- a/src/web/src/test/e2e-public-static-qa.test.ts+++ b/src/web/src/test/e2e-public-static-qa.test.ts@@ -71,17 +71,24 @@ describe("public static QA immutable input and phase controls", () => {}})it("submits only once for a separately owned same-device login and retains its original failure", async () => {- const visits: string[] = [], submits: number[] = []+ const visits: string[] = [], submits: number[] = [], buttons: string[] = []const failure = new Error("UI response lost")const page = {goto: async (url: string) => { visits.push(url) },- getByRole: (role: string) => role === "textbox" ? { waitFor: async () => {}, fill: async () => {} } : role === "checkbox" ? { check: async () => {} } : { click: async () => { throw failure } },+ getByRole: (role: string, options: { name: string }) => role === "textbox" ? { waitFor: async () => {}, fill: async () => {} } : {+ click: async () => {+ buttons.push(options.name)+ if (options.name === "Sign in") throw failure+ expect(options.name).toBe("Continue with email")+ },+ },waitForURL: async () => {},} as unknown as Parameters<typeof signIn>[0]await expect(signIn(page, "[email protected]", { singleAttempt: true, onSubmission: () => { submits.push(1) } })).rejects.toBe(failure)expect(visits).toHaveLength(1)expect(visits[0]).toContain("/sign-in?redirect=/c")expect(submits).toEqual([1])+ expect(buttons).toEqual(["Continue with email", "Sign in"])})it("binds the complete precache catalogue to actual frozen worker entries and rejects ambiguity", () => {expect(builtPrecacheEntries('new SW({precacheEntries:[{"url":"/a]b","revision":"actual"}]})')).toEqual([{ url: "/a]b", revision: "actual" }])diff --git a/src/web/src/test/e2e-ui/01-auth.spec.ts b/src/web/src/test/e2e-ui/01-auth.spec.tsindex c369b783e..4d5460347 100644--- a/src/web/src/test/e2e-ui/01-auth.spec.ts+++ b/src/web/src/test/e2e-ui/01-auth.spec.ts@@ -140,11 +140,16 @@ browserTest.describe("production OTP error placement", () => {}))await page.goto("/sign-in")- const sendCode = page.getByRole("button", { name: "Continue with email" })+ await page.context().addCookies([{ name: "alook_last_login_method", value: "github", url: page.url() }])+ await page.reload()+ await browserExpect(page.getByRole("textbox", { name: "Email" })).toHaveCount(0)+ await page.getByRole("button", { name: "Continue with email", exact: true }).click()+ const sendCode = page.getByRole("button", { name: "Continue", exact: true })browserTest.skip(!(await sendCode.isVisible()), "production Email OTP UI is not active")await page.getByRole("textbox", { name: "Email" }).fill("[email protected]")await sendCode.click()+ browserExpect((await page.context().cookies()).find((cookie) => cookie.name === "alook_last_login_method")?.value).toBe("github")const stepTrack = page.getByTestId(tid.signInStepTrack)await browserExpect(stepTrack).toHaveAttribute("data-step-view", "code")@@ -152,7 +157,9 @@ browserTest.describe("production OTP error placement", () => {await otp.fill("123456")const alert = page.getByRole("alert").filter({ hasText: "Invalid OTP" })await browserExpect(alert).toHaveCount(1)+ browserExpect((await page.context().cookies()).find((cookie) => cookie.name === "alook_last_login_method")?.value).toBe("github")await browserExpect(otp).toHaveAttribute("aria-invalid", "true")+ await browserExpect(otp).toBeFocused()await browserExpect(otp).toHaveAttribute("aria-describedby", "sign-in-otp-error")const slots = page.locator('[data-slot="input-otp-slot"]')@@ -199,11 +206,12 @@ browserTest.describe("production OTP error placement", () => {await browserExpect(stepTrack).toHaveAttribute("data-step-view", "email")await browserExpect(alert).toHaveCount(0)await browserExpect(page.getByRole("textbox", { name: "Email" })).toBeVisible()- await page.getByRole("button", { name: "Continue with email" }).click()+ await page.getByRole("button", { name: "Continue", exact: true }).click()await browserExpect(stepTrack).toHaveAttribute("data-step-view", "code")await otp.fill("654321")await page.waitForURL("**/c/me")+ browserExpect((await page.context().cookies()).find((cookie) => cookie.name === "alook_last_login_method")?.value).toBe("email")browserExpect(attempts).toEqual(["123456", "111111", "654321"])})@@ -230,7 +238,8 @@ browserTest.describe("production OTP error placement", () => {})await page.goto("/sign-in")- const sendCode = page.getByRole("button", { name: "Continue with email" })+ await page.getByRole("button", { name: "Continue with email", exact: true }).click()+ const sendCode = page.getByRole("button", { name: "Continue", exact: true })browserTest.skip(!(await sendCode.isVisible()), "production Email OTP UI is not active")const email = page.getByRole("textbox", { name: "Email" })@@ -262,6 +271,7 @@ browserTest.describe("production OTP error placement", () => {browserExpect(alertBox!.y).toBeGreaterThanOrEqual(inputBox!.y + inputBox!.height)browserExpect(alertBox!.y + alertBox!.height).toBeLessThanOrEqual(sendBox!.y)await browserExpect(page.getByRole("button", { name: /Wait \d+s/ })).toBeDisabled()+ await page.getByRole("button", { name: "Back", exact: true }).click()await browserExpect(page.getByRole("button", { name: "Continue with GitHub" })).toBeVisible()await browserExpect(page.getByRole("button", { name: "Continue with Google" })).toBeVisible()})diff --git a/src/web/src/test/e2e-ui/25-community-ws-reconnect-overlay.spec.ts b/src/web/src/test/e2e-ui/25-community-ws-reconnect-overlay.spec.tsindex 60b50c600..2ca670d99 100644--- a/src/web/src/test/e2e-ui/25-community-ws-reconnect-overlay.spec.ts+++ b/src/web/src/test/e2e-ui/25-community-ws-reconnect-overlay.spec.ts@@ -269,6 +269,7 @@ let caseJourneyFailure1Present = falsetry {await installUserWsAuthConsumedBarrier(page)await page.goto("/sign-in")+ await page.getByRole("button", { name: "Continue with email", exact: true }).click()await page.getByRole("textbox", { name: "Email" }).fill(`guide-reconnect-${process.pid}-${Date.now()}@example.com`,)diff --git a/src/web/src/test/e2e-ui/31-machine-guide-motion.spec.ts b/src/web/src/test/e2e-ui/31-machine-guide-motion.spec.tsindex 8e649dd5e..af2128cb7 100644--- a/src/web/src/test/e2e-ui/31-machine-guide-motion.spec.ts+++ b/src/web/src/test/e2e-ui/31-machine-guide-motion.spec.ts@@ -4,6 +4,7 @@ import { tid } from "./_fixtures/testids"test("first-signup mobile starts onboarding once and retains it on desktop", async ({ page }) => {await page.setViewportSize({ width: 390, height: 844 })await page.goto("/sign-in")+ await page.getByRole("button", { name: "Continue with email", exact: true }).click()await page.getByRole("textbox", { name: "Email" }).fill(`direct-onboarding-mobile-${process.pid}-${Date.now()}@example.com`,)@@ -31,6 +32,7 @@ test("first-signup mobile starts onboarding once and retains it on desktop", asytest("first-signup desktop opens onboarding before the empty Machines guide", async ({ page }) => {await page.setViewportSize({ width: 1280, height: 800 })await page.goto("/sign-in")+ await page.getByRole("button", { name: "Continue with email", exact: true }).click()await page.getByRole("textbox", { name: "Email" }).fill(`direct-onboarding-desktop-${process.pid}-${Date.now()}@example.com`,)diff --git a/src/web/src/test/e2e-ui/_setup/auth.ts b/src/web/src/test/e2e-ui/_setup/auth.tsindex d8bfbdc31..71d8b5419 100644--- a/src/web/src/test/e2e-ui/_setup/auth.ts+++ b/src/web/src/test/e2e-ui/_setup/auth.ts@@ -18,6 +18,7 @@ export async function signIn(page: Page, email: string, options: { singleAttemptfor (const url of attempts) {await page.goto(url, { waitUntil: "load" })try {+ await page.getByRole("button", { name: "Continue with email", exact: true }).click()const emailInput = page.getByRole("textbox", { name: "Email" })await emailInput.waitFor({ state: "visible", timeout: 15_000 })await emailInput.fill(email)