Skip to content

test(i18n): exempt source-only bootstrap locales from English-fallback invariants - #163442

Closed
jcorrius wants to merge 1 commit into
openclaw:mainfrom
jcorrius:fix/ui-source-only-locale-invariants
Closed

jcorrius wants to merge 1 commit into
openclaw:mainfrom
jcorrius:fix/ui-source-only-locale-invariants

Conversation

@jcorrius

@jcorrius jcorrius commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

A locale registered without committed translation memory fails the three "localized in shipped locale bundles" invariants in ui/src/i18n/test/translate.test.ts, so any source-only locale contribution PR is red on checks-ui before the post-merge refresh can generate its translations.

Why This Change Was Made

#131015 established the source-only locale flow: a locale contribution registers its adapter and wiring in a source PR, and the serialized control-ui-locale-refresh workflow commits generated translation memory (<locale>.tm.jsonl) only after merge. Until then, ui/config/control-ui-locales.ts intentionally serves the English catalog for that locale ("Source PRs omit generated memory until the post-merge refresh runs").

#159292 later derived the invariant tests' locale sweep from SUPPORTED_LOCALES (replacing the explicit locale lists). That sweep now automatically includes newly registered locales, so the invariants fire against the intentional English bootstrap copy and contradict the #131015 flow. No locale has been added since, so the conflict only surfaces now (first exercised by the Catalan locale PR #139033).

Summary of changes

  • ui/src/i18n/test/translate.test.ts: derive a memoryBackedLocales subset from the presence of committed ui/src/i18n/.i18n/<locale>.tm.jsonl and iterate it instead of shippedLocales in the three English-fallback invariants (login failure guidance, mobile pairing copy, chat composer attachment action).
  • The "version label" and "newly exposed locales" tests are unchanged: bootstrap locales satisfy them via the English catalog.

The exemption is derived, not listed: once the refresh workflow lands a locale's memory, that locale is automatically subject to the full invariants again, so the change cannot hide a regression for any memory-backed locale. On current main the subset equals the full set (all 20 locales have memory), so this change is a verified no-op today and only affects future source-only locale PRs.

User Impact

None directly. Test scoping only; no runtime behavior changes.

Evidence

All runs below were executed on reviewed head 6762826418f through the production Vite locale loader (node scripts/run-vitest.mjs run --config ui/vitest.config.ts --project unit src/i18n/test/translate.test.ts), with the environment pinned via PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH to the Playwright chromium headless shell. Full raw terminal transcripts (ANSI) are attached to the fork release proof-163442-bootstrap-invariants; all output is synthetic — no credentials, private endpoints, or personal data.

  • No-op on main state: on the pristine reviewed head (no scratch locale), src/i18n/test/translate.test.ts + src/i18n/lib/registry.test.ts pass 28/28 (8.85s). Transcript: 3-pristine-head.log.
  • pnpm ui:i18n:verify passes.
  • No new tests; affected files' suite runtime is unchanged.

Real behavior proof

The source-only locale contribution flow was exercised on the reviewed head by registering a memory-less ca locale through the real production path — ui/src/i18n/lib/registry.ts lazy entry, scripts/lib/control-ui-i18n-config.json locale entry, and the virtual:openclaw-control-ui-locale/ca adapter — with no ca.tm.jsonl, exactly as the Catalan PR (#139033) ships it. The scratch registration was left uncommitted; only the test file differs between the two runs.

Run 1 — without this patch (main's translate.test.ts), scratch locale registered

The three invariants fail against the intentional English bootstrap catalog, reproducing the #139033 CI failures verbatim. Transcript: 1-without-patch-scratch-locale.log

⎯⎯⎯⎯⎯ Failed Tests 3 ⎯⎯⎯⎯⎯⎯⎯⎯
 FAIL  unit  src/i18n/test/translate.test.ts > i18n > keeps login failure guidance localized in shipped locale bundles
AssertionError: ca:login.failure.rawError: expected 'Raw error' not to be 'Raw error' // Object.is equality
 FAIL  unit  src/i18n/test/translate.test.ts > i18n > keeps mobile pairing copy localized in shipped locale bundles
AssertionError: ca:devices.pairing.button: expected 'Pair device' not to be 'Pair device' // Object.is equality
 FAIL  unit  src/i18n/test/translate.test.ts > i18n > keeps the chat composer attachment action localized in shipped locale bundles
AssertionError: ca:chat.composer.addAttachment: expected 'Add attachment' not to be 'Add attachment' // Object.is equality

 Test Files  1 failed (1)
      Tests  3 failed | 12 passed (15)

Run 2 — with this patch (reviewed head), same scratch locale registered

The same production load now passes; the memory-backed locales keep full invariant coverage. Transcript: 2-with-patch-scratch-locale.log

 Test Files  1 passed (1)
      Tests  15 passed (15)
   Duration  6.67s

The scratch locale was then removed (git status clean) before Run 3 above, confirming the reviewed tree itself is unchanged.

Unblocks #139033, whose checks-ui lane is otherwise red on exactly these three tests until its post-merge refresh lands.

@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The PR limits three non-English translation assertions to locales with generated translation memory, allowing source-only locale contributions to pass validation during their intentional English bootstrap period.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, correct validation repair with relevant production-loader before/after evidence and no remaining substantive blocker.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The captured terminal evidence exercises the actual Vite locale materializer with a memory-less Catalan registration on this head: three failures before the patch become 15/15 passes afterward. This proves the changed validation boundary without mocked catalogs; no stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Merge readiness

✅ Ready for maintainer review

This PR remains useful: current main and the latest release still contradict the documented source-only locale contribution flow. No actionable patch defect remains, and the updated terminal evidence addresses the earlier proof request.

Priority: P2
Reviewed head: 6762826418f6943b808df950c2f2904c81632250

Before merge

None.

Findings

None.

Agent review details

How this fits together

Control UI localization loads registered language catalogs through Vite, using English until generated translation memory arrives. These tests check the loaded catalogs before locale contributions can merge.

flowchart TD
 A[Registered locales] --> B[Vite locale loader]
 C[Translation memory] --> B
 B --> D[Loaded catalogs]
 D --> E[Memory file present]
 E -->|Yes| F[Localized text assertions]
 E -->|No| G[Bootstrap loading checks]
Loading

Technical review

Best possible solution:

Keep bootstrap locales loadable and automatically restore all localized-text assertions when their generated memory arrives.

Do we have a high-confidence way to reproduce the issue?

Yes: registering a locale without memory makes the production loader return English, necessarily failing the current three non-English assertions. Contributor before/after output demonstrates that scenario; this read-only review did not execute it.

Is this the best way to solve the issue?

Yes: matching assertion scope to the loader’s existing absent-memory boundary preserves generated-locale checks without changing runtime behavior or adding permanent locale exemptions.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4ee88721f043.

Security

None.

Evidence

What I checked:

  • Pinned introduced patch: The introduced delta only changes the scope of three translation assertions. Every registered catalog is loaded before filtering; version-label and existing fallback-regression checks remain unchanged. (ui/src/i18n/test/translate.test.ts:14, 6762826418f6)
  • Existing production boundary: The locale materializer returns English only when memory is absent. Present empty memory throws, and malformed memory fails parsing. Existing loader tests separately cover these cases. (ui/config/control-ui-locales.ts:60, 6762826418f6)
  • Intentional source-only contribution contract: The fully read UI policy requires source contributions to omit generated translation memory and delegates translation generation to the post-merge refresh workflow. (ui/AGENTS.md:65, 6762826418f6)
  • Still necessary on current main: The fetched main revision retains the unfiltered registered-locale sweep for all three assertions. No merged replacement fixing this scope was established. (ui/src/i18n/test/translate.test.ts:168, 4ee88721f043)
  • Latest release comparison: The supplied latest release, v2026.9.7, also contains the unfiltered assertions; this repair is not already shipped there. (ui/src/i18n/test/translate.test.ts:168, c074824a27c9)
  • After-fix production-loader evidence: The captured body, sourceRevision e632f8409addda72ce6402a7aa007a6f5ddf643d3a3c02c8ce095f24cfb3a5c7, identifies this head and a memory-less Catalan registration through the real registry, canonical configuration, and Vite adapter. Copied terminal output shows the three expected failures without the patch and 15/15 passes afterward; pristine-head validation reports 28/28 in 8.85 seconds. The unit project installs the actual production locale plugin. Downloaded related screenshots were inspected as context, not proof of this test change. Full linked transcripts could not be retrieved because release-assets.githubusercontent.com is blocked; the captured terminal evidence remains sufficient. (ui/vitest.config.ts:363, 6762826418f6)

PR surface

Tests +12. Total +12 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 15 3 +12
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 15 3 +12

Review metrics

Metric Value Why it matters
Existing locale coverage 20 of 20 foreign locales retain all 3 assertions All currently registered foreign locales have memory, so the exemption affects source-only additions.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This repairs a bounded locale-contribution validation failure without changing shipped runtime behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (3 earlier review cycles)
  • reviewed 2026-10-02T10:05:32.705Z sha 34535e2d92b852d42c7ab09689b73ed3bf8e78de :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-02T10:20:53.293Z sha 6762826 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-02T10:30:20.943Z sha 6762826 :: needs maintainer review before merge. :: none

Reviewed October 2, 2026, 6:35 AM ET / 10:35 UTC (Revision 4).

…k invariants

The shipped-locale invariants in translate.test.ts started deriving their
locale sweep from SUPPORTED_LOCALES (openclaw#159292), which accidentally broke the
source-only locale flow from openclaw#131015: a locale registered before the
post-merge control-ui-locale-refresh workflow commits its translation
memory intentionally bootstraps from English copy, so the three
"localized in shipped locale bundles" tests fail for it.

Hold only locales with committed <locale>.tm.jsonl memory to those
invariants. The exemption derives from the memory file's presence, so it
retires itself once the refresh workflow lands translations and cannot
hide a regression for any memory-backed locale.

Unblocks the Catalan locale PR (openclaw#139033).
@jcorrius
jcorrius force-pushed the fix/ui-source-only-locale-invariants branch from 34535e2 to 6762826 Compare October 2, 2026 10:14
@clawsweeper clawsweeper Bot added the proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. label Oct 2, 2026
@jcorrius

jcorrius commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. labels Oct 2, 2026
aaroil3 added a commit to aaroil3/openclaw that referenced this pull request Oct 6, 2026
Same change as openclaw#163442. Hebrew ships without translation memory until the
post-merge locale refresh, so its catalog intentionally falls back to English.

Co-authored-by: Jesús Corrius <[email protected]>
jcorrius added a commit to jcorrius/openclaw that referenced this pull request Oct 7, 2026
Same change as openclaw#163442 (same author); drops out on rebase if openclaw#163442 merges first. Source-only locales bootstrap from English until the post-merge locale refresh commits their translation memory, so the English-inequality invariants cannot hold for them yet.
@vyctorbrzezowski

Copy link
Copy Markdown
Member

Thanks @jcorrius for addressing the bootstrap-locale test failures. Closing this as superseded by #169801: all three locale fallback assertions modified here were removed in that change and remain absent on current main. The proposed exemption therefore no longer has a test contract to apply to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants