fix(desktop): localize expected errors - #4457
Draft
orangeCatDeveloper wants to merge 1 commit into
Draft
Conversation
orangeCatDeveloper
force-pushed
the
fix/desktop-error-codes
branch
from
September 1, 2026 11:03
53b08a5 to
b6ef648
Compare
This was referenced Sep 1, 2026
orangeCatDeveloper
marked this pull request as draft
September 1, 2026 17:15
Contributor
Author
|
Converting to draft: blocked on the copy-gate/architecture-ratchet collision described in #2672 (comment) — #4493 resolves the checker policy; this branch then rebases (and splits the global error mapper per review). Will mark ready once green. |
orangeCatDeveloper
force-pushed
the
fix/desktop-error-codes
branch
2 times, most recently
from
September 2, 2026 08:40
adf4f4a to
6b28e30
Compare
Astro-Han
pushed a commit
that referenced
this pull request
Sep 2, 2026
…cture ratchet (#4493) Two repository gates deadlocked. The locale policy (#2672) moves user-visible copy out of business files into src/renderer/locales/*-copy.ts catalogs, which adds an import edge; the renderer architecture ratchet forbids legacy files from growing their dependency count and rejects new AppShell-closure entries. #4457 failed CI on exactly that collision, and no placement of a catalog could satisfy both gates. Admit one dependency class instead of loosening the ratchet: a validated copy catalog, recognized structurally and re-verified on every run, never grandfathered. It must live under src/renderer/locales/*-copy.ts, carry the UiCatalog marker from @maka/core/ui-locale, have zero tracked capabilities by the checker's own metrics, and import bare package specifiers only, so it can never become a tunnel to renderer implementation. Admitted edges are excluded from the dependency-count ratchets and closure admission, and the ledger drops 26 budget entries that only existed for catalog imports. Root-entry files get no discount, and a catalog that grows a hook or a relative import loses admission immediately. The environment-capability predicate now counts identifiers only in value-reference positions, so a copy key named history or a parameter named location no longer reads as a browser global, and type-only imports and exports are not counted as runtime dependencies. Adversarial fixtures cover hook smuggling, implementation-import smuggling, a missing marker, dynamic imports and an unrelated dependency added beside a valid catalog. Part of #2672. Generated-by: Codex
3 tasks
orangeCatDeveloper
force-pushed
the
fix/desktop-error-codes
branch
4 times, most recently
from
September 2, 2026 18:13
13b0d58 to
ad06382
Compare
orangeCatDeveloper
force-pushed
the
fix/desktop-error-codes
branch
from
September 3, 2026 07:15
ad06382 to
778e2c7
Compare
Raw exception text no longer reaches the UI: expected failures carry machine-readable codes (with params where needed) that the renderer maps through locale catalogs, and unexpected failures show a localized fallback while redacted diagnostics go to the console. Generated-by: Claude Code
orangeCatDeveloper
force-pushed
the
fix/desktop-error-codes
branch
from
September 3, 2026 07:41
778e2c7 to
f75be20
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Desktop surfaces rendered raw exception text as user-facing copy: a zh user hitting an expected failure saw an untranslated English
error.message, and unexpected exceptions could leak internal details into toasts and error banners. Producers (guest-session mounts, Work Board IPC, WorkHub controller, the Runtime's session-control guards, the composer attachment pipeline) now return machine-readable codes —{ code, params }where a message needs data — and the renderer maps codes through the locale catalogs. Expected failures throw a typedExpectedOperationError; everything else logs a redacted diagnostic and shows a localized fallback. This also deletes WorkHub's English-message-regex classifier and theMAKA_SESSION_READ_MESSAGES_ERRORmarker protocol.Per review, the global error mapper is split: each domain maps its own code union at its presenter; the
ExpectedOperationErrortransport and redacted diagnostics live once in@maka/ui, with an application contract as the renderer-side entry. The Runtime's 8 session-control guards and 11 attachment validations reject with stablesession_control_blocked:<code>/attachment_ingest:<code>tokens that survive IPC wrapping (the CLI reason-token convention), mapped bilingually at the sharedlocalizedShellErrorMessageentry — both locales previously lost these reasons to a generic fallback. Structured{ok, code}envelopes replacing the token convention are tracked as a follow-up (both serialization boundaries strip custom Error fields, so envelopes require send-contract changes with Host version-skew handling).Refs #2672
Depends on #4581:
conversation-copy.tskeys its Work Board error records off the IPC contract's code union via a type-only import, which the pre-#4581 ratchet prices as debt.Verification
Before (zh UI, stale Work Board write / import over mount limit — raw English internals):
After (same failures; raw detail now only in the redacted console diagnostic):
AI use
Select exactly one:
Tool(s) and scope: Claude Code — analysis, implementation, tests, and this description, under the contributor's direction; the commit carries a
Generated-by: Claude Codetrailer.Checklist