Skip to content

Run the translation tests for every language with a catalog - #935

Merged
richshaw merged 97 commits into
mainfrom
claude/issue-637-tests-every-language
Nov 16, 2026
Merged

richshaw merged 97 commits into
mainfrom
claude/issue-637-tests-every-language

Conversation

@richshaw

@richshaw richshaw commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Part of #637: the "adding a language" half, tests for every language.

The stack

The test PR of the localization stack (#619). Everything below it in the stack has merged, so it's based on main now: review against main. Its follow-up, #952 (organizer tests in every language), builds on it.

The problem

The owner wants OpenSignup to work in any language, not Swedish in particular (decided 14 November 2026). But the stack wrote the e2e specs, translation screenshots, email samples and label-fit checks for Swedish by name: a swedish-signup.spec.ts, a makeSwedishSignup seed, Swedish sample emails listed by name. Adding a second language meant copying all of it (six steps in docs/translating.md).

The fix

Every language with a catalog but English is a test language (TEST_LOCALES in the new src/i18n/testing/locales.ts, from CATALOG_LOCALES), and the checks run once for each. A new language gets them by adding its catalog.

  • Seed (tests/e2e/helpers/seed.ts): makeSignupsIn(locale) makes an open signup with sign-ups, a draft for its Build tab, and a closed and an archived signup in each test language, under seed.languages[locale]. Field names come from the language's catalog (participant.defaults). What an organizer would write is per language in ORGANIZER_TEXT; Swedish keeps its text, so its pages and screenshots are as before, and a language without an entry gets ANY_LANGUAGE's.
  • Specs: swedish-signup.spec.ts is now translated-signup.spec.ts, one block per language, named by the language's English name, so Swedish's test names are unchanged. a11y, precompiled-messages, build-tab-language and slot-row-layout loop over the languages too. Every expected text comes from the language's catalog (messagesIn). helpers/swedish.ts became helpers/languages.ts.
  • The no-English check looks for main's 16 English words, less any a language declares in SHARED_WITH_ENGLISH (in the spec): words it really writes as its own, as Dutch writes "link". Swedish's entry is empty, so its pattern is main's. A language without an entry shares none. When a page fails, the failure names the catalog's messages that write the English it found ("translate each message, or add a word … to SHARED_WITH_ENGLISH"). The check runs on textContent and on innerText, so a word at an element's edge is caught too.
  • E2E_UNSHIPPED_LOCALES: one list, UNSHIPPED_LOCALES in tests/e2e/helpers/unshipped-locales.ts, which main already works out (Word every organizer refusal from the catalog, and check both halves launch together #996) for the server playwright.config.ts starts. It stays e2e-only. This branch's second list (UNSHIPPED_TEST_LOCALES) is gone; a spec that finds a seeded signup in English names the value from the same list.
  • Emails: scripts/lib/email-samples.ts builds each participant email and the sign-in email in every test language (<name>-<locale>, then magic-link-<locale>), with what each must print taken from the catalog. emails.test.tsx checks each language has all five; worker-render.test.ts derives its list.
  • Unit tests that used Swedish only as "another language" use OTHER_LOCALE, with titles built from its English name, so names are unchanged. Tests of what Swedish says (its dates, plurals, wordings, language names) stay Swedish's.
  • KEEP_IT_PRIVATE (commit-dialog.test.tsx) fails at test time naming itself for a language without an entry, rather than at typecheck.
  • Docs: docs/translating.md "Adding a language" is the catalog, the glossary, translating both audiences and the review, then what the tests do for the language by themselves, and the tables that keep what a language says (KEEP_IT_PRIVATE, inSentence and SHARED_WITH_ENGLISH). The translate skill and CLAUDE.md say the same.

Reworked on 16 November 2026

This branch predated the owner's 14 November redesign. I merged main into it (no rebase), with the rule that the stack wins on behaviour: an organizer's language is stored once, at account creation; a signup has its own; the language comes from resolveLocale and the helpers in src/i18n/locale.ts. Then main again for #1013, #1010 and #1011.

Tests of the per-visit browser guess are gone, each taken from main, which tests the opposite: chooseOrganizerLocale's cases in organizer-locale.test.ts, the account settings page's "browser's top language" case, and the "browser step" cases of the REST create route, Magic Compose and the new-signup action. (src/i18n/organizer.test.ts had already left main in #997.)

Every Swedish-only test on main, and where its check is now:

Old test on main Now
swedish-signup.spec.ts, all 27 tests in 5 blocks translated-signup.spec.ts, same blocks and titles, once per test language. This includes #1012's checks: the open page's <html lang>, og:locale and footer (expectSignupLayoutIn(page, locale)), and the 6 "pages, around what they show" tests (page, edit, unsubscribe, broken link, draft, archived). It also includes the organizer's strip and Preview banner in the organizer's language, with the banner found by its status, #888's "open" wording, #999's tip, and the tip's accessible description and lang. Each test makes the same number of expects as before (88 in all).
a11y.spec.ts: the Swedish page, commit dialog, edit page and unsubscribe page The same tests, looped over the test languages, same titles. The 404 and the Build-tab editor tests stay as they were.
build-tab-language.spec.ts: a Swedish signup's Build tab in an en-US and an sv-SE browser (2 × 2), and "names a new field … in Swedish" Per language, the second browser being withRegion(locale). main's added checks are kept: the Fields button is the organizer's (en), and each slot's time and date heading are marked with the signup's language. The new field's names come from participant.defaults rather than "Namnlös" and "Alternativ 1". The organizer blocks keep their titles; the first now loops over TEST_LOCALES.
build-tab-language.spec.ts: the Build tab's group order, the literal Apa, Zebra, Äpple, Ödla Worked out in the test with localeCompare(…, locale) in its own Node, the same call the tab makes, so it holds for any language. The check that the browser's order matches the server's is kept, and BuildWysiwyg.test.tsx still pins the Swedish order.
slot-row-layout.spec.ts: "in Swedish" (5) and "in Swedish, closed, with your own sign-up" (4) Per language, same titles.
precompiled-messages.spec.ts: Swedish counts, and the Swedish sheet's messages Per language, same titles.
email-samples.ts: the four *-sv participant samples and magic-link-sv Built per test language. Every fragment the old Swedish samples checked is inside one of the new strings (checked by script).
emails.test.tsx: "includes every email in Swedish" "includes every email in %s", per language, with magic-link-<code> last and a guard that the English participant list is the four it was.
worker-render.test.ts: the list with *-sv and magic-link-sv Derived from TEST_LOCALES, same order for Swedish.
organizer-language.spec.ts: the CSV request's accept-language: 'sv' OTHER_LOCALE. The organizer specs already loop over every catalog language.

Kept Swedish-specific, on purpose:

  • Tests of what Swedish says: dates and durations (slot-label, format-duration), language names (Svenska, sv_SE, inSentence), subjects (subjects.test.ts, scripts/render-messages.ts under the worker's toolchain), the Swedish confirmation email in notify.db.test.ts, and the eval harness.
  • The account-language decision table test, which reads docs/translating.md's table, written with sv.
  • Swedish's entries in ORGANIZER_TEXT, SAMPLE_TEXT, KEEP_IT_PRIVATE and SHARED_WITH_ENGLISH.
  • main's newer unit tests that use Swedish as "another language" outside the files this PR touches (for example open-signups-locale.db.test.ts and the account settings tests). They name Swedish, so a new catalog doesn't change them, and the fake second language below broke none of the unit tests among them. Where a file this PR touches mixed the two, I used OTHER_LOCALE throughout. The organizer side is No test opens the organizer app in another language #952's.

Review and tophat notes from round 1:

  1. Email samples fall back to English for a missing message. The comments in worker-render.test.ts and render-email-templates.ts now say so, and that the catalog check requires every message once the language ships.
  2. englishLeftIn with no word left now throws with a message.
  3. Translated titles go through escaped (exported from helpers/languages.ts) before they become a pattern.
  4. de as an unshipped stand-in: organizer.test.ts is gone. The fake de run below passed every organizer-locale test.
  5. The Swedish comment on the e2e hook is now on keptForTests in src/i18n/locale.ts (isShownToTests left with Decide every page's language with one rule #997). I reworded it; that's comment-only.

Review round 2 (review 5925480054), fixed in 8321c30:

  1. Blocking: the no-English check took a word out of a language's pattern whenever its own catalog wrote it, so a message left in English switched the check off on its own page. The words a language shares with English are now declared in SHARED_WITH_ENGLISH, as "The fix" says, and the catalog scan only words the failure. Proof, on one production build with participant.gonePage.editLink.body set to its English in sv.json: "says a broken edit link isn’t working, in Swedish, with a 404" fails with the fix and passes with 07c9b0d's spec. With sv.json reverted and rebuilt, it passes.
  2. Optional, textContent runs elements' text together: the check now also runs with useInnerText. With the edit page's title set to "Your spot" in sv.json, "is in Swedish, with the slot’s date and the spots line" fails with the fix and passes with the textContent check alone. On a clean build it fails on nothing.
  3. Optional, the Build tab's group order: it now has its own row in the table above.
  4. Optional, \d → \p{Nd} in matching: no change.

How I checked nothing was lost

main (3f906a8) against this branch (07c9b0d):

main This branch
Unit tests (vitest list) 3455 3455, names identical
DB tests (vitest list, db config) 857 857, names identical
e2e tests (playwright --list, all projects) 441 441, names identical apart from the spec's file name
e2e with TRANSLATION_SCREENSHOTS=1 468 468, names identical apart from the spec's file name

8321c30 adds and removes no test.

A second language, tried locally and not committed (on 02c95b5, before the last merge of main): I copied sv.json to de.json and added de to CATALOG_LOCALES and CATALOGS.

  • pnpm typecheck asked for inSentence's de row and column, which I added locally. That's why the guide now names that table.
  • pnpm test: 3635 tests. Only KEEP_IT_PRIVATE failed, with its message.
  • Full chromium e2e after a build: 288 tests, 285 passed and 3 skipped (Magic Compose, no AI provider). That's 68 more German tests: translated-signup 27, slot-row-layout 9, build-tab-language 9, a11y 4, precompiled-messages 2, organizer-language 16 and the story 1.
  • pnpm translation:screenshots: 108 passed. de/ got 104 files, mirroring sv/.

Tests

On 8321c30:

  • pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test: pass (242 files, 3454 passed and 1 expected fail).
  • e2e on a production build, chromium: translated-signup and a11y, 39 passed. translated-signup is the only spec with the no-English check.
  • The same two specs with a local fake de (a copy of sv.json, with no SHARED_WITH_ENGLISH entry, not committed): 70 passed, 31 of them German.

On 07c9b0d:

  • pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test: pass (242 files, 3454 passed and 1 expected fail).
  • pnpm test:db: pass (47 files, 857 tests).
  • pnpm build && pnpm budgets: pass, no budget change.
  • Full chromium e2e (pnpm test:e2e --project=chromium --trace off, production build, port 3200): 225 tests, 221 passed and 4 skipped. The skips are Magic Compose tests with no AI provider, as on CI. One earlier run of the same build tripped the per-IP sign-up limit (10 a minute) in public-commit.spec.ts with 2 workers. After I cleared rate_limits in my own database, the rerun passed.
  • pnpm translation:screenshots: 12 email tests and 54 e2e tests passed, 114 files.

UX: no. Only tests, test helpers, scripts, docs and one comment in src/i18n/locale.ts change.

Where the brief was out of date

  • E2E_UNSHIPPED_LOCALES was already worked out by main (Word every organizer refusal from the catalog, and check both halves launch together #996), across both audiences. I kept main's list and dropped this branch's.
  • The join-fixes story spec (organizer-language-story.spec.ts) and the organizer specs were already per language, so there was nothing to port there.
  • main added a second per-language table, inSentence, which is a type error rather than a test failure for a new language. I kept it that way, since it was main's choice ("which the type asks for"), and documented it.

🤖 Generated with Claude Code

https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt

claude and others added 30 commits November 13, 2026 22:31
Part of #620: the core. next-intl and use-intl 4.14.9, pinned together
(icu-minify too, through an override), with next.config.mjs wrapped in
next-intl's plugin. src/messages/en.json is the English catalog, and
next-intl's AppConfig is typed from it, through the declaration the
plugin writes, so a missing key or a wrong argument fails typecheck.

src/i18n holds the pure locale config (CATALOG_LOCALES, SHIPPED), a
synchronous translator on use-intl/core with English filled in under
any other language, the server wrapper that logs what goes wrong, the
request config the plugin needs, and an English translator for tests
that throws.

The site footer's labels are the first text in the catalog, so the
translator is proven in a server component, on static and dynamic
pages. A new check runs it under the worker's toolchain. No page's
first-load JavaScript changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
A local ESLint plugin in eslint.config.mjs, with one rule so far:
opensignup/no-catalogs-in-client. In a file that opens with a 'use client'
directive, it reports any import of a catalog in src/messages, or of the
translators that load every catalog (src/i18n/translator.ts, server.ts and
testing/translator.ts), since either would put that text in the browser's
JavaScript. It reads the directive rather than matching paths, follows
@/ and relative paths, re-exports, import(), require() and import paths
built from a template, and lets type-only imports through, since those are
compiled away. The message says why and what to do instead.

The tests lint fixtures through the repo's own config, so they also prove
the rule is on for the app's files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
A unit test over src/messages/ checks every catalog against en.json:
completeness per namespace, enforced for each language in SHIPPED for the
namespaces its audience reads; every message compiles with icu-minify;
placeholders, tags and select branches match English, and each placeholder
takes the value English is passed; no key English lacks; and no English
message the app doesn't use.

Which keys the app uses comes from the type checker: a call whose signature
is use-intl's Translator, its namespace from the keys it accepts, its key
from the type of its argument, so helpers, props, aliases and typed tables
are all seen, and a key or namespace it can't read fails the check.

The audience namespaces move from a comment to AUDIENCE_NAMESPACES in
src/i18n/config.ts. src/types/next-intl.d.ts imports next-intl, because an
augmentation alone doesn't load its module: without it, code with no test
importing next-intl typed every message key as a plain string.

icu-minify is a devDependency at exactly 4.14.9, the version next-intl and
use-intl resolve, and the pnpm override now points at it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Two rules, on only for the files and folders listed in TRANSLATED in
eslint.config.mjs, which so far is the site footer:

- react/jsx-no-literals with noStrings and ignoreProps, for JSX text;
- opensignup/no-literal-text-props, a local rule for a string on
  aria-label, aria-description, title, placeholder, alt or label.
  noAttributeStrings would also flag every className and href.

TRANSLATED takes paths as they are on disk. filesAt escapes them for
the config's globs, since an unescaped src/app/s/[slug]/** matches
src/app/s/s/ and not the [slug] folder, and stops lint when a path
doesn't exist. The footer's license line is exempt with a comment.

Also, from #891's review: no-catalogs-in-client follows a + chain that
starts with a string, as it does a template, and denies every module in
src/i18n/ to client files except those in CLIENT_SAFE_I18N (config),
rather than listing the modules that load catalogs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
A translation that kept a select's argument but dropped the select
(`Status: {status}` for English's `{status, select, open {Open} ...}`)
passed, and would show participants the code's value. The check now
reports `{status} isn't a select here, but is in English`.

From the same review:
- The check's program types translators against the en.json it just
  loaded, written over src/messages/en.d.json.ts, so a stale declaration
  no longer gives misleading lines. findUsedKeys now builds the program
  itself, and the fallback for a stale declaration is gone, with its edge
  case that could pick the wrong section. messages-declaration.test.ts
  still fails on a stale file.
- Code in any `testing` folder and in src/mcp/evals doesn't count as a use.
- `t?.('key')` is seen.
- A test for the dot-in-key check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Turn on next-intl's experimental message precompiling, so the first
client component with translated text ships a small formatter instead of
use-intl's ICU parser: measured here at 3,470 bytes gzipped against
12,353 without it.

Under precompile the plugin's loader compiles every catalog the Next
build imports, the server's too, and a message with an argument, plural
or tag becomes an array. withEnglishUnder treated every object as a
section and went into those arrays, so each such message would have
rendered as its key path in the web process while vitest and the worker,
which read the raw JSON, stayed green. A message is now a string or an
array, and only a section is merged into.

The footer's "{INSTANCE_NAME} · AGPL-3.0" line becomes a message with an
argument, the first the app has, and a production-build e2e checks it on
a prerendered page, a page rendered per request and the public signup
page. A unit test runs next-intl's own loader over every catalog and
checks each message formats the same precompiled as from the raw JSON.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
…ext-lint

Brings in #892's review fixes (a7a10ed) so this PR stays on top of #892's final state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
formatSlotDate and formatSlotTime now take the reader's language as a
required `locale`, and so does everything that prints a slot's values:
renderFieldValue, slotDetails, summarizeSlotValues, formatGroupLabel,
buildMetaSegments, prettyHeader, and the two commitment services that name a
slot for the edit and cancelled pages. Every caller passes 'en' for now, so
nothing anyone sees changes.

A date is built from its parts as a UTC moment and formatted in UTC, so no
zone can move it to another day. English keeps today's output exactly,
including the hand-written 12-hour clock with its no-break space before
AM/PM; other languages get Intl's own ("lör 3 maj", "18:30" in Swedish).

formatSlotDate now formats only a stored YYYY-MM-DD. It used to fall back to
`new Date()` for any other string, in the host's zone; no caller relied on
that, as both checked isRealDate first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
filesAt escaped the characters a glob reads specially but not the
backslash it escapes them with, so a listed folder named `a\b` became
the glob `a\b/**`, which matches `ab/` and not `a\b/`. The backslash is
now escaped in the same pass as the rest.

filesAt takes an optional root so a test can list a real folder with a
backslash in its name, made in a temporary directory, and check the glob
with ESLint's own matcher.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
…mpile

Brings in #893's later commits (#892's final code, main, and the filesAt escaping fix) so this PR stays on top of #893.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
…-format

Keeps this PR on top of #894's current branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
main now holds #893 (7a9fada), whose final code this branch already had. The only conflict was the footer line #893 exempted from lint and this PR turns into a message; this branch's version is kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
…-format

Keeps this PR on top of #894's current branch, which now has main (#893) merged in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Every formatter that named a language now takes the reader's as `locale`,
and every caller passes 'en' for now, so English reads exactly as before:

- format-duration: `formatDuration` and `waitInMinutes` write each amount
  with Intl (number, unit and plural), so "1 minute" and "2 timmar" both
  come out right. `locale` defaults to English, since some callers are
  sign-in and OAuth code that gets a language with its own text.
- fit-text: Magic Compose's cut-off warning writes its limit with
  Intl.NumberFormat.
- connected apps: the approval, last-use and expiry dates go through
  `formatGrantDate`, which keeps English in the day-first order the page
  has always shown.
- Magic Compose: `formatOneDay`, `appendAnswers` and `timeLength` take a
  locale, and `MagicComposeRoot` passes one down to Compose (the character
  count), Questions, Drafting and DraftingFrom. English times keep "9am";
  other languages get Intl's short time, as slot times do.

The participant rate-limit message now writes its plural in its own
sentence from `waitMinutes`, as Magic Compose's hourly-limit message does,
so the plural moves into the catalog with the sentence and Intl's unit
code stays out of the participant pages, which had 5 bytes of budget left.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
…er-formatters

Keeps this PR on top of #895's current branch, which now has main (#893, #894) merged in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
…le change

Part of #625. A signup can now hold a language in settings.locale, and an
operator can set DEFAULT_LOCALE. Nothing reads either yet, so pages, emails
and the AI connector's tools are unchanged.

- settings.locale is a lenient string, so a stored language that has left
  the list still parses. createSignup and updateSignup refuse a language the
  caller sends unless it has shipped to participants; updateSignup checks
  only a sent one, as it does for groupByFieldRefs, because it merges the
  stored settings under the patch before parsing.
- resolveLocale and defaultFor in src/i18n/config.ts, pure, with isShipped.
- DEFAULT_LOCALE in src/lib/env.ts, an optional enum of the catalog
  languages.
- locale joins UNREAD_SETTINGS, so update_signup refuses it and get_signup
  hides it until something reads it.
- .env.example, fly.example.toml, the README and the CHANGELOG say what it
  does, that it changes nothing until a second language ships, and where a
  runtime variable goes on each platform.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
…anguage ships

The Settings tab gets a "Signup language" form, a plain form like "Ask for
an email address" with no script of its own. It renders only once a second
language has shipped to participants, so nothing shows yet. Each language is
named in itself (English, Svenska), through Intl.DisplayNames. Saving sends
only `locale` through updateSignup, which refuses a language that hasn't
shipped; a refusal shows the tab's usual error.

A signup with no language of its own shows the instance's, so
instanceDefaultLocale() comes in here with its first caller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
TIME_ZONE moves from src/i18n/config.ts to its own src/i18n/time-zone.ts.
Browser code reaches it through src/lib/slot-label.ts (the Build tab's
time picker and Magic Compose), which made config.ts part of the code
those two share. Webpack counts a module's unused code when it decides
whether shared code gets a chunk of its own, so the language rules this
branch added to config.ts tipped it into making one. That chunk's entry
in the webpack runtime added 29 to 47 bytes to every page and pushed
/s/[slug]/c/[id] over its 110 kB budget. With config.ts out of the
browser's graph, every page's JavaScript is byte-for-byte the size it
was on the base branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
…sent

A settings.locale longer than 35 characters (or not a string), written
straight into the database, failed the whole settings parse: the signup
asked for an email the organizer had turned off, and every settings save
failed on a field nobody sent. The schema now reads such a value as no
language (.catch(undefined)), so a stored value can never break the row,
and an unrelated save drops it.

createSignup and updateSignup check the raw value the caller sends
instead of the parsed one, so a too-long, non-string or unknown language
is still refused with invalid_input on settings.locale (now with the
service's own message, where a too-long one used to get zod's).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
The README, .env.example and CHANGELOG said a language "takes effect
only once OpenSignup ships it", with a Swedish school as the example,
which reads as "set sv now and it will start working later". In fact any
value but en stops the app: the worker exits at startup and every page
that needs the database fails with an "Invalid environment" error. They
now say that, tell operators to leave it unset for now, drop the
example, and put what an unset value means in the future tense, since
nothing reads an organizer's browser language yet. fly.example.toml
says the same in one line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
In a file of its own, the form was a second server module importing
AsyncSubmitButton, and webpack then added a few bytes to that button's
module on every page that loads it. Inline in page.tsx, every page's
first-load JavaScript is byte-identical to the base. The test now renders
the Settings tab itself, so it also checks the page shows the form, and
that "Saved" appears only by the form that saved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
#896 merged, so main now holds this branch's base. The one conflict,
src/lib/slot-label.ts, is between #895 and #896 as squashed on main and
the same commits in this branch's history; main's copy equals #896's
head, so the branch's copy (with TIME_ZONE from its new module) stands.
The merged tree is identical to the branch's before the merge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
…ettings-control

Takes #897's address round: TIME_ZONE out of config.ts, the lenient read of
a stored locale, and the docs on DEFAULT_LOCALE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
chooseOrganizerLocale takes the organizer's saved language, the instance's
DEFAULT_LOCALE and the browser's Accept-Language header (null where there is
no browser, as for MCP) and returns the first that has shipped to the
audience asked about, else English, with the step that chose it. Only the
browser's top-ranked range counts, so "sv,en;q=0.8" gives English until
Swedish ships rather than settling for the second choice.

It lives in its own file, away from server.ts (which the worker imports) and
from next/headers. The column, the session field and the request wrapper
come later.

Part of #626.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
getSignupRowBySlug reads the live signup at a slug in one statement,
skipping deleted rows and keeping drafts and archived ones, so the page can
still say which. getPublicSignup takes that row, or a slug as before for the
public API, and loadPublicSignup now gets its row from the new cached
loadSignupRowBySlug. A layout that reads the row too (a later part of #628)
then adds no statement to GET /s/[slug].

A unit test stands a per-request cache in for React's and checks the page's
read goes through loadSignupRowBySlug and hands getPublicSignup the row, not
the slug. The query-budget test says why it counts the page alone. Both page
budgets stay at 5 and 6.

Part of #628.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
@richshaw richshaw added pipeline:tophat and removed pipeline:stuck Needs the owner; the pipeline leaves it alone labels Nov 16, 2026 — with Claude

Copy link
Copy Markdown
Owner Author

Tophat: passed

I ran 07c9b0d and main (3f906a8) locally. Each had its own production build (next start on port 3100), both used one Postgres 16 database, and Chromium ran at 1280×900 and 390×844.

Check Result What I saw
The app is unchanged ✅ git diff origin/main...07c9b0d --stat -- src ':!**/*.test.*' lists 3 files: a comment in src/i18n/locale.ts (on keptForTests), a comment in src/i18n/testing/translator.ts, and the new src/i18n/testing/locales.ts. Nothing in the app imports src/i18n/testing. Only scripts/lib/email-samples.ts, tests/e2e and unit tests do. The two builds' route tables differ by a few bytes on five pages. On /login, the client chunk differs only in one webpack module id.
English and Swedish pages against main ✅ I opened 17 pages at both widths, 34 screenshots on each side. Participant pages: the English public signup, and the Swedish open, edit, unsubscribe, closed, closed-edit, archived and draft pages. Organizer pages: the dashboard, the English and the Swedish Build tabs, Responses, Settings, Preview, account Settings, and the Swedish page seen by its organizer. Status, <html lang>, <main lang>, og:locale and the title match on every page. Every participant page is pixel-identical except the footer's commit. The organizer pages are pixel-identical except the dashboard's random slug suffixes. There were no console errors.
Seeded data ✅ I ran each branch's own global-setup.ts and opened the result on that branch's build (the row above). Head's four Swedish signups read exactly as main's: Fika till vårfesten, Städdag i parken, Loppis i aulan and Vårkonsert. Dates are in Swedish, the undated group is headed "(utan datum)", and the Build tab sorts its groups the Swedish way: Apa, Zebra, Äpple, Ödla. The field refs changed (vad became what), and the labels people see ("Vad", "Datum") did not.
pnpm translation:screenshots ✅ I ran the script itself, with the container config added. 12 email tests and 54 e2e tests passed. It wrote 114 files to translation-review/en/emails, sv/emails and sv/screens, where docs/translating.md says it should. Against main's run: the same 114 paths, all 20 emails byte-identical, and 37 screens byte-identical. The other 57 screens differ only in the footer's commit, the seeded slug, the timestamped test address, or 1 colour level on 24 pixels of anti-aliasing.
pnpm email:dev ✅ It lists magic-link, the four English samples, the four *-sv samples and magic-link-sv. All 10 are byte-identical to main's email:dev, as HTML and as text.
A fake second language ✅ The tests pick it up with nothing written for it. See below.
The PR's e2e specs ✅ 106 passed and 4 skipped on chromium: translated-signup 27, a11y 12, build-tab-language 12, organizer-language 32 (the 4 skips are Magic Compose tests with no AI provider), precompiled-messages 9, slot-row-layout 14. No rate limit was hit.
The old Swedish checks still run ✅ playwright --list on main and on head gives 441 tests each, and 468 each with TRANSLATION_SCREENSHOTS=1. The names are identical once swedish-signup.spec.ts is read as translated-signup.spec.ts, so all 27 Swedish titles are there (54 across both projects). Both specs make 88 expect( calls. expectSignupLayoutIn checks <html lang>, og:locale and the footer's six links. It runs in "shows participants its text in Swedish" and in the six "pages, around what they show" tests (page, edit, unsubscribe, broken link, draft, archived), and all 7 passed.

A fake second language

I followed step 1 of "Adding a language": copied sv.json to de.json, added 'de' to CATALOG_LOCALES, and imported the catalog into CATALOGS.

  • pnpm typecheck asked for a de row and column in inSentence, as the guide says. I added them locally.
  • pnpm test ran 3666 tests, 211 more than without de. One failed: KEEP_IT_PRIVATE, with the message "KEEP_IT_PRIVATE has no entry for de: add the words in its participant.dialog.shareText that say to keep the link private".
  • playwright --list went from 441 to 581 tests, and from 468 to 635 with the flag. No test was removed. On chromium there are 70 new German tests: translated-signup 27, organizer-language 18, slot-row-layout 9, build-tab-language 9, a11y 4, precompiled-messages 2 and the story 1. The body's count of 16 for organizer-language predates the last merge of main.
  • After a rebuild, the seed made Café Mozart, Picnic, Bazar and Concerto in de (ANY_LANGUAGE). I ran the per-language specs and the story: 175 passed and 6 skipped (Magic Compose). Of the German tests, 68 passed and 2 were skipped. UNSHIPPED_LOCALES became sv,de without any change.
  • The de pages are marked lang="de" with og:locale de_DE. They show German dates ("Mi., 16. Dez."), and the Build tab sorts its groups the German way: Aachen, Ålesund, Örebro, Zürich.
  • pnpm email:dev adds the four *-de samples, then magic-link-de.
  • pnpm translation:screenshots: 18 email tests and 108 e2e tests passed. It wrote 104 files to de/, with the same paths as sv/ (emails named -de).
  • I removed the fake language afterwards. Nothing was committed.

UX: no. Nothing a person sees changes. The pages, the emails and the screenshots match main apart from the build's commit and random slugs. The PR changes only tests, test helpers, scripts, docs and two comments.

Screenshots are in https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt.


Generated by Claude Code

@richshaw richshaw added pipeline:review pipeline:working A session is working on it right now and removed pipeline:tophat pipeline:working A session is working on it right now labels Nov 16, 2026 — with Claude

@richshaw richshaw left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: changes needed (round 2)

The PR makes every catalog language but English a test language and runs the participant specs, seed, screenshots and email samples once for each, with expected text from the language's catalog. The move is faithful, with one exception: the no-English check can now switch itself off. That needs fixing before this merges, because #952 builds on it.

Blocking (1):

  • tests/e2e/translated-signup.spec.ts:67 (englishLeftIn): a message left in English in a language's catalog removes its words from that language's no-English pattern. A Swedish page that fails on main passes here. Proof and fix are in the inline comment.

Optional (3):

  • tests/e2e/translated-signup.spec.ts:108 (expectNoEnglish), the same on main, so not this PR's: the pattern runs on textContent, which joins neighbouring elements with no space, so \b misses a word at the start or end of an element. With the edit page's title set to "Your spot", main and this branch both pass, because the text reads …anmälningslistanYour spotRäksmörgås…. Since the fix round is in this function anyway, toHaveText(pattern, { useInnerText: true }) may be enough; check it doesn't fail on something real first.
  • tests/e2e/build-tab-language.spec.ts:93: the expected group order was the literal Apa, Zebra, Äpple, Ödla and is now localeCompare(…, locale) in the test's own Node, the same call the tab makes. The browser-against-server check is kept, and BuildWysiwyg.test.tsx:265 still pins the Swedish order, so nothing is lost today. The PR body's table doesn't mention it; a line there would help.
  • tests/e2e/helpers/languages.ts:83 (matching): \d+ became \p{Nd}+. That's right for languages with other digits and makes no difference for Swedish.

What I compared, and found kept:

  • main's swedish-signup.spec.ts against translated-signup.spec.ts, test by test: 27 tests in 5 blocks, 88 expect( in each, the same assertions in the same order. #1012's checks are all there: expectSignupLayoutIn(page, locale) (<html lang>, og:locale, the footer) on the open page, and the six "around what they show" tests with their statuses (200 and the 404). The strip, the Preview banner, the tip's accessible description and its lang="en" are unchanged.
  • Literals that became catalog text read the same key the page reads: Anmäl dig (dialog.signUp), Fullt (signupView.full), Ditt namn (fields.name, which the edit form's label uses), Namnlös and Alternativ 1 (participant.defaults). The Sign up button's pattern is now anchored at both ends, which is stricter. Saft in the "filled up" answer is slots.one, still Saft for Swedish.
  • The email samples' Swedish literals became catalog text through a translator that falls back to English. That's the round 1 point, now stated in the comments, and catalogs.test.ts covers Swedish.
  • Browser-guess tests: against main no test is removed. chooseOrganizerLocale is nowhere on main or here. newOrganizerLocale is still tested in organizer-locale.test.ts and config.test.ts, neither of which this PR touches. Every changed unit and DB title is a rename from "Swedish" to OTHER_LANGUAGE, or a list that now comes from CATALOG_LOCALES.
  • No hidden sv: the five per-language specs and helpers/languages.ts name Swedish only in comments. Swedish text lives in ORGANIZER_TEXT, SAMPLE_TEXT and KEEP_IT_PRIVATE.
  • E2E_UNSHIPPED_LOCALES: set only in playwright.config.ts's webServer.env. Nothing in Dockerfile, the compose files, .env.example or the workflows names it. tests/e2e/helpers/unshipped-locales.ts is main's, unchanged.
  • Docs: docs/translating.md, the translate skill and CLAUDE.md name translated-signup.spec.ts, TEST_LOCALES, OTHER_LOCALE and the two tables correctly. The fix adds a third table to that list.
  • Run time: the test list is the same as main's with one test language, so CI's e2e job is unchanged (about 5½ minutes on this SHA). Locally the five per-language specs ran 74 chromium tests in 1.0 minute with 2 workers, 54 of them Swedish's. A further language adds about 70 chromium tests (the tophat's count), roughly a minute or two on CI. That's reasonable.
  • No personal data, no real addresses, no model names. No leftovers of swedish-signup, makeSwedish*, gotoSwedish, helpers/swedish, seed.swedish or UNSHIPPED_TEST_LOCALES.

Earlier threads: none open. Round 1's five optional points are all dealt with. Copilot answered that it couldn't review (quota).

Checks: CI is green on 07c9b0d (lint-type-test, e2e, CodeQL). Locally on 07c9b0d, on a database of my own:

  • pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test: pass (242 files, 3454 passed and 1 expected fail).
  • pnpm test:db: pass (47 files, 857 tests).
  • e2e on a production build, chromium: translated-signup 27, a11y 12, build-tab-language 12, slot-row-layout 14, precompiled-messages 9. All 74 passed.

The tophat passed on this SHA (ux=no), and no runtime code changed since.

Gate: auto. Only tests, test helpers, scripts, docs and comments change. The test files under src/auth, src/oauth and src/app/api/mcp only swap the literal 'sv' for OTHER_LOCALE. The fix is test-only, so the PR can go straight back to review.

https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt


Generated by Claude Code

Comment thread tests/e2e/translated-signup.spec.ts Resolved
@richshaw richshaw added pipeline:fix pipeline:working A session is working on it right now and removed pipeline:review pipeline:working A session is working on it right now labels Nov 16, 2026 — with Claude
The no-English check took a word out of a language's pattern whenever
that language's own catalog wrote it, so a message left in English in
the catalog switched the check off on the very page it should catch.

Now SHARED_WITH_ENGLISH lists, by language, the words of ENGLISH_WORDS a
language really writes as its own (none for Swedish), and only those
leave the pattern. The catalog scan stays, only to word the failure: it
names the messages that write the English words found.

The check also runs on innerText as well as textContent: textContent
runs one element's text into the next, so a word at an element's edge
slipped past the word boundary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt

Copy link
Copy Markdown
Owner Author

Back to review with 8321c30. The blocking point is fixed; the proof is in its thread. The fix changes only the spec and docs, so the 07c9b0d tophat still stands.

The optional points in review 5925480054:

  1. expectNoEnglish ran on textContent (translated-signup.spec.ts:108): taken. The check now also runs not.toHaveText(pattern, { useInnerText: true }). It comes after the textContent check, which stays, so text nobody sees still counts. I set the edit page's title in sv.json to "Your spot" and built. "is in Swedish, with the slot’s date and the spots line" then fails with both checks: innerText puts Your spot on a line of its own. With the textContent check alone it passes, as on main. On a clean build it fails on nothing: all 27 Swedish translated-signup tests passed, and all 27 German ones on the fake de build.
  2. The Build tab's group order (build-tab-language.spec.ts:93): it has its own row in the PR body's table now. The literal order became localeCompare(…, locale) in the test's Node. The check that the browser's order matches the server's is kept, and BuildWysiwyg.test.tsx:265 still pins the Swedish order.
  3. \d → \p{Nd} (helpers/languages.ts:83): no change, as you said. It's right for languages with other digits and the same for Swedish.

Checks on 8321c30:

  • pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test: pass (242 files, 3454 passed and 1 expected fail).
  • e2e on a production build, chromium: translated-signup and a11y, 39 passed. translated-signup is the only spec with the no-English check.
  • With a local fake de (a copy of sv.json with no SHARED_WITH_ENGLISH entry, not committed): the same two specs, 70 passed.
  • Not run: pnpm test:db and the other e2e specs, since nothing they run changed.

The PR body's "The fix", "Review round 2" and "Tests" sections say the same.

https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt


Generated by Claude Code

@richshaw richshaw left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: passed (round 3)

The PR makes every catalog language but English a test language and runs the participant specs, seed, screenshots and email samples once for each. Round 2's one blocking point is fixed in 8321c30: the no-English check no longer works its word list out from the language's own catalog, so a message left in English can't switch it off.

Blocking (0)

Optional (0)

What I checked on 8321c30:

  • The fix holds. englishLeftIn reads only SHARED_WITH_ENGLISH, whose type accepts only words from ENGLISH_WORDS. Swedish's entry is empty, so its pattern is main's 16 words. I repeated round 2's proof: with participant.gonePage.editLink.body in sv.json set to its English and a fresh production build, "says a broken edit link isn’t working, in Swedish, with a 404" fails, on the pattern /\b(Your|You|…|link|Sorry)\b/. With sv.json reverted and rebuilt, it passes.
  • The failure names the message. It is headed: English on the page. sv.json writes it in participant.gonePage.editLink.body ("Your", "spot", "link"): translate each message, or add a word Swedish says too to SHARED_WITH_ENGLISH in this spec. The catalog scan (englishInCatalog) feeds only that text. On a clean catalog it finds nothing and the failure would be Playwright's own.
  • The innerText check is added after the textContent check, which stays, so it can only catch more. On a clean build I ran translated-signup and a11y on chromium twice: 39 passed both times, with no flake.
  • Nothing else changed since round 2. git diff 07c9b0d 8321c30 --stat lists 4 files: the spec (only ENGLISH_WORDS, SHARED_WITH_ENGLISH, englishLeftIn, englishInCatalog and expectNoEnglish), docs/translating.md, the translate skill and CLAUDE.md. The three docs name the table and say never to add a word to quiet a message left in English. No test is added or removed; the spec has one more expect( (89, was 88), the innerText line.
  • Round 2's other conclusions stand, since none of those files changed: no check lost against main, no hidden sv in the per-language specs, and E2E_UNSHIPPED_LOCALES set only in playwright.config.ts's webServer.env.
  • The PR body matches the code: "The fix", the Build-tab group-order row and "Review round 2".

Earlier threads: all resolved (the one round 2 thread). Copilot answered that it couldn't review (quota).

Checks: CI is green on 8321c30 (lint-type-test, e2e, CodeQL). Locally on 8321c30, on a database of my own:

  • pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test: pass (242 files, 3454 passed and 1 expected fail).
  • e2e on a production build, chromium: the proof above, then translated-signup and a11y twice, 39 passed each time.

The tophat passed on 07c9b0d (ux=no), and no runtime code changed since (the shared check prints 0).

Gate: auto. Only tests, test helpers, scripts, docs and comments change, and nothing a person using OpenSignup sees.

https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt


Generated by Claude Code

@richshaw richshaw added pipeline:merge and removed pipeline:review pipeline:working A session is working on it right now labels Nov 16, 2026 — with Claude
@richshaw
richshaw merged commit ba54e25 into main Nov 16, 2026
5 checks passed
@richshaw
richshaw deleted the claude/issue-637-tests-every-language branch November 16, 2026 19:22
@richshaw richshaw removed the pipeline:merge label Nov 16, 2026 — with Claude
richshaw pushed a commit that referenced this pull request Nov 16, 2026
The organizer smoke built its own list of English words from the
catalogs, so, like the participant check before #935's fix, a message
left in English in a language's catalog took its words off the list on
the very page it should catch. It now runs the same check as the
participant pages, moved to tests/e2e/helpers/no-english.ts:
ENGLISH_WORDS, gaining the organizer app's buttons, tabs and statuses,
less the words SHARED_WITH_ENGLISH declares a language says too, over
textContent and innerText, with the catalog scan only naming the
messages that write a word it finds.

Until a language ships, the smoke writes it into the signup it makes
(storeSignupLanguage, as the story spec does), so the signup's own words
are in the organizer's language, as they will be once it ships.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
richshaw pushed a commit that referenced this pull request Nov 16, 2026
main renamed swedish-signup.spec.ts to translated-signup.spec.ts and runs
it in every catalog language (#935). The screenshot command, the config's
TRANSLATION_SPECS and the docs now name it beside the two organizer specs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SSv8YrdMQVvWsYteJB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants