Skip to content

Start a Magic Compose signup in the language its draft is written in - #928

Closed
richshaw wants to merge 2 commits into
claude/issue-635-prompt-languagefrom
claude/issue-635-draft-language
Closed

richshaw wants to merge 2 commits into
claude/issue-635-prompt-languagefrom
claude/issue-635-draft-language

Conversation

@richshaw

@richshaw richshaw commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Fixes #635. This is its second part: #927 did the prompt, and this does the draft's reported language, the route's decision, content as a localeSource, draftLanguage telemetry and its privacy line.

Merge after #927.

The stack

PR 35 of the localization stack (#619). Based on #927 (claude/issue-635-prompt-language); review against that branch.

The problem

Since #927 a draft is written in its description's language, but the new signup still starts in the organizer's language (#905), which until they save one is a guess from their browser. So a Swede with an English-set phone who types a Swedish description would get Swedish content on a signup whose pages and emails are English, once Swedish ships.

The fix

  • The draft reports its language (src/lib/magic-compose/prompt.ts). The prompt's output shape gains "language": "<code of the language the draft is written in, like en, sv or de>", and the four worked drafts (A, B, E, F) end with "language": "en", so the examples match the shape they teach. The golden is the new render.
  • Lenient, on the draft arm only. MagicComposeDraftSchema's draft arm reads language through ReportedLanguageSchema: the whole string, trimmed and with _ read as -, must be a well-formed language tag (Intl.Locale), and its language is kept only when it's two or three letters a-z that CLDR names as a language (Intl.DisplayNames with fallback: 'none') and not one of ISO 639's codes for no single language (und, mis, mul, zxx). So sv-SE, SV and sv_SE give sv, and eng, swe and deu give en, sv and de. Anything else (a name like Swedish, a sentence, zzz, a number, a list) reads as no language, and the draft still goes through. FullDraftSchema, which MCP create_signup also takes, is unchanged.
  • Questions and refusals carry none. A refusal already dropped unknown keys. QuestionsSchema is strict, so a questions reply with a language key would have failed as malformed and, on a first call, set off the retry. It now takes the key and drops it, and still refuses questions mixed with a draft.
  • Stripped before persistDraft. The route takes language off the draft before persistDraft and buildDraftPreview, so it reaches neither the signup nor the response's draft.
  • The route decides with draftedSignupLocale(reported, session, acceptLanguage) in src/i18n/organizer.ts: the reported language when it's in SHIPPED.participant, source content; otherwise Start new signups in their organizer's language, once there's a choice #905's newSignupLocale (the organizer's saved language, the instance default, their browser, English). It returns null while only English has shipped, like newSignupLocale, so nothing is stored today. The model's value is only compared with the list.
  • SignupLocaleSource (src/i18n/organizer-locale.ts) gains content.
  • draftLanguage on signup.created. When the reported code isn't in SHIPPED.participant, the route passes it through persistDraft to createSignup (a new draftLanguage option on both), which adds it to the payload only when it's two or three letters a-z (isLanguageCode in src/i18n/organizer-locale.ts), so no caller can put other text in the log. Only the code is recorded, never the model's text. It's recorded while only English has shipped too (that's the point: which languages come after Swedish), and never for a shipped language or a missing or unreadable one.
  • Privacy page. The activity-log sentence now lists "the language AI drafting wrote it in" among what can choose a signup's language, and says: "When AI drafting writes a signup in a language this site doesn't offer, it records that language's short code (such as "de" for German), never any of the draft's words." The purposes gain "which languages organizers write in, to choose the next languages to offer". "Last updated" is already 14 November 2026, today.
  • Docs. docs/telemetry.md's signup.created row documents content and draftLanguage (prettier re-padded the table). The evals README's draft shape gains language. CHANGELOG: A signup drafted by Magic Compose can start in a different language from its draft #635's entry under Changed replaces "The draft doesn't decide the new signup's own language yet" with what it does now.
  • No client JavaScript changed. No client file imports what changed, and no built chunk contains the new code.

Decisions the issue didn't make

  • A questions reply may carry language, read as nothing, rather than failing (above). The prompt doesn't ask for it there.
  • The worked examples report "en". Without it the examples would teach a draft without the key the shape asks for.
  • What counts as a code: the language of a well-formed tag, in its canonical form, kept only when it's two or three letters a-z that CLDR names as a language, and not und, mis, mul or zxx. Three letters keep languages with no two-letter code (fil), and a three-letter code for a language with a two-letter one gives that one (eng, swe, deu give en, sv, de), with no table of ours. A name, a sentence (even one starting sv-SE,), a private-use tag, digits and letters CLDR doesn't name (zzz, the) give none. A well-formed tag with a real language and odd subtags after it still counts (no-idea gives no). Changed after the first review, which found the earlier cut-at-the-first-hyphen reader kept eng, zzz and the start of a sentence.
  • draftLanguage sits beside locale once a second language ships: a German draft by a Swedish organizer records locale: sv, localeSource: setting, draftLanguage: de.

Where #635 was out of date

  • The organizer's fallback goes through Start new signups in their organizer's language, once there's a choice #905's newSignupLocale, not getOrganizerLocale() directly, and SignupLocaleSource now lives in src/i18n/organizer-locale.ts.
  • It didn't mention that QuestionsSchema is strict, so "a questions reply carries none" needed the change above to hold when a model adds the key anyway.

Before merging

The evals have not been run. pnpm eval:magic-compose and pnpm eval:mcp need the LLM_* settings, which this session doesn't have. The golden changed again here (the output-shape line and the four worked drafts), so run them before merging, together with #927's run. The evals don't score the reported language itself; the route's tests do. The first review suggested a check that it equals each language case's expected language (ev_042 to ev_045), which would show whether a real model reports a clean code; I've left it for whoever runs the evals next, since it can't be run here.

Tests

  • prompt.test.ts: the output shape asks for the code, and each worked draft reports en (the questions examples don't); the draft arm reads sv, en, de, fil, sv-SE, sv_SE, SV, zh-Hant-TW, en_GB, de, eng, swe, deu and SWE-se as their codes, and reads 24 odd values (missing, null, Swedish, svenska, e, swed, empty, x-klingon, sv; and more, a sentence, a sentence starting sv-SE,, it-depends on the slot, Tea-party helpers, zzz, the, und, mul, zxx, 12, sä, a number, a list, an object, true) as none while still taking the draft; FullDraftSchema has no language; a questions reply or refusal carrying one parses and carries none; questions mixed with a draft still fail.
  • organizer.test.ts: draftedSignupLocale is null while only English has shipped; with Swedish shipped, the draft's sv or en wins over the organizer's as content; de or none falls back to each organizer step; it checks the participant list, not the organizer one.
  • route.db.test.ts (through POST, with a watched real persistDraft): every case checks persistDraft got no language and the response's draft has exactly title, description, fields and slots. While only English has shipped: nothing stored or recorded as locale for en, sv, de or none; draftLanguage recorded as sv, sv, sv, de, de, fil, sv, de for sv, sv-SE, SV, de, de_AT, fil, swe, deu; none for en, en-GB, eng, missing, Swedish, a code with text after it, a sentence starting sv-SE,, Tea-party helpers, zzz, the, x-klingon, 12, a number or an object, and none of their words in the payload. With Swedish shipped via ship(): sv, sv-SE, SV, swe start it in Swedish as content over an English organizer, with no draftLanguage; en and eng start it in English as content over a Swedish one, with no draftLanguage; de-DE falls back to the saved language and records draftLanguage: de; missing, Svenska, sv, mostly, a sentence starting sv-SE,, zzz and a number fall back to the browser; de from a German browser falls back to English as default.
  • route.questions.db.test.ts: a questions reply with language is shown in one call, without it; a refusal with one is still a refusal.
  • signups.db.test.ts: createSignup records a given draftLanguage with or without a stored language, none when not given, and none for 9 values that aren't two or three letters a-z (Swedish, sv-SE, SV, e, swed, sä, tea party, sv; and more, empty), while still creating the signup.
  • Each fails without its piece. I checked, one at a time: passing the unstripped draft to persistDraft (24 route tests fail), ignoring the draft's language (4), removing the English-only guard for a shipped draft language (1), recording draftLanguage even when shipped (5), recording the model's value without the cut (11), sending the unstripped draft to a preview that spreads it (17), and removing the questions arm's language key (1 unit test). After the review: putting back the cut-at-the-first-hyphen reader (12 unit tests, 11 route tests) and writing draftLanguage without the shape check (9 createSignup tests).

Run and passed on this head (15d274e):

  • pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test (212 files, 3009 passed, 1 expected fail)
  • pnpm test:db (43 files, 836 tests)
  • pnpm build && pnpm budgets: every page under budget; no built client chunk contains the new code
  • The reader on Node v22.23.4 (CI's version, from its job log) directly and under tsx (the worker's and the evals' runner): the same results for every value above.

🤖 Generated with Claude Code

https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt

The draft now reports its language as a code. The route starts the new
signup in it when it has shipped to participants (localeSource: content),
else in the organizer's language as before, and in none while only English
has shipped. The model's value is read leniently, cut to a bare two- or
three-letter code, stripped before persistDraft and the response, and only
compared with SHIPPED. When it hasn't shipped, signup.created records it as
draftLanguage. The privacy page and docs/telemetry.md say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
@richshaw richshaw added pipeline:tophat pipeline:ux Changes what a person using OpenSignup sees or does pipeline:working A session is working on it right now labels Nov 14, 2026 — with Claude
@richshaw
richshaw requested a balanced review from Copilot November 14, 2026 12:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copy link
Copy Markdown
Owner Author

Tophat: passed

Ran d2f5938 locally on a production build (next build + next start), Postgres 16, Chromium at 1280×900 and 390×844. Compared against the base, #927's head 4bfca33, also built for production, on the same database. Magic Compose ran against a small local stub of an OpenAI-style Chat Completions endpoint whose replies I set per request, so the language each draft reported was mine to choose; everything from the route to the database was real except the AI. All data is made up. I cleared the magic.compose rate-limit rows in my own database between cases, since there were more than 12 an hour.

Check Result What I saw
English only (as shipped): 20 drafts with odd and ordinary language values ✅ Every draft saved (200, one model call each, no magic_compose.failed row). No signup stores settings.locale, and no signup.created row has locale or localeSource. The response's draft has exactly title, description, fields, slots, and no response body has a language key anywhere. draftLanguage appears only as a normalised code for a language that isn't shipped (table below).
A questions reply carrying language ("sv", and an object) ✅ Shown as questions after one model call, with no language in the response; magic_compose.asked is {topics, options} as before. On the base the same reply failed as malformed and set off the retry, so the organizer got a draft without being asked (two model calls).
A refusal carrying language ✅ 400 invalid_input with details.reason: "refusal" and the model's reason, magic_compose.failed is {code: "refusal"}. Same as base.
Swedish faked as shipped (worktree only: sv added to SHIPPED.participant; reverted afterwards, never committed) ✅ sv, sv-SE, SV and a 50-character string starting sv-SE, give the signup sv with localeSource: "content" over an English browser, and sv does the same over a German browser, a saved English and DEFAULT_LOCALE=sv. en gives en / content over a Swedish browser and a saved Swedish. de falls back to the organizer's language with that step's source and records draftLanguage: "de": browser (en-US gives en, sv-SE gives sv), setting (saved sv or en), instance (DEFAULT_LOCALE=sv), default (de-DE browser gives en). No language at all falls back the same way with no draftLanguage. eng and swe fall back and are recorded as eng/swe, as the PR says. Through the UI too: a draft reporting sv-SE, and a questions → answers → draft reporting sv, both open with Svenska selected on the Settings tab; one reporting de opens with English.
Privacy page and docs/telemetry.md ✅ The activity-log paragraph on the built page reads as the PR quotes it and matches the rows above: a language and what chose it only when the signup is given one, and for a draft in a language this site doesn't offer, a short code and nothing else. "Last updated: 14 November 2026". The signup.created row in docs/telemetry.md describes content and draftLanguage as I saw them. Optional wording nit: it says draftLanguage is never there for "a shipped language" or "a value that isn't a language code", but any two or three letters pass (zzz is recorded as zzz, and an English draft reporting eng is recorded as eng). Something like "never for a shipped language's own code, or a value that isn't two or three letters once cut" would be exact. The privacy line is fine either way, since it promises a short code and never words.
Magic Compose screens, desktop and phone ✅ Compose, questions, a draft from the first call, a draft after answering, and a refusal: pixel-identical to base apart from two mid-transition frames (a row's edit tools fading in on phone, the Draft button's hover colour). No console errors besides the refusal's expected 400 (and one 404 on my first desktop run that didn't come back on a rerun), and no warnings or errors in the server log.
Tests on this database ✅ pnpm test src/lib/magic-compose: 6 files, 179 passed (golden included). With the route's unit tests and src/i18n/organizer: 11 files, 276 passed. pnpm test:db on src/app/api/signups/magic-compose and src/services/signups.db.test.ts: 3 files, 203 passed.

What the model reported, English only (as shipped), and what was kept:

Reported language Stored language localeSource draftLanguage on signup.created
"en", "EN" none none none
"sv", "sv-SE", "sv_SE" none none "sv"
"sv-SE, though the headings are partly in English!!" (50 characters) none none "sv"
"de", " de " none none "de"
"eng" none none "eng"
"zzz" none none "zzz"
"", 12, true, ["sv"], {"code":"sv",…}, null, missing none none none
"Swedish", "Swedish, with a few English words in the headings." (50 characters), "<b>sv</b>" none none none

On base, every one of these saved too, with no draftLanguage.

For the owner: while only English ships, nothing an organizer or participant sees changes. Magic Compose looks and behaves the same, except that a questions reply that also names a language is now shown as questions instead of being treated as malformed. Two things differ out of sight: a signup.created row for a draft in another language gains a two- or three-letter draftLanguage, and the privacy page's activity-log paragraph says so. Once Swedish ships, a draft written in Swedish starts its signup in Swedish whatever the organizer's own language, and a draft in a language that isn't offered falls back to the organizer's, as before. The screenshots show the privacy paragraph and, in the Swedish run, the new signup's Settings tab with Svenska chosen from the draft and English for a German draft.

Before merging: the evals (pnpm eval:magic-compose, pnpm eval:mcp) still need running with the LLM_* settings, together with #927's run. This tophat used a stub model, so it says nothing about how a real model reports language.

Screenshots are in 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: changes needed (round 1)

The PR makes a Magic Compose draft report its language, starts the signup in that language when it has shipped, and records an unshipped one as draftLanguage on signup.created. I reviewed it against #927's head 4bfca33. The route's decision, the stripping and the fallbacks are right and well tested. One thing needs changing: what counts as a language code is looser than the docs and the privacy page say. The evals have not been run, and they must be before this merges, together with #927's run.

What I checked and found right:

  • Draft arm only. FullDraftSchema, and so MCP create_signup, has no language. No odd value fails a draft.
  • A questions reply carrying language now passes, with the key dropped. That fits #635 ("a questions reply carries none"): the parsed reply carries none. Before, it failed as malformed and the retry turned questions into a draft the organizer wasn't asked about.
  • Never stored as sent. draftedSignupLocale only compares the value with SHIPPED.participant, returns that list's own entry as content, and returns null while only English has shipped. Every fallback goes through newSignupLocale with its own source.
  • Stripped. language is taken off before persistDraft and buildDraftPreview, and the route tests check both on every case.
  • Golden. The output shape has the language key, and the four worked drafts (A, B, E, F) report "en". The questions examples don't.
  • Privacy page. The activity-log sentence is plain and matches the code, apart from the finding below. "Last updated" is 14 November 2026, today.
  • Layers. The activity write stays inside createSignup's transaction. There's no new column, and no client code changed.

Blocking (1):

  • src/lib/magic-compose/prompt.ts:176-180: the reader takes the letters before the first - or _ of any text, and any two or three letters. So eng is recorded as an unshipped language for an English draft, swe won't start a Swedish signup once Swedish ships, a sentence starting sv-SE, reads as sv, and zzz or tea (from "Tea-party helpers") reach the log. That's against docs/telemetry.md, the CHANGELOG, the PR's "a sentence reads as no language" and the privacy page's "never any of the draft's words". The inline comment has a fix with no mapping table (Intl.Locale, then Intl.DisplayNames).

Optional (3):

  • src/services/signups.ts:121: createSignup writes whatever string it's given as draftLanguage. Only the route calls it with one today. Checking the shape there too (two or three letters a-z) would keep the promise at the write itself, for any later caller.
  • scripts/lib/eval-harness.ts: the evals don't score the reported language, as the PR says. A check that it equals the case's expected language, on ev_042 to ev_045, would show whether a real model reports a clean code. That's the one thing neither the tests nor the tophat's stub model can show.
  • src/app/(legal)/privacy/page.tsx:111: "the language AI drafting wrote it in" is fine. The owner may prefer it placed before "the app that created the signup", since the list otherwise runs in fallback order.

Earlier threads: none. Copilot answered that it couldn't review (quota).
Checks: CI is green on this SHA (lint-type-test, e2e). The tophat passed on this same SHA, so no runtime code has changed since. Locally I ran the odd values in the inline comment through MagicComposeDraftSchema on this head, and the suggested reader on Node 22.

Gate: owner, once this passes. It changes what's recorded about organizers, a legal page and what the AI is asked for, and its description asks for the evals to be run before merging.

https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt


Generated by Claude Code

Comment thread src/lib/magic-compose/prompt.ts Resolved
The reader kept the letters before the first - or _ of any text, so an
English draft reporting "eng" was recorded as an unshipped language, "swe"
wouldn't start a Swedish signup once Swedish ships, and a sentence starting
"sv-SE," or a title like "Tea-party helpers" reached the activity log.

Now the whole value must be a well-formed language tag (Intl.Locale), and
its language is kept only when it's two or three letters that CLDR names as
a language (Intl.DisplayNames with fallback 'none'), and isn't one of ISO
639's codes for no single language (und, mis, mul, zxx). Intl.Locale gives
the canonical code, so eng, swe and deu read as en, sv and de; zzz, the,
Swedish, x-klingon, 12 and sentences read as none.

createSignup also checks draftLanguage's shape (two or three letters a-z)
at the write, and leaves anything else out of signup.created, so a later
caller can't put other text in the log.

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

Copy link
Copy Markdown
Owner Author

Tophat: passed (round 2)

Ran 15d274e locally on a production build (next build + next start), Postgres 16, Chromium at 1280×900 and 390×844. Compared with round 1's head d2f5938, also built for production, on the same database. Magic Compose ran against the same local stub of an OpenAI-style Chat Completions endpoint as round 1, whose replies I set per request, so the language each draft reported was mine to choose; everything from the route to the database was real except the AI. All data is made up. I cleared the magic.compose rate-limit rows in my own database between cases, and set an organizer's saved language directly in the database.

Check Result What I saw
English only (as shipped): 33 drafts with the values below, on 15d274e and d2f5938 ✅ Every draft saved on both (200, one model call each, no magic_compose.failed row). No signup stores settings.locale, and no signup.created row has locale or localeSource. The response's draft has exactly title, description, fields, slots, and no response has a language key. On 15d274e, draftLanguage appears only as the code of a language CLDR names (sv, de, zh, fil, no, new), and never for English, a sentence, a name or letters that name no language (table below). On d2f5938 the same run recorded eng, swe, deu, zzz, the, tea, mul, zxx, und, mis, it and sv for the sentence, which is what the review found.
A questions reply and a refusal carrying language: "sv" ✅ Questions shown after one model call, no language in the response, magic_compose.asked is {topics, options}. The refusal is a 400 invalid_input with details.reason: "refusal" and magic_compose.failed {code: "refusal"}. Same on both heads.
Swedish faked as shipped (worktree only: sv added to SHIPPED.participant; reverted afterwards, never committed): swe, eng, sv-SE, de, zzz against four organizers ✅ swe and sv-SE start the signup in Swedish as content for every organizer, and eng starts it in English as content, Swedish organizers included, with no draftLanguage. de falls back to the organizer's language with that step's source and records draftLanguage: "de". zzz falls back the same way and records nothing (table below). In round 1 on d2f5938, swe and eng both fell back to the browser's English and were recorded as swe and eng.
The same through the UI ✅ A draft reporting swe from an English organizer opens with Svenska selected on the Settings tab, on desktop and phone. One reporting eng from an organizer whose saved language is Swedish opens with English selected. With English only, drafts reporting Tea-party helpers and swe open in the builder as before, and Settings has no language choice.
docs/telemetry.md, the CHANGELOG and the privacy page ✅ Each says what I saw. telemetry.md: a region or script dropped (zh-Hant-TW gave zh), three letters given as two (swe gave sv, deu gave de), nothing for a name, a sentence, digits, zzz, or und/mul/zxx, and never for a shipped language (eng recorded nothing). The CHANGELOG says the same in short. The privacy page's activity-log paragraph on the built page promises a short code and never the draft's words, which holds for every row; "Last updated: 14 November 2026". Round 1's wording nit is gone: eng and zzz are no longer recorded.
Logs and console ✅ No warnings or errors in the server log on any of the three builds, and none of the odd values (Tea-party helpers, the sentence, x-klingon, Swedish, svenska) appear in it. No console errors, except one React #418 (hydration mismatch) on my first desktop run of the English-only flow, which didn't come back in four reruns of the same pages. This PR changes no client code: no client file imports what changed, and no chunk under .next/static contains it.
Tests on this head ✅ pnpm test src/lib/magic-compose: 6 files, 192 passed (golden included). The route's unit tests and src/i18n/organizer: 5 files, 97 passed. pnpm test:db on src/app/api/signups/magic-compose and src/services/signups.db.test.ts: 3 files, 225 passed.

What the model reported with English only (as shipped), and what signup.created kept. No row stored a language.

Reported language draftLanguage on 15d274e On d2f5938 (round 1's head)
"en", "EN" none none
"eng" none (it's English) "eng"
"sv", "sv-SE", "sv_SE" "sv" "sv"
"swe", "SWE-se" "sv" "swe"
"de", " de " "de" "de"
"deu" "de" "deu"
"zh-Hant-TW" "zh" "zh"
"fil" "fil" "fil"
"no-idea" "no" "no"
"zzz", "the" none "zzz", "the"
"Tea-party helpers" none "tea"
"sv-SE, though the headings are partly in English!!" (50 characters) none "sv"
"mul", "zxx", "und", "mis" none "mul", "zxx", "und", "mis"
"it-depends on the slot" none "it"
"Swedish", "svenska", "x-klingon", "12", "sv, mostly" none none
"", missing, 12, {"code":"sv","name":"Swedish"} none none
"new" "new" "new"

With Swedish faked as shipped, on 15d274e (stored language / localeSource, and draftLanguage when there is one):

Reported English organizer (browser en-US) Swedish organizer (browser sv-SE) Saved English, browser sv-SE Saved Swedish, browser en-US
"swe" sv / content sv / content sv / content sv / content
"eng" en / content en / content en / content en / content
"sv-SE" sv / content sv / content sv / content sv / content
"de" en / browser, de sv / browser, de en / setting, de sv / setting, de
"zzz" en / browser sv / browser en / setting sv / setting

Optional, not a failure: a word that is also a language code CLDR names still counts, so "new" is recorded as new (Newari), like no-idea giving no, which the review chose to keep. What's recorded is still only a language's code, so the privacy sentence holds, and a model would have to put that word alone in language.

For the owner: while only English ships, nothing an organizer or participant sees changes. Magic Compose looks and behaves as in round 1. Out of sight, a signup.created row for a draft in a language this site doesn't offer gains a two- or three-letter draftLanguage, now only when the draft's value names a real language, and the privacy page's activity-log paragraph says so. Once Swedish ships, a draft that reports Swedish in any of the usual forms (sv, sv-SE, swe) starts its signup in Swedish whatever the organizer's own language, and one that reports English (en, eng) starts in English. The screenshots show the Settings tab of a swe draft by an English organizer (Svenska chosen, desktop and phone), an eng draft by a Swedish organizer (English chosen), a Tea-party helpers draft saved as usual, and the privacy paragraph.

Before merging: the evals (pnpm eval:magic-compose, pnpm eval:mcp) still need running with the LLM_* settings, together with #927's run. This tophat used a stub model, so it says nothing about how a real model reports language.

Screenshots are in 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 2)

The PR makes a Magic Compose draft report its language, starts the signup in that language when it has shipped, and records an unshipped one as draftLanguage on signup.created. I reviewed the whole PR against #927's head 4bfca33, and 15d274e against round 1. Round 1's one blocking item is fixed as asked, and the docs now say what the code keeps. The evals have not been run, and they must be before this merges, together with #927's run.

What I checked in 15d274e:

  • The reader (src/lib/magic-compose/prompt.ts:194-207) reads the whole value as a language tag and keeps only a code CLDR names. I ran about 60 values through MagicComposeDraftSchema under tsx on this head. eng, swe, deu and nor give en, sv, de and no. zzz, the, qaa, Swedish, hello, none, null, n/a, en,sv, both sentences from round 1 and Tea-party helpers give nothing. So do und, mis, mul and zxx, with a region or script after them too (und-SE, zxx-Latn). Dropping those four was a good addition: CLDR names two of them. Nothing fails a draft, including a 200,000-character string (1 ms) and one with a null byte.
  • Runtimes. LANGUAGE_NAMES is built once at module load from English names, which every ICU build of Node carries, so it can't throw at import. CI and this container run Node v22.23.4 (ICU 78.3, CLDR 48), and the production image is node:22-alpine. A self-hoster's Node with an older CLDR could name a few rare languages fewer, which only means a rare code goes unrecorded. The tests pin common ones (sv, de, fil, zh) and zzz and the.
  • The write (src/services/signups.ts:277). createSignup adds draftLanguage only when isLanguageCode passes, and otherwise creates the signup without it. The route's own caller always passes a clean code, so no create changes.
  • Tests fail without the fix. Putting back the old reader fails 12 tests in prompt.test.ts and 11 in route.db.test.ts. Writing draftLanguage without the shape check fails 9 in signups.db.test.ts. I ran each.
  • Docs. The code comment, docs/telemetry.md, the CHANGELOG entry and the PR's "What counts as a code" each say the same thing, and it matches what the probe showed. The privacy sentence ("that language's short code … never any of the draft's words") is true now: what's stored is CLDR's code for the language, never text copied from the reply.
  • Rest of the PR. Unchanged since round 1 apart from comments: the route's decision, the stripping before persistDraft and the preview, the questions arm, the golden, and the activity write inside createSignup's transaction.

Blocking (0)

Optional (2):

  • src/lib/magic-compose/prompt.ts:194: a value that is one bare word and also a language's code is kept: new (Newari), no, na (Nauru), no-idea as no. I'd leave it. Only a code is stored, the model has to put that word alone in a field that asks for a code, and a list of English words to refuse would be a table of ours that goes stale. The cost is a little noise in the count, and no starting a signup in Norwegian if Norwegian ever ships.
  • scripts/lib/eval-harness.ts: carried over from round 1 and left on purpose, since it can't be run here. When the evals are next run, a check that the reported language equals the case's expected language on ev_042 to ev_045 would show whether a real model reports a clean code.

Earlier threads: all resolved (round 1's one thread, on prompt.ts).
Checks: CI is green on this SHA (lint-type-test, e2e). The round-2 tophat passed on this same SHA, so no runtime code has changed since. Locally on Node v22.23.4: pnpm test src/lib/magic-compose src/i18n (22 files, 535 passed, 1 expected fail), pnpm test:db on the Magic Compose route and signups.db.test.ts (3 files, 225 passed), the probe above, and the two revert checks.

Gate: owner. It changes what's recorded about organizers, a legal page and what the AI is asked for, and its description asks for the evals (pnpm eval:magic-compose, pnpm eval:mcp) to be run before merging. Worth a look: the privacy page's activity-log paragraph, the signup.created row in docs/telemetry.md, and the tophat's two tables of what each reported value records.

https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt


Generated by Claude Code

@richshaw richshaw added pipeline:owner Passed; waits for the owner (UX or high-risk) and removed pipeline:review labels Nov 14, 2026 — with Claude
richshaw pushed a commit that referenced this pull request Nov 14, 2026
Brings in #928's address round (the reported-language reader, the shape check at createSignup's write, and the draftLanguage wording in docs/telemetry.md and the CHANGELOG), so this PR stays on top of #928.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
@richshaw richshaw removed the pipeline:working A session is working on it right now label Nov 14, 2026 — with Claude

Copy link
Copy Markdown
Owner Author

Closing without merging, at the owner's decision: a Magic Compose signup takes the organizer's language, like any other new signup, not the language the AI reports for its description. The reasons are simplicity and nothing hidden: an organizer can always see and change a signup's language in its Settings tab.

https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt


Generated by Claude Code

@richshaw richshaw closed this Nov 14, 2026
richshaw pushed a commit that referenced this pull request Nov 14, 2026
The owner decided a Magic Compose signup takes the organizer's
language, like any other new signup, rather than the language the AI
reports for its description. #928 is closed without merging; this
restores every file it changed to #927's version, so this branch can
sit on #927's directly. #927's prompt rule, which writes the draft's
own text in the description's language, stays.

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 14, 2026
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 14, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
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