Repository navigation
Fail the Docker image build when Node lacks full ICU - #890
Conversation
Intl formats dates and numbers only in the languages whose ICU data Node carries, and a Node with English-only ICU prints every other language in English without an error. The runner stage, where the app and the worker run, now checks that Intl resolves Swedish to itself and stops the build with a message if it doesn't. CI never builds the image, so this is the only place the check can run. Part of #622. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Tophat: passedThe image build itself wasn't run. This container has no Docker daemon (
One wording nit, not a blocker: "Before merging" says the quick check "should print nothing", but the trailing Only your command or a real image build can show that the stock No screenshots, because nothing on screen changes. Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt Generated by Claude Code |
richshaw
left a comment
There was a problem hiding this comment.
Review: passed (round 1)
This adds #622's Dockerfile bullet and nothing else: one RUN node -e step at the top of runner that fails the image build unless Intl.DateTimeFormat('sv').resolvedOptions().locale is 'sv', a comment saying why, and a CHANGELOG line. It does what the issue asks, in the right place, and the stock base passes it.
What I checked:
- The right stage. All three stages derive from
base(node:22-alpine), sorunner's Node is also the onebuilderrunspnpm buildon.runneris the last stage, and nothing names another target:docker-compose.prod.yml'sx-instance-build(migrate, web and worker),fly.example.tomland the README'sdocker buildall build it. Putting the check inbasewouldn't catch anything sooner in practice: under BuildKit (the default builder in current Docker and Compose), this step depends only onbase, so it runs alongsidedeps'pnpm install, and its failure cancels the build as soon asbaseis ready. Only the legacy builder would get throughpnpm buildfirst. Inrunnerit also keeps checking the Node that serves pages and sends emails if that stage'sFROMever changes. I agree with where it is. node:22-alpinehas full ICU today. docker-node's22/alpine3.24/Dockerfile(the current22-alpine, Node 22.23.5) installs nodejs.org's officiallinux-x64-muslbinary on amd64, and on other architectures compiles from source with a plain./configure(full ICU by default since Node 13). It never links Alpine's system ICU. I downloaded that musl tarball, checked it against nodejs.org's SHASUMS256, and read the binary without running it. Its embedded config says"icu_small": falseand ICU 78, and its embedded data holdsicudt78l/sv.res,sv_SE.resandcoll/sv.resamong 145 two-letter locales. That's the same count as this container's full-ICU Node 22.23.4, which resolvessvtosv.- The line itself. Run through
/bin/sh -cexactly as theDockerfilehas it, on Node 22.23.4: exit 0, no output. The tophat's runs with English-only ICU data (exit 1, with the message) and its check with BuildKit's parser stand. - The message says what
svresolved to and what goes wrong, and gives the fix that always works: the official node images. See the first optional point for the one case it could name. - CHANGELOG: accurate, under Changed. It needs no "Before upgrading:": the stock build is unaffected, and anyone on another base gets a failed build with the reason, not a broken site.
Blocking (0).
Optional (3):
Dockerfile47–52: the likeliest way anyone hits this is Alpine's ownnodejspackage (FROM alpineplusapk add nodejs, to slim the image). It's built--with-intl=system-icu, and Alpine's ICU installsicu-data-en(en_US and en_GB only) unlessicu-data-fullis added, as Alpine's own post-install note says. Namingicu-data-fullin the comment or the message would give that self-hoster a one-line fix instead of a base-image change.- PR description, "Before merging": the quick command prints
exit=0(and Docker's pull progress the first time), not nothing, as the tophat noted. Also, on an Apple-silicon machinedocker run node:22-alpinepulls the arm64 image, whose Node docker-node compiles from source, while amd64 builds (most servers and cloud builders) get the musl binary checked above.docker run --rm --platform linux/amd64 node:22-alpine …tries that one. - README, "Other ways to run it": the check covers only the image. Someone running the app from source on their own Node 22 gets no check, and once Swedish ships, an English-only ICU there (that same Alpine package) would print dates in English without a word. That's outside this PR (#622 asks only for the
Dockerfile). "With full ICU" next to "Node 22.12 or later" belongs with the README changes in Swedish's launch step (#639). Not filed separately.
Earlier threads: none. Copilot couldn't review (its quota was used up).
Checks: CI on 0f6e749 is green: lint-type-test, e2e, CodeQL. Locally: the RUN line under /bin/sh -c, the read of the official musl binary above, and the shared runtime-change check since the tophat (0, same SHA). The tophat at 0f6e749 passed. No image was built: there's no Docker daemon here, and CI builds none.
Waits for the owner because it changes the Dockerfile (high-risk) and asks you to run a check before merging. Nothing on screen changes, so there are no screenshots. What to look at: the six Dockerfile lines and, if you can, the "Before merging" command (or docker compose -f docker-compose.prod.yml build) to see the stock base pass for real. That's the one thing nothing here could run.
Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Generated by Claude Code
|
Approved by the owner at The owner approved merging the localization stack (#897 up to #931) in the orchestrating session on 15 November 2026, and chose to include this PR in it. https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt Generated by Claude Code |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
|
catch-up: merged https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt Generated by Claude Code |
main moved on by 62 commits since this branch was built: the whole localization stack (#897 to #999) plus #806, #890, #983 and #984. Files main added in folders this branch moved now sit in the route groups: eleven under src/app/(organizer)/app/(chrome)/, six under src/app/(organizer)/login/ and one under src/app/(organizer)/oauth/. main's footer `locale` on src/app/s/layout.tsx moves into src/app/s/[slug]/layout.tsx, which absorbed it, and the global 404 passes one too. CHANGELOG.md keeps both sides' entries, CLAUDE.md the new consent paths and main's Languages line, and a11y.spec.ts both new tests. The lint rule lists in eslint.config.mjs, the file list in no-hard-coded-text.test.ts, two test imports and two comments now name the new paths. The signup page's metadata test expects the tab title the page writes itself (`title.absolute`), as it does on this branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt
Part of #622: the image check. The formatting itself is in the localization stack.
The stack
Stands alone, beside the localization stack (#619): based on
main, review againstmain. The formatting PRs in the stack (slot dates and times, then the other formatters) don't depend on it, and it doesn't depend on them.The problem
Intlformats dates and numbers only in the languages whose ICU data Node carries. A Node with English-only ICU (a small-ICU build, or one linked against a system ICU that ships only English) doesn't throw when asked for Swedish: it quietly formats in English. Once the stack formats slot dates per language, an image built on such a Node would show Swedish signups English dates, with nothing in the logs. CI can't catch it, because CI never runs the image's Node (see Tests).The fix
Dockerfile: oneRUN node -estep at the top of therunnerstage, with a comment saying why. It fails the build unlessIntl.DateTimeFormat('sv').resolvedOptions().localeis'sv', and prints what it resolved to:It sits in
runnerbecause that's the image the app, the worker and the migrate step run from (docker-compose.prod.ymlbuilds all three from the default target). Every stage isFROM basetoday, but if someone pointsrunnerat a different image, the check follows the Node that actually runs.CHANGELOG: one line under Changed, since someone building on a different base image could now see a new build failure. The stock
node:22-alpinebase is expected to pass (Node has built with full ICU by default since v13).Nothing else from #622 is here:
formatSlotDate,formatSlotTimeand the other formatters are the stack's PRs. The issue's note that "CI's Node isn't the image's, so CI can't check this" still holds on today'smain.Tests
The image build itself wasn't run. This container has no Docker daemon, and CI doesn't build the image either:
.github/workflows/ci.yml(the only workflow) runs lint, typecheck, knip, unit, db and e2e tests onactions/setup-nodeNode 22 on Ubuntu, and nothing in it runsdocker buildor uses theDockerfile. So I ran the exact command instead, taken from theDockerfileline (RUNstripped) and run through/bin/sh -c, as a shell-formRUNis:NODE_ICU_DATApointed at an empty folderNODE_ICU_DATApointed at a folder whoseicudt78l/res_index.reslists onlyenanden_USas installed (built with Ubuntu'sgenrbfromres_index:table(nofallback) { InstalledLocales { en {""} en_US {""} } }), which is what an English-only ICU looks like toIntlresolved sv to en-US)Under that English-only data,
toLocaleDateString('sv', { weekday: 'short', day: 'numeric', month: 'short', timeZone: 'UTC' })on 2 May 2026 givesSat, May 2andIntl.NumberFormat('sv').format(1234.5)gives1,234.5, againstlör 2 majand1 234,5with full ICU: the silent fallback the check exists to catch.I also tried a genuinely small-ICU Node (the official Node 12 binaries were built that way), but this session isn't allowed to run a downloaded binary, so that wasn't run.
pnpm lint && pnpm format:check && pnpm typecheck && pnpm knip && pnpm test: pass (2193 tests). Nothing else applies: no code, services or pages changed.Before merging
Since nothing here could build the image, run the check against the real base once. The quick version takes seconds. After Docker's pull progress the first time, it should print only
exit=0.--platform linux/amd64tests the build most servers and cloud builders use, even on an Apple-silicon Mac (whose own arm64 image's Node is compiled from source):Or build the whole image (
docker compose -f docker-compose.prod.yml build, or the next deploy) and see the step pass.🤖 Generated with Claude Code
https://claude.ai/code/session_016YZ9SVnYjqfPQCMgeA7pDt