Repository navigation
Give the app three root layouts, and unmatched addresses a styled 404 - #898
Conversation
A signup's pages will need to say lang="sv" for a Swedish signup, but with one root layout the only way to know the language would be to read the request there, which would make every page dynamic, the prerendered help and legal pages included. Split the single root layout into three, in route groups so no address changes: (site) for the home, help and legal pages, (organizer) for /app, /login and /oauth, and s/[slug] for a signup's pages, which absorbs the old s/layout.tsx and its footer. All say lang="en" for now. What they share (metadata, viewport, the font, globals.css and the <html> element) lives in src/app/root-shell.tsx. With no layout above them, Next's built-in 404 would render in a bare document with no lang, so turn on experimental.globalNotFound with src/app/global-not-found.tsx: a prerendered, styled 404 built on the shared StateCard, with the site footer. Next applies a title template only below the segment that defines it, and the signup page shares its segment with its new root layout, so it now writes the site name into its own tab title. The root layouts and the home page name the share image themselves, since the image files in src/app no longer reach any page on their own. Fixes #621. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Tophat: passedI ran a885352 as a production build (
For the owner: the only change people will see is the page for an address that doesn't exist. It used to be Next's bare "404 / This page could not be found." Now it's the app's own card, the same style as the signup's "no longer available" page: "Sorry, we can’t find this page", "Check the address for typos. If someone sent you the link, ask them for a new one.", a Go to the home page link and the usual footer, with the tab titled "Page not found · OpenSignup". Everything else looks the same. Two differences don't change how anything looks. Clicking between areas (organizer app ↔ help/home ↔ a signup page) now reloads the whole page instead of swapping it in place. And the share-image URL loses its Screenshots are in https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt. Generated by Claude Code |
richshaw
left a comment
There was a problem hiding this comment.
Review: changes needed (round 1)
The PR splits the single root layout into three ((site), (organizer), s/[slug]) around a shared root-shell.tsx, and gives unmatched addresses a styled 404 through experimental.globalNotFound. The split itself is sound. Everything the old layout held (metadata, viewport, font variable, globals.css, suppressHydrationWarning, body classes) is in the shell once and reaches every page; the participant footer moved into the s/[slug] layout unchanged; no page sits outside the three groups; and no stale path is left in code, configs, docs or skills. Both metadata fixes the builder made are right. Two things need changing: a false warning the move introduces in every build and server log, and a missing test for one of those fixes.
Blocking (2):
src/app/root-shell.tsxlines 24–27: the build and every server start now warn thatmetadataBaseis not set and share images usehttp://localhost:3000. The tags are right, the warning is false, andmaindoesn't print it. Moving the four share-image files topublic/removes it with no change to any tag (tried).tests/e2e/root-layouts.spec.tsline 43: nothing testsog:imageon a page that sets noopenGraph(/app,/login, the 404), which is the regressionrootMetadata'simagesfixes.
Optional (4):
src/app/(organizer)/app/(chrome)/layout.tsxline 21: Sign out is now a server-action redirect from one root layout to another (/app→/). I ran it against the production build: it lands on the home page with no console errors, and/appthen redirects to/login. No e2e covers it; a short one would catch a Next upgrade breaking it.src/lib/seo.tsline 34: without Next's?hash, a preview service that has cached the image keeps the old one if the picture is ever redrawn. Help and legal were already like this, so it isn't a new kind of problem. If the image changes, rename the file or add a version query inSHARE_IMAGES, the one place that names it.src/app/(organizer)/layout.tsx: the organizer and site groups have nonot-found.tsx. Nothing in them callsnotFound()today except/help/[slug], which gets the global 404 (the e2e checks it). A laternotFound()from an organizer page would show Next's bare text inside the layout, as it would have onmain.src/app/s/[slug]/page.tsxline 28:tabTitleis correct, and/s/[slug]/page.tsxand(site)/page.tsx(alreadytitle.absolute) are the only two pages that share a segment with a root layout, so no other page loses the template. The e2e pins the signup title.
Earlier threads: none. Copilot answered that it couldn't review (quota).
Checks: CI is green on a885352 (lint-type-test, e2e, CodeQL). Tophat passed on this SHA and nothing has changed since. Locally, against a production build of this branch and one of main: root-layouts and a11y specs (12 passed); the route table (/help, /privacy, /terms, /cookies, /_not-found are ○, /help/[slug] is ●); every page's og:image, canonical, icons and manifest with the server on a port other than the configured origin's; the sign-out flow; and the proposed fix for the warning.
What I checked and found right:
- Static pages and
getEnv(). The shell, the 404 andSiteFooterread onlysite-configand build info. Nothing reads the request. globalNotFound. It survives the next-intl plugin wrapper (/_not-foundis prerendered and serves the new page withlang="en", 404 andnoindex). The fallback named innext.config.mjsis the one the issue gives.- next-intl.
src/i18n/request.tsis unchanged and nothing calls next-intl's server functions. - Ready for #628.
RootShelltakeslangas aCatalogLocale, and thes/[slug]layout is a server component that can takeparamsand read the signup through the same cached loader the page uses.
For the owner (gate: owner, UX): once the two items above are fixed and this passes again, the thing to look at is the new 404 page: the tophat's screenshots 898-404-desktop, 898-404-phone and 898-404-before-after-desktop. Its wording is "Sorry, we can’t find this page", "Check the address for typos. If someone sent you the link, ask them for a new one.", and Go to the home page. The fix for the warning moves the share images to public/, which departs from the issue's "share images stay in src/app/"; their addresses don't change.
https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Generated by Claude Code
…-layouts # Conflicts: # src/app/(organizer)/app/(chrome)/settings/connected-apps/grant-date.test.ts # src/app/(organizer)/app/(chrome)/settings/connected-apps/grant-date.ts
…eir own The share image files were still metadata files of the src/app segment, which no longer has a layout, so every build and server start warned that metadataBase was unset and fell back to localhost, though every page names the image itself through rootMetadata or pageMetadata. As plain files in public/ they keep the same two addresses and the warning is gone. The seo test, the comments and the image generator follow them. The root-layouts e2e now checks og:image and twitter:image on pages that set no openGraph of their own (/app, /login, an edit link and the 404), which fail without the images in rootMetadata, and that Sign out from /app lands on the home page with no console errors and leaves /app asking to sign in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Round 1 review addressed (
|
Tophat: passed (round 2)I ran 96ff5e9 as a production build (
Do the new
One more difference from For the owner: this round changes nothing a person sees, beyond the new 404 page round 1 showed. The share images serve the same bytes at the same addresses, and every link preview's tags are unchanged. The deploy log no longer shows the false Screenshots are in https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt. Generated by Claude Code |
richshaw
left a comment
There was a problem hiding this comment.
Review: passed (round 2)
Since round 1 the PR has one commit of its own (96ff5e9) and a merge of main. The commit moves the four share-image files from src/app/ to public/, updates the five places that named their old path, and adds e2e checks for the share image on pages with no openGraph of their own and for Sign out. Both round 1 findings are fixed by the code, and the changes are small and correct.
Blocking (0): none.
Optional (3):
Dockerfileline 55: the comment on theCOPY … /app/public ./publicline says only the help screenshots live there. The share images now depend on that line too. The PR rightly leaves the Dockerfile alone; the comment can be widened the next time that file changes.tests/e2e/root-layouts.spec.tsline 34:expectShareImagechecks that the tags name the two addresses, not that the addresses answer.seo.test.tsreads both files frompublic/, so a deleted or misplaced file fails a unit test, and the tophat fetched both. Arequest.getbeside the icon and manifest checks would close the gap.public/opengraph-image.alt.txt,public/twitter-image.alt.txt: now served as pages. They hold the sentence every page already sends asog:image:alt, so nothing is disclosed. They could sit besideseo.test.ts, their only reader, if the owner would rather not serve them.
Earlier threads: all resolved (2 of 2).
- False
metadataBasewarning (src/app/root-shell.tsx): the files are inpublic/and noopengraph-imageortwitter-imagefile is left undersrc/app/, so Next has no metadata file without ametadataBase. No route and no other file in the repo claims either address. The tophat's build and server logs show no warning. - No test of
og:imageon pages withoutopenGraph(tests/e2e/root-layouts.spec.ts):expectShareImageruns on/app,/login, an edit link and the four 404 addresses. The 404'smetadataspreadsrootMetadata, so all six tests depend on itsimageslines.
What I checked in this round's changes:
Cache-Control: public, max-age=0on the images: agreed, harmless. Link-preview services keep their own copy. Browsers and CDNs revalidate with a 304. It also answers round 1's optional point about a redrawn image staying cached under an address with no version.- Dockerfile: line 56 already copies
public/into the runner image and.dockerignoredoesn't exclude it. The tophat ran the standalone server that way and both images answered 200. scripts/generate-og-image.mjs: I ran it. It writes the two share images topublic/andapple-icon.pngtosrc/app/, and the working tree was unchanged afterwards, so all three files are byte-identical to the committed ones.- Stale paths: none. Every mention of the image files in code, scripts, docs and skills names
public/or the public address. - The merge of
main: the only conflict was #896'sgrant-date.tsand its test, now insrc/app/(organizer)/app/(chrome)/settings/connected-apps/, with the same content as onmain. Every filemainhas undersrc/app/exists on this branch at its new path.src/app/app/,login/andoauth/are gone from the old place.grant-date.test.tsruns and passes from the new folder. - PR description: it says the move departs from #621's "share images stay in
src/app/" and why, and the CHANGELOG entry covers the image addresses.
Checks: CI is green on 96ff5e9 (lint-type-test, e2e, CodeQL). Tophat round 2 passed on this SHA, and no runtime code has changed since (shared check prints 0). Locally: seo.test.ts, page-metadata.test.ts and grant-date.test.ts (24 passed), and the image generator as above.
For the owner (gate: owner, UX): the one thing people will see is the new page for an address that doesn't exist: "Sorry, we can’t find this page", "Check the address for typos. If someone sent you the link, ask them for a new one.", and Go to the home page. The tophat's screenshots are 898-r2-404-desktop and 898-r2-404-phone, with round 1's 898-404-before-after-desktop. Two decisions are worth a look: the share images now live in public/, which #621 said not to do (their addresses and bytes are unchanged), and moving between the organizer app, the site pages and a signup now loads the whole page. After this merges, the pipeline skill's high-risk list should name src/app/(organizer)/login/ where it says src/app/login/.
https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Generated by Claude Code
main moved on by 62 commits since this branch was built: the whole localization stack (#897 to #999) plus #806, #890, #983 and #984. Files main added in folders this branch moved now sit in the route groups: eleven under src/app/(organizer)/app/(chrome)/, six under src/app/(organizer)/login/ and one under src/app/(organizer)/oauth/. main's footer `locale` on src/app/s/layout.tsx moves into src/app/s/[slug]/layout.tsx, which absorbed it, and the global 404 passes one too. CHANGELOG.md keeps both sides' entries, CLAUDE.md the new consent paths and main's Languages line, and a11y.spec.ts both new tests. The lint rule lists in eslint.config.mjs, the file list in no-hard-coded-text.test.ts, two test imports and two comments now name the new paths. The signup page's metadata test expects the tab title the page writes itself (`title.absolute`), as it does on this branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
A signup's page and its edit link's page now load one layout's chunk where there were two (src/app/s/layout.tsx folded into s/[slug]/layout.tsx). Measured on a production build with main merged, against main's own CI run: /s/[slug] 129.3 to 129.1 kB, /s/[slug]/c/[id] 113.6 to 113.4 kB. Their budgets come down by the same 0.2 kB, to 130.3 and 113.5, so the saving stays saved. No other page changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Brought up to date with
|
| File | Kind | Resolution |
|---|---|---|
CHANGELOG.md |
content | Kept both. This PR's entry goes first under Changed, then main's new entries. |
CLAUDE.md |
content | OAuth "Where things live": kept this PR's (organizer) paths and added main's new Languages bullet under it. |
src/app/s/[slug]/page.tsx |
content | main now titles a signup that can't load from the catalog, in the signup's language (signupLocaleForSlug). That title is now wrapped in this PR's tabTitle(): { title: tabTitle(t('title')), robots }. Everything else auto-merged: the og:locale from openGraphLocale, <main lang={locale}> and tabTitle(sig.title). |
src/app/s/layout.tsx |
modify/delete | main gave its footer locale="en" (SiteFooter's locale is now required). This PR folded that layout into src/app/s/[slug]/layout.tsx, so <SiteFooter locale="en" /> moves there, with a comment that it stays English like <html lang> until both take the signup's language (#628). src/app/global-not-found.tsx passes locale="en" too. |
tests/e2e/a11y.spec.ts |
content | Both sides added a test in the same place. Kept main's Swedish-signup test and its loop over the commit dialog in three languages, and this PR's 404 axe test. |
tests/e2e/responses.spec.ts |
content | main's new imports (cancelledPage, getTestTranslator), with removeRefusal imported from the (organizer) path. |
18 files main added in folders this PR moved |
file location | Placed in git's suggested route group, below. Each matches main's content byte for byte. |
One more fix that git couldn't flag: src/app/s/[slug]/page.test.tsx (new on main) expected the plain metadata title. With this PR the page writes the site name into its own tab title (title.absolute), because it shares a segment with its root layout. Three expectations now use the same tabTitle shape, with a comment.
Files moved into the route groups (added by main in the old folders)
src/app/(organizer)/app/(chrome)/:
layout.test.tsxpage.test.tsxsettings/actions.tssettings/actions.db.test.tssettings/page.test.tsxsettings/connected-apps/page.test.tsxsettings/connected-apps/refusal-lines.tssignups/[id]/build/page.test.tsxsignups/[id]/responses/page.test.tsxsignups/[id]/settings/page.test.tsxsignups/new/page.test.tsx
src/app/(organizer)/login/:
page.test.tsxcheck/page.test.tsxcode-refusal.tscode-refusal.test.tslogin-text.tslogin-text.test.ts
src/app/(organizer)/oauth/consent/[uid]/:
page.test.tsx
git ls-files lists nothing left under src/app/app/, src/app/login/, src/app/oauth/, src/app/(help)/, src/app/(legal)/, src/app/_components/, src/app/page.tsx, src/app/layout.tsx or src/app/s/layout.tsx. Addresses are unchanged: route groups don't change URLs, and the full e2e suite below loads every area.
Config and doc paths fixed
eslint.config.mjs: all 11TRANSLATEDentries undersrc/app/app/(chrome)/,src/app/loginandsrc/app/oauthnow point into(organizer).filesAtthrows on a path that doesn't exist, so lint passing confirms every entry.CLIENT_SAFE_I18Nlists onlysrc/i18nmodules, so it needed nothing.src/i18n/no-hard-coded-text.test.ts: 24 entries inTRANSLATED_FILES. The test checks that both no-hard-coded-text rules are on for each listed file.- Test imports:
src/lib/organizer-reasons.test.ts(3),tests/e2e/organizer-language.spec.ts(grant-date) andtests/e2e/responses.spec.ts. - Comments naming
src/app/login/code-refusal.ts:src/lib/errors.tsandsrc/auth/login-code.db.test.ts. CLAUDE.md: the OAuth consent and connected-apps paths, through the conflict above.- Checked and unchanged:
knip.jsoncnames no app paths.src/middleware.tsmatches URLs (/app,/s), not files.docs/,.claude/skills/(help-pages,run-opensignup,translate),scripts/, the e2e helpers, and the Playwright and vitest configs name no moved path.- A repo-wide search for every old path string finds none outside
CHANGELOG.mdhistory, and none there either.
The stack's language work survived the move: <main lang> on the signup, edit and Preview pages, lang on the organizer app's frame, the footer's locale, and og:locale in the signup page's generateMetadata. Every <html lang> is still en. Making it follow the language is #938 (organizer) and #628 (participant), not this PR.
Budgets
pnpm budgets passes. Against main's own CI run on cf0b62f, only the two participant pages change: one layout chunk where there were two.
/s/[slug]: 129.3 → 129.1 kB./s/[slug]/c/[id]: 113.6 → 113.4 kB.
Every other page measures the same as on main. Following CLAUDE.md, 908e422 lowers both budgets by the 0.2 kB saved: /s/[slug] 130.5 → 130.3, /s/[slug]/c/[id] 113.7 → 113.5. The CHANGELOG entry says so. No budget is raised. The statement budgets (query-budget.db.test.ts) pass unchanged.
Checks (on the merged tree, 908e422)
pnpm lint,pnpm format:check,pnpm typecheck,pnpm knip: pass.pnpm test: 239 files, 3422 passed, 1 expected fail.pnpm test:db: 47 files, 857 passed.pnpm build: pass, nometadataBasewarning.pnpm budgets: pass, as above.- The full chromium e2e suite against the production build (
--trace off): 204 passed, 2 skipped, 32 spec files. That includesroot-layouts,a11y(404 and Swedish),organizer,organizer-language,organizer-language-story,sign-in-text,oauth-consent,swedish-signup,signup-not-found,precompiled-messages,response-headers,responsesand all four help walkthroughs.
Routing: pipeline:tophat (with pipeline:ux kept). pipeline:owner is removed so the new review decides the gate again. This PR's diff has grown by the 18 moved files and the path fixes, so the tophat should look at the organizer screens and sign-in in the route groups, a Swedish signup's pages and footer, and the 404.
Note for the owner: the account pipeline skill's high-risk path list names src/app/login/. With this PR the sign-in code lives in src/app/(organizer)/login/, so that list needs the new path when this merges. The list isn't in this repo, so I couldn't change it here.
https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Generated by Claude Code
Tophat: passed (round 3, after the localization merge)I ran 908e422 as a production build (
For the owner: nothing changes for people beyond the 404 page earlier rounds showed. After the merge of the localization stack, every page I compared, English and Swedish, signed in and out, is pixel-identical to Screenshots are in https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt. Generated by Claude Code |
richshaw
left a comment
There was a problem hiding this comment.
Review: passed (round 3)
Since round 2 the PR has a merge of main at cf0b62f (45697ce, the whole localization stack) and one commit of its own (908e422, two budgets lowered). I reviewed the merge as if it were new code: where every file landed, whether anything from the stack was lost, and whether the lint and test path lists still cover what they covered on main. It is a clean merge. Against main, the PR is still what rounds 1 and 2 passed: three root layouts around root-shell.tsx, the global 404, and the share images in public/.
Blocking (0): none.
Optional (3):
- The PR description is out of date. It says the PR "stands beside the localization stack, based on
main", "pnpm budgets: no budget changes" with the old 125.5 → 125.3 and 110.0 → 109.8 figures, and the test counts from rounds 1 and 2. The stack is now merged in, two budgets are lowered (130.5 → 130.3, 113.7 → 113.5) and the numbers are 129.1 and 113.4 kB. The "Brought up to date" comment has it right. The description becomes the squash commit's message, so the merge step should rewrite those lines. src/app/(organizer)/layout.tsxline 8 andsrc/app/s/[slug]/layout.tsxline 9: the comments say "English until organizers have a language of their own (#619)" and "until signups have a language of their own". With the stack merged, both already have one; what still waits is<html lang>and the footer (#938, #628). Those PRs rewrite these lines, so it isn't worth a round.src/app/global-not-found.tsx: the 404's text is English fromnot-found-message.ts, and the file isn't inTRANSLATED. That's right while every<html lang>isenand the page is prerendered. A Swedish organizer sees it in English, as they saw Next's page onmain.
Earlier threads: all resolved (2 of 2). Copilot answered in round 1 that it couldn't review (quota).
What I checked in the merge:
- Every file landed in the right group, unchanged.
git diff cf0b62f 908e422 -Mhas 93 renames: 91 at 100%, and the two this PR edits on purpose ((site)/page.tsxfor the share image, the cookies test's relative path). All 88 filesmainhas undersrc/app/app,login,oauth,(help),(legal)and_componentsare renamed, each to the same path under(organizer)or(site). Nothing is left in the old folders, and nothing undersrc/app/sits outside a root layout except the files that belong there (icons, fonts,globals.css, manifest, robots, sitemap, the shell, the 404 and two tests). - No stack change was lost. Because the moved files are byte-identical to
main's,langon<main>and the organizer frame, the catalog calls and the refusal helpers are intact.s/[slug]/page.tsxdiffers frommainonly bytabTitle()on its two titles;og:localefromopenGraphLocale,<main lang={locale}>andsignupLocaleForSlugare there.main's root layout was stilllang="en"with the same metadata, viewport, font and body classes thatroot-shell.tsxholds. s/layout.tsx(modify/delete).main's only change to it was<SiteFooter locale="en" />, now ins/[slug]/layout.tsxwith the same wrapper. That layout is above every participant page: the signup,c/[id],unsubscribeand bothnot-found.tsxfiles, so each still gets the footer./salone has no page and gets the global 404, which has its own footer. The tophat found all of them pixel-identical tomain, English and Swedish.- The lint covers exactly what it did on
main. I asked ESLint for its config for every.tsand.tsxfile undersrc/oncf0b62fand on this head. The same 151 files havereact/jsx-no-literalsandopensignup/no-literal-text-propson in both, plus the news/[slug]/layout.tsx. I also added a hard-coded string andaria-labelto four moved files (login/page.tsx, the consent form, Your signups, the Responses page): lint failed on both rules in all four, then I restored them. - Other path lists.
TRANSLATED_FILESinno-hard-coded-text.test.tshas the 24 new paths and passes.CLIENT_SAFE_I18Nandknip.jsoncname no app paths. The middleware matcher is URLs (/app,/s), which route groups don't change. No old path string is left insrc/,tests/,docs/,scripts/,.claude/,.github/or the configs. CLAUDE.md's Routes, OAuth and trust-docs paths are updated andmain's Languages bullet is kept. - Budgets are measured. My build gives
/s/[slug]129.1 kB and/s/[slug]/c/[id]113.4 kB, 0.2 kB undermain's 129.3 and 113.6, and the budgets come down by the same 0.2. Nothing is raised. - The usual. The CHANGELOG entry is under Unreleased → Changed and names the 404, the full page loads, the image addresses and the budgets. No personal data, secrets or model names in the diff or commit messages. The branch was merged into, not rebased.
Checks: CI is green on 908e422 (lint-type-test, e2e, CodeQL). Tophat round 3 passed on this SHA, and nothing has changed since. Locally on 908e422: pnpm lint, pnpm format:check, pnpm typecheck, pnpm knip, pnpm test (239 files, 3422 passed, 1 expected fail), pnpm test:db on a fresh migrated database (47 files, 857 passed), pnpm build (no metadataBase warning; /_not-found, /help, /privacy, /terms, /cookies are ○, /help/[slug] is ●) and pnpm budgets (pass).
For the owner (gate: owner): it's UX, for the new 404 page, and it moves the sign-in pages and the OAuth consent screen (src/app/login, src/app/oauth) into (organizer), byte for byte. No owner-approval marker is on the PR for this head, so I've left it at pipeline:owner and not moved it to merge. What to look at: the tophat's 898-404-main-vs-pr-desktop and 898-404-main-vs-pr-phone. After it merges, the pipeline skill's high-risk list should say src/app/(organizer)/login/ where it says src/app/login/.
https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Generated by Claude Code
|
Approved by the owner at The owner approved merging this with the localization stack in the orchestrating session on 15 November 2026. https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt Generated by Claude Code |
CHANGELOG.md conflicted where both sides added a line at the top of Changed. Kept both: this PR's line first, then #898's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Fixes #621.
The stack
Part of the localization work (#619), based on
main. The localization stack has landed onmain, andmainis merged into this branch atcf0b62f. Every<html lang>still saysen: #628 makes the participant root layout (src/app/s/[slug]/layout.tsx) use the signup's language, and #938 makes the organizer one use the organizer's.The problem
src/app/layout.tsxwas the only root layout and hard-coded<html lang="en">. A Swedish signup's pages will needlang="sv"(WCAG 3.1.1), but a single layout above every page can't see a signup's slug, and reading the request there would make every page dynamic, including the prerendered help and legal pages.The fix
lang="en"for now.src/app/(site)/layout.tsx:/,/help/**,/privacy,/terms,/cookies. The existing(help)and(legal)groups, with theirforce-staticlayouts, now sit inside(site).src/app/(organizer)/layout.tsx:/app/**,/login/**,/oauth/**.src/app/s/[slug]/layout.tsx: a signup's pages. It absorbssrc/app/s/layout.tsxand its footer.src/app/root-shell.tsxholds what they share:rootMetadata,rootViewport(theme colour), the font variable,globals.css, andRootShell, the<html>/<body>withsuppressHydrationWarning.RootShelltakeslangas aCatalogLocale, ready for Public signup pages always say lang="en", whatever the signup's language #628.experimental.globalNotFound(inside the next-intl plugin wrapper, which keeps it) withsrc/app/global-not-found.tsx, prerendered (○ /_not-found). It's the sharedStateCard, centred like the participant not-found page, plus the site footer: "Sorry, we can’t find this page", "Check the address for typos. If someone sent you the link, ask them for a new one.", and Go to the home page. The copy is insrc/app/not-found-message.tsso the e2e can import it. A signup's own not-found pages are unchanged.manifest.ts,robots.tsandsitemap.tsstay insrc/app/.public/(opengraph-image.png,twitter-image.pngand their.alt.txt), at the same two addresses. This departs from Every page is marked lang="en", and with one root layout a page can't declare its own language #621, which says the share images stay insrc/app/. That assumed they would still attach to pages as metadata files, and they don't (next section): every page now names them itself. Left insrc/app/, they belonged to a segment with no layout and so nometadataBase, and everypnpm buildand every server start warned that the share images usedhttp://localhost:3000, which was false and would worry anyone reading a deploy log.scripts/generate-og-image.mjsnow writes them topublic/(andapple-icon.pngtosrc/app/as before); the Dockerfile already copiespublic/./now namesSHARE_IMAGES(new insrc/lib/seo.ts, also used bypageMetadata), and the/exemption inpage-metadata.test.tsis gone. That test now checks the exact images on every indexable page.Found while building, not in the issue
src/app/opengraph-image.pngto thesrc/appsegment, and each root layout'sopenGraph(one segment down) replaces it, so/login,/app, edit links, unsubscribe and other pages that set noopenGraphwould have lost their share image.rootMetadatanames the image itself. One visible side effect: those pages'og:imageandtwitter:imageare now/opengraph-image.pngwithout Next's version query (?abc123), as help and legal already were. Served frompublic/, the two images now carryCache-Control: public, max-age=0rather than a year ofimmutable, so a redrawn image isn't stuck in browser and CDN caches under the unversioned address./s/[slug]/page.tsxshares its segment with its new root layout, so "Bake Sale · OpenSignup" became "Bake Sale". The page now writes the site name into its own title (title.absolute), with a comment. The new e2e spec checks it.next devand a page outside the groups. I tried it: dev quietly writes a barelayout.tsxbeside the page, with no shell and nolang. CLAUDE.md's Routes section now describes the three layouts and says this.CLAUDE.md, the design-system READMEs,responses.spec.ts,no-hard-coded-text.test.ts(itsfilesAtcheck needs a folder that exists), and the cookies page test's relative path tosrc/auth/config.ts. Mergingmainbrought Give the other formatters a language #896'sconnected-apps/grant-date.tsand its test into the oldsrc/app/app/folder; they now sit insrc/app/(organizer)/app/…beside the page that imports them. Mergingmainatcf0b62f(the localization stack) brought 18 more files thatmainhad added in the old folders; they now sit in(organizer)(11 underapp/(chrome)/, 6 underlogin/, 1 underoauth/consent/[uid]/), byte for byte as onmain. TheTRANSLATEDlist ineslint.config.mjsandTRANSLATED_FILESinno-hard-coded-text.test.tspoint at the new paths, and the footer'slocale="en"moved intosrc/app/s/[slug]/layout.tsx.What stayed the same, measured
I built
main(4064146) and this branch and compared them. After the merge ofmainatcf0b62f, the budgets below were measured again, and the tophat found every page it compared (42 addresses, English and Swedish, at two sizes) identical tomainapart from the 404s.○/●/ƒis identical./help,/privacy,/terms,/cookiesand/_not-foundstay○,/help/[slug]stays●. Since the share images moved,/opengraph-image.pngand/twitter-image.pngare static files rather than listed routes.pnpm budgets: two budgets lowered, none raised. Againstmainatcf0b62f,/s/[slug]measures 129.1 kB instead of 129.3 and/s/[slug]/c/[id]113.4 kB instead of 113.6 (one layout's chunk where there were two), so their budgets come down from 130.5 to 130.3 kB and from 113.7 to 113.5 kB. Every other page is unchanged.<head>: I fetched 39 addresses from both builds (home, help, legal, sign-in, each organizer tab signed in, OAuth consent, a signup, an edit link, unsubscribe, the not-found cases, icons, manifest, robots, sitemap). The<html>and<body>attributes, every<meta>and<link>(icons, manifest, theme colour, robots, canonical, og/twitter), stylesheets, footers and headings are identical, apart from the image query above. The only other differences are the 404s, which now show the new page. After the move topublic/, everyog:*andtwitter:*tag on/,/login,/help, a help article,/privacy,/no-such-page,/app, a signup page and an edit link is identical to before it, and the image bytes are the same./appthat redirects to/) load the whole page with no console errors. Within a layout, such as/helpto an article or/appto Settings, navigation stays client-side.src/i18n/request.tsis unchanged and nothing calls next-intl's request functions.precompiled-messages.spec.tspasses.notFound()from/s/[slug]still sends the__next_error__shell before the not-found page renders, as onmain; and/help/no-such-articlelogsError: Internal: NoFallbackErroronce in the server log, asmain(b8096cd) does.Tests
tests/e2e/root-layouts.spec.ts:/help,/app(signed in) and a signup page each havelang="en", the right title, and icons and a manifest that answer 200. The signup page also has its footer./app,/login, an edit link and the 404 (which has its ownmetadata), none of which setsopenGraph, have anog:imageending/opengraph-image.pngand atwitter:imageending/twitter-image.png. Without theimagesinrootMetadata, 6 of the spec's tests fail./no-such-page,/s,/help/no-such-articleand/app/no-such-pageeach get a 404 withlang="en", the new heading, text, home link and footer, and not Next's page./applands on/with no console errors, and/appthen sends you to/login.tests/e2e/a11y.spec.ts: an axe (WCAG A/AA) check of the 404.908e422, withmainatcf0b62fmerged):pnpm lint,pnpm format:check,pnpm typecheck,pnpm knip,pnpm test(3422 passed),pnpm test:db(857 passed),pnpm build && pnpm budgets(nometadataBasewarning), and the full chromium e2e suite against the production build (204 passed, 2 skipped).pnpm devserves every group and the 404.https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt