Repository navigation
Conversation
A pure function for the notice on Your signups (#640): given the rows the page already loads, it says whether the titles look written in a language. One title with a word from the language's short list settles it; titles spelled only with its letters (å, ä, ö for Swedish) count when they make up at least half the list, since names and the neighbouring languages write those letters too. A word with a letter the language never writes (æ, ø, ü, ß) is never evidence. The markers are a table per language, so the next one adds an entry and no code. Server-only, beside the other i18n helpers; its only caller so far is its test, and the notice that uses it comes later. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Tophat: passedRan 7222d57 locally with
The guess over real rowsSeven organizers made through the app (one signup in the UI, the rest through
Answers I'd call wrong:
The PR's claims
Not UX: nothing calls the function yet. 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 adds signupsLookWrittenIn(locale, signups) and Swedish's table, with nothing calling it yet. The code is sound and the tests are real. The one problem is the word list: it's too narrow for #640's "lean towards showing it", because it leaves out every word Danish or Norwegian share. Widening it is a list change plus one small table field, and it's cheaper here than after the notice is built on it.
Blocking (1):
src/i18n/written-in.tslines 44 to 57: the list protects Danish and Norwegian organizers at Swedish organizers' cost. A lone Swedish title is found 43% of the time (the PR's figure). The inline comment gives the exact words, a second "shared words" field fortillandmed, and the numbers: 4 → 9 of the tophat's 11 Swedish titles, 5 → 16 of 30 others, English still 0 of 35.
Optional (3):
- English titles I had to contrive to get a yes from the wider list, so the builder can decide which words to drop: "Det. Smith retirement party" (det), "Som tam dinner" (som), "Ett Hem dinner" (ett), "Cafe Kaffe volunteers" (kaffe). I'd keep all four words. The list at this commit already has one of the same kind: "Sommar house cleanup" says yes.
- For the notice's PR, not this one: the description's "descriptions can go to this function beside the titles as they are" is wrong, as the tophat showed: extra rows count in the "at least half" rule and can turn a yes into a no. If the notice reads descriptions, they should only add evidence: a listed word in one says yes, and they never enter the count. The wider list is also what makes that read worth it (the tophat's missed description words included efter, till, behöver, välkommen).
src/i18n/written-in.tsline 135: once the list is wider, "leans towards yes" is true; today it oversells.
What I checked and found right:
- Whole words, any case: "Ochre", "Attendance" and "Grillkvällen" don't match och, att or kväll; "VEM TAR MED VAD?" does.
- Normalisation: titles and the table both go through NFC before lower-casing, so a decomposed "Städdag" counts. Taking the NFC call out fails a test.
- Table shape:
WRITINGisPartial<Record<CatalogLocale, WritingMarkers>>and the code reads nothing Swedish-specific; English has no entry and always says no. - Server-only:
opensignup/no-catalogs-in-clientcovers all ofsrc/i18n/exceptconfig, and the file isn't inCLIENT_SAFE_I18N. Its only import is a type. - Tests are real: I broke eight pieces in turn (NFC, lower-casing, the alphabet check, "at least half", one-letter words, wordless titles, "every word", whole-word matching) and at least one test failed each time.
- Repo rules: no schema, service, route or client code; nothing from the checklist applies. Knip is satisfied by the test.
Earlier threads: none. Copilot couldn't review (out of quota).
Checks: CI green on 7222d57 (lint-type-test, e2e). Locally: src/i18n/written-in.test.ts, 52 passed. Tophat passed at 7222d57, and no runtime code has changed since.
Not UX and not high-risk while nothing calls it, so the gate stays automatic once this is fixed. All titles above are made up.
https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Generated by Claude Code
The word list left out every word Danish or Norwegian share with Swedish, so the commonest words in Swedish titles (på, som, det, efter, fredag, kaffe) said nothing and a lone Swedish title was found less than half the time. A listed word now only has to be one English doesn't have, and the list gains small words, days and seasons and signup words. A second table field, sharedWithEnglish, holds till and med, which English has too: one counts only in a title that also has a word spelled with å, ä or ö, so "Kör till bortamatchen" says yes and "Open till noon" no. The tests pin the cost: Danish and Norwegian titles with på or hos now say yes, and so do "Open till late in Malmö" and "Med kit for Åre trip", the one way an ordinary English title can. Every word left out because English has it is pinned by an English title that stays no. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Tophat: passed (round 2)Ran bae3503 locally with
The guess over real rowsI created ten organizers through the app (one signup in the UI, the rest through
Random draws from the 27 new Swedish titles (real rows, 4,000 draws each), old → new: 1 title 26% → 41%, 3 titles 42% → 69%, 5 titles 60% → 86%, 10 titles 87% → 99%. Answers I'd call wrong:
Optional, for the builder or the notice's PR: the cheapest gains left are inflected forms of listed words (måndagar, matcher) and till beside a plain-lettered Swedish word. The second needs a word list this design doesn't have. Neither blocks: the PR states this limit and leaves it to the browser test. Not UX: nothing calls the function yet. 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)
Round 1 asked for one change: let a listed word be any word English doesn't have, and add a second field for till and med that counts only beside a word spelled with å, ä or ö. bae3503 does both, as asked, and nothing else in the module's logic moved. The comments now say what the code does, and the tests pin both the gains and the cost.
Blocking (0).
Optional (1), for the notice's PR (#640's second part), not this one:
- Plural and definite day names are worth adding there. The tophat suggested inflected forms of listed words. I tried them on a throwaway copy:
måndagar tisdagar onsdagar torsdagar fredagar lördagar söndagar, the same seven ending in-en(lördagen), andveckor kvällar: 12 of 12 recurring-day titles I made up move from no to yes ("Simskola måndagar", "Fika fredagar", "Bakning veckor 12-14"), and none of 16 English titles changes.- On the tophat's own 16 misses the gain is 1 ("Simskola måndagar"). So it's small, but free.
- Leave out
matcher(an English word, likematch) andhelger(a surname: "Helger family reunion" would say yes). "Sekretariat hemmamatcher" wouldn't be found bymatcheranyway: matching is by whole word. - Why not here: it's a runtime change, so this PR would go back through tophat and review for one title in 16. The notice's PR changes this area's caller and is tophatted and read by the owner anyway. Pin each new word with a Swedish title that says yes.
- I'm not suggesting
ioravas shared words. Both would widen the one way English says yes ("Åsa and I", "AV team for Malmö").
What I checked this round:
- Round 1's finding is handled. Every word I named is in the list (66 words, counted),
sharedWithEnglishis a table field, andtitleEvidencereads it with no Swedish-specific code. The check order is right: a listed word first, then a shared word beside a Swedish-lettered word, then the letters rule. - The tests are real. I ran the first version of the module (7222d57) against this test file: 14 fail, as the reply says. Then, on this version:
- letting
tillormedcount on its own fails 4 tests; never counting them fails 4; - putting back any one of the 19 left-out words (av, vi, om, den, barn, fest, mat, jul, tack, under, vid, mot, ska, kan, du, schema, match, fika, midsommar) fails at least one test, each time.
- letting
- The comments tell the truth. The
wordscomment says "English doesn't have", names the Danish and Norwegian overlap and why. The left-out comment lists English words, not Danish ones. The function's comment says what "leans towards yes" rests on, and names the till/med exception to "an English title with a Swedish name counts for nothing". - The cost is pinned and stated. "Open till late in Malmö" and "Med kit for Åre trip" are tested as yes, and the description tells the owner this is the choice to look at with the notice. The tophat's "Med students' trip to Göteborg" is the same edge, not a new one.
- The description's claims: 95 tests (ran: 95 passed), 4 → 9 on the tophat's titles (the tophat measured the same), English at 0 over every list the tophat tried.
Earlier threads: all resolved (1). Copilot couldn't review (out of quota).
Checks: CI green on bae3503 (lint-type-test, e2e). Locally: src/i18n/written-in.test.ts, 95 passed, plus the runs above. Tophat round 2 passed at bae3503, and no code has changed since.
Not UX and not high-risk: nothing calls the function yet, so the gate is automatic. Merge after #930, as the description says. All titles above are made up.
https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Generated by Claude Code
|
Closing without merging, at the owner's decision. OpenSignup won't guess a language from what organizers write. Each organizer has a stored language: the browser's language when the account is created, if OpenSignup has it, and changeable in account Settings. Each signup has its own language, which starts as the organizer's and can be changed in its Settings tab. With #934 closed too, the word list has no caller. https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt Generated by Claude Code |
Part of #640: the guess only. A pure function that says whether an organizer's signups look written in a language, and Swedish's word table. Nothing calls it yet: the notice on Your signups that uses it (its two buttons, telemetry and the
SHIPPEDgate) comes in a later PR.Merge after #930. It's built on #930's branch. It touches none of the files that #930, or the two PRs built beside it on the same base (the Swedish translation and #639's post-save prompts), change.
The stack
PR 40 of the localization stack (#619). Based on #930 (
claude/issue-637-stale-check); review against that branch.The problem
When Swedish ships, organizers who already write their signups in Swedish but whose browser says English won't hear about it. #640 shows them a notice when their browser's first language is Swedish or their signups look Swedish. This PR is the second test: a guess from text the Your signups page already loads, so it costs no query.
The fix
signupsLookWrittenIn(locale, signups)insrc/i18n/written-in.ts.Input: the rows
listSignupSummariesForWorkspacereturns, or anything with atitle(a test passesSignupSummaryrows as they are). The title is the only text those rows hold: the slug is the title with its accents stripped (toKebab), so it adds nothing.A table per language (
WRITING) holds four things for each language:The next language adds an entry and no code. English has none, so the function never says signups look English: there's nothing to offer.
Swedish's words (66): small words (och, att, inte, för, är, från, på, som, det, hos, ett, efter, utan, nästa, varje, år, åk, …), days, times and seasons (måndag to söndag, helgen, vecka, kväll, kvällen, augusti, sommar, hösten, våren, julen, påsk), and signup words (anmälan, skjuts, skolan, förskolan, kakor, kaffe, bullar, maten, barnen, föräldrar, hjälp, välkommen, behöver, loppis, julfest, sommarfest, matchen, laget, kiosken). Many are Danish or Norwegian too; that's deliberate (below).
Left out because English has them, each pinned by an English title that stays no: av (AV club), vi, om, den, barn, fest, mat, jul (Jul 4), tack, under, vid, mot, ska, kan, du, schema and match. Also fika and midsommar, which English has borrowed.
Words English shares (
sharedWithEnglish): till and med. One counts as a listed word only in a title that also has a word spelled with å, ä or ö. So "Kör till bortamatchen" says yes and "Open till noon" no.Words are runs of letters, lower-cased by the language's rules after NFC, so "STÄDDAG" matches and so does an
atyped with a separate combining diaeresis. Matching is by whole word ("Ochre" isn't "och"). One-letter words are skipped: Swedish "i", "å" and "ö" can't be told from English "a" and "I".Server-only: like everything in
src/i18n/exceptconfig.ts,opensignup/no-catalogs-in-clientrefuses it in a'use client'file (I checked with a throwaway client file). It takesCatalogLocalewithimport typeand adds nothing toconfig.ts, so it stays clear of the webpack split wall. No catalog keys: it shows no text.No CHANGELOG entry, since nothing calls it yet.
How it weighs the letters and words
Each title is one of:
Signups look Swedish when any title is strong, or when weak titles make up at least half of the titles that aren't empty.
On their own, å, ä and ö are weak evidence, because names ("Åsa", "Malmö") and the neighbouring languages have them too. So a title counts on letters alone only when every one of its words has them. A word with æ, ø, ü or ß rules its title out of weak evidence, however many å, ä or ö it has.
It leans towards yes, as #640 asks: "a wrong guess is cheap … so lean towards showing it", and its one hard limit is English. A listed word only has to be one English doesn't have. Words Danish and Norwegian share with Swedish are listed: a Dane or Norwegian who sees the notice dismisses it with one click, while leaving those words out would hide it from Swedes.
The one way an ordinary English title says yes: till or med beside a Swedish-lettered name, as in "Open till late in Malmö" or "Med kit for Åre trip". Both are pinned in a test. It's accepted for three reasons: such an organizer is likely in Sweden, a wrong yes costs one click on "Keep English", and till is the word that finds the most Swedish titles. Owner: this is the choice to look at when you review the notice. Besides that, English titles made up around a listed word also say yes ("Det. Smith retirement party", "Som tam dinner", "Ett Hem dinner", "Cafe Kaffe volunteers", "Sommar house cleanup"). Those words stay, because they're common in Swedish titles, and these titles are pinned too.
Other languages
How often it shows
The 11 Swedish titles the tophat named, one at a time: 4 → 9 said yes.
I also wrote synthetic titles before choosing the words: 40 Swedish; 26 English, with Swedish names and borrowed words among them; and 10 to 12 each in German, Danish, Norwegian and Finnish. Then I drew lists from each at random. How often the notice would show, before → after this round:
Titles alone are still thin. What's still missed is compounds with no listed word beside a plain word ("Grillkväll i parken", "Julpyssel", "Pantinsamling"), and med with no Swedish-lettered word beside it ("Lussebak med scouterna"). These are pinned as no. An organizer whose only signups are titled like that is found by their browser or not at all.
If the notice's PR reads descriptions too, one bounded read would do: the first 300 characters of the 20 newest live signups' descriptions, in one statement. Descriptions should only add evidence: a listed word in one says yes, and they never enter the "at least half" count. Don't pass them in as extra rows. The tophat showed that rows can turn a yes into a no, because they swell the count. The tophat also found that sentences use everyday words a title list doesn't (behöver, välkommen, efter, till). The wider list now has most of them, which is what would make the read worth it. Two more things to weigh:
This PR doesn't build it.
Where the issue is out of date
Nothing found for this part. The page loads
listSignupSummariesForWorkspace's rows, as #640 says, and their only text is the title.Tests
src/i18n/written-in.test.ts(95 tests):English: plain titles; titles with a Swedish place or person ("Carpool to Malmö", "Potluck at Åsa's", "Picnic at Åre", "Kräftskiva with the Andersons"); borrowed and look-alike words ("Fika Friday", "Open till noon", "Med school potluck", "Midsommar party", "Barn dance", "Jul 4 parade", "AV club", "Under 12s match", "Ochre and gold gala"); one English title for each word left out; a whole list of them; a lone name ("Malmö") among English titles. Pinned as yes: till or med beside a Swedish name, and the made-up titles above.
Swedish: titles with a listed word; the tophat's misses that now hit ("Fika efter gudstjänsten", "Kör till bortamatchen", "Loppis i gympasalen", "Sommarfest", "Tränare till F12"); titles of words with å, ä or ö; upper case and decomposed letters; whole words only; and the misses that remain.
Mixed lists: one Swedish word among many English titles shows it, as does "Städdag på förskolan" among six; letters alone need half the list; Swedish titles that say nothing count against a weak one.
Empty lists and untitled signups: an empty list, titles with no words ("", "2026", "🎉🎉", "chore(deps): bump nodemailer from 7.0.13 to 8.0.5 #1"), and wordless titles left out of the count.
Very short titles: one-letter words skipped ("Ö", "I"); "Ok" and "Te" say nothing; "Kör" is weak and "Två" strong.
German, Danish, Norwegian and Finnish, as in the table above.
The table: English never looks written in;
SignupSummaryrows go in unchanged.Each piece is needed. I broke each one in turn and a test failed every time:
The first version of the module (7222d57) fails 14 of these tests.
Ran:
pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test(214 files, 3122 passed, 1 expected fail). Nopnpm test:dbor build: no database or client code changes, and nothing imports the module yet.🤖 Generated with Claude Code
https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt