Skip to content

fix(i18n): map expected failure codes instead of raw messages - #4641

Open
orangeCatDeveloper wants to merge 1 commit into
apache:mainfrom
orangeCatDeveloper:fix/locale-sniff-raw-message
Open

fix(i18n): map expected failure codes instead of raw messages#4641
orangeCatDeveloper wants to merge 1 commit into
apache:mainfrom
orangeCatDeveloper:fix/locale-sniff-raw-message

Conversation

@orangeCatDeveloper

Copy link
Copy Markdown
Contributor

Summary

Five renderer sites still rendered a raw error.message or decided what to show by sniffing for CJK characters, so English users saw operator/Host prose verbatim (or, where sniffed, lost the information). Each is now code → catalog:

  • Runtime Host management dialog: the operator CLI's service-management frame keeps error.code as an open string on the wire (operator version skew), so the closed union lives at the presenter — RuntimeHostManagementErrorCode (26 codes) mapped per locale in settings-projects-copy.ts with an Object.hasOwn unknown fallback; all five response.error.message renders go through it. A test reads the CLI's RuntimeHostServiceManagerError code union from source and asserts every code is mapped, so a new CLI code fails the desktop test suite instead of silently falling back.
  • Thread search: error.reason was already a typed SearchErrorReason; the five reasons thread search emits are mapped in shell-controls-copy.ts, the rest fall back, and the thrownErrorMessage seam that rendered error.message is gone (raw error goes to console.error).
  • provider-panel-shared.ts and artifact-pane.tsx: the CJK-passthrough guards were dead — the main handlers they defend against throw English only today — so they are deleted with a guard test.

Not changed: skill-status.ts sniffs skill.description, which is third-party SKILL.md data rather than our copy; the right fix is to show data as-is and drop the keyword blurbs, a product decision left for a separate discussion.

Refs #2672

Verification

workspace typecheck:                    0 errors
desktop main tests (dist):              1997 pass / 0 fail (3 new: code map completeness vs CLI source, zh+en render, unknown fallback)
packages/ui tests:                      335 pass / 0 fail
knip (apps/desktop, packages/ui):       clean
renderer architecture check:            passed against origin/main
format:check / biome:                   clean

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Code — producer tracing, implementation, tests, and this description, under the contributor's direction; the commit carries a Generated-by: Claude Code trailer.

Checklist

  • Tests cover the change and fail without it

@github-actions github-actions Bot added the effort/M Under 500 readable lines label Sep 3, 2026
@orangeCatDeveloper
orangeCatDeveloper force-pushed the fix/locale-sniff-raw-message branch 2 times, most recently from 14a80d6 to 95b736e Compare September 3, 2026 09:48
Runtime Host management and thread search already carry stable failure
codes, so the renderer maps them through locale catalogs with an explicit
unknown fallback. The CJK sniffs in the provider and artifact error
presenters guarded producers that no longer throw Chinese copy.

Generated-by: Claude Code
@orangeCatDeveloper
orangeCatDeveloper force-pushed the fix/locale-sniff-raw-message branch from 95b736e to 6efe16e Compare September 3, 2026 10:15
@orangeCatDeveloper
orangeCatDeveloper marked this pull request as ready for review September 3, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/M Under 500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant