ADR-WEB-16. App shell, sign-in, age and account-linking screens
Source:
docs/decisions/ADR-WEB-16-app-shell-and-auth-screens.md. Generated at build time; edit the source file.
Date: 2026-11-22 Status: Accepted (Task 21, review fix round 1)
Context
Section titled “Context”Task 21 builds the first screens a person sees: sign-in, the age question, the under-13 block and the accounts page. It also builds the signed-in shell that the dashboard, games list and game view (M5a, the owner’s next goal) will live in. Lichess accounts are deferred (ADR 0040), and Task 18 (Lichess OAuth and the provider fakes) has not been built.
Decision
Section titled “Decision”- Routes.
(auth)holds/sign-in,/sign-in/check-email,/welcome/ageand/blocked.(app)holds/app(Dashboard),/app/games(Games) and/app/accounts./redirects to/app/accountswhen signed in and to/sign-inotherwise. Dashboard and Games are quiet placeholder pages, so their nav entries and routes are already final and M5a only replaces theirpage.tsx. - The address a link went to never travels in a URL (review I1). A successful
POST /sign-in/magic-linksetsci_pending_email(HttpOnly, SameSite=Lax,Max-Age=600,Path=/sign-in/check-email).src/proxy.tshands it to that page once as a request header (dropping any copy the browser sent) and clears the cookie. The page reads nothing from the URL, and without the cookie it says “your email”. The same cookie is set for invited and uninvited addresses. - Shell.
(app)/layout.tsxcallsrequireUser()and renders the sticky header (components in the private folder(app)/_shell/, which can never become a route): the wordmark, the nav (_shell/nav.ts: Dashboard, Games, Accounts), an emptydata-slot="activity"for Task 27, the command-menu trigger (Ctrl K), the theme toggle and the user menu with “Sign out”. Every page callsrequireUser()again, so none relies on the layout alone. - Motion (DESIGN.md):
- The ink rule under the current section slides to the next one on the
pagespring (it shows where you went, M1). (app)/template.tsxruns the incoming half of the page turn (choreography 5) on client navigations only. The first paint is the server render, never a hidden page waiting for JavaScript. The outgoing half needs the View Transitions work and is left for later.- The signed-out pages show a real board at every width (beside the form from
lg, under it on phones). Sign-in and check-email show the Opera game after 9…b5?, with the pen ring and?badge drawing on load. The age step shows the same game a move earlier with no marks, because the pen is reserved for a mistake. /blocked shows the starting position. - A newly verified account’s badge lands on
land. - Every async button names its work (“Sending link”, “Checking”) and soaks an ink line along its foot (
PendingButton). No spinners (B18).
- The ink rule under the current section slides to the next one on the
- Lichess stays hidden until it is configured. “Continue with Lichess” and “Connect Lichess” render only when
lichessProvider(env)returns a provider, which the Task 18 stub never does. The Lichess e2e step isfixmeunlessE2E_LICHESS=1. Once Task 18 lands, the UI needs no changes. - Check again waits for chess.com’s per-username minute. After a start that returned a code, the button stays unavailable for 60 s, with a visible countdown. After a pending check, it waits until the server’s
nextCheckAt(Task 19 hand-off). - The e2e fakes.
test/fakes/{chesscom.ts,main.ts}serve only the chess.com half of Task 18’s fake contract:/chesscom/pub/player/:u,POST /chesscom/__set-location, plusPOST /chesscom/__reset. Task 18 adds the Lichess routes tomain.ts. - Providers.
providers.tsxnow mounts the TanStackQueryClientProviderand the oneToaster, which this task’s mutations and toasts need. Task 27 adds the realtime provider next to them. - E2E state. The e2e web service uses its own database,
chess_e2e_test, never the devchessdatabase that holds analysed games. A PlaywrightglobalSetupcreates, migrates and empties it, empties Mailpit and resets the fakes, so a fresh compose project works. Theqaservice shares web’s network namespace (docker-compose.e2e.yml). The production-build e2e and env-driven limits are handed to T24 and T28. - The e2e invite list also holds
adult@example.invalidandkid@example.invalid. Each sign-in in a run uses its own address, which keeps each run within the per-email throttle (3 per 10 minutes, ADR-WEB-3). The shared in-memory IP limit of 3 per 10 minutes still applies. To run the suite again within 10 minutes, restartweb.next devcompiles each route on its first request, so the suite runs one worker, and Playwright’s expect timeout is 15 s.
Consequences
Section titled “Consequences”- M5a can add its pages inside the shell without touching navigation.
- The accounts list uses the inline key
["accounts"](accountsKey) until Task 23’squeryKeys.accounts()exists. Task 27 swaps it in. - An under-13 browser keeps seeing the blocked notice on
/sign-infor as long as the 30-day cookie lasts (ADR-WEB-6).