GLM-5.3 · Balanced
feature-localization-fallbacks-server-side-discourse-cursor
Discourse · Ruby · S · 30–99 lines · 6 files
The normal review, with one generalist agent. Judge: Claude Haiku 5.5.
- Gold bugs found
- 2 of 2
- Comments published
- 2
- Comments matching a bug
- 2
- Comments not matching
- 0
- Cost of this PR
- $1.407
Published comments (2)
Translation LRU cache key omits default_locale, serving stale cross-tenant fallbacks — Fallback-resolved translations are cached under a key that omits `SiteSetting.default_locale`, even though `FallbackLocaleList#[]` now makes the result depend on it. The no-args fast path in `lib/freedom_patches/translate_accelerator.rb:72` caches under `"#{key}#{config.locale}#{backend.object_id}"` and nothing in the repo clears it (no `I18n.reload!` call sites exist), so after an admin changes the default locale, hot (key, locale) entries keep serving the old fallback text indefinitely — and on multisite, where `SiteSetting.default_locale` differs per tenant but the LRU cache is process-global, tenant A's fallback resolution is served to tenant B for the identical (key, locale).
Fallbacks only loaded in web requests; background jobs miss English fallback translations — `I18n.fallbacks.ensure_loaded!` is wired only into the web `set_locale` filter, so fallback locales are never loaded in background processes — `app/jobs/base.rb:151` and the `I18n.with_locale` callers (`app/services/post_alerter.rb:138`, `lib/post_destroyer.rb:102`) set a thread locale but never ensure the chain is loaded, and `I18n::Backend::Base#load_translations` is patched to a no-op without explicit filenames (translate_accelerator.rb:25-29). On any site with `default_locale` ≠ en, keys missing from the current locale render as `translation missing: xx.key` strings in emails and notifications instead of falling back to English, until the process happens to translate with en as the thread locale.
Gold bugs found (2)
Gold bugs missed (0)
None.