refactor(desktop): type the main-process copy tables as catalogs - #5178
Open
orangeCatDeveloper wants to merge 1 commit into
Open
refactor(desktop): type the main-process copy tables as catalogs#5178orangeCatDeveloper wants to merge 1 commit into
orangeCatDeveloper wants to merge 1 commit into
Conversation
Four trilingual tables in the main process were plain object literals, so a missing locale or a key present in one language only was a runtime surprise rather than a compile error. Declaring the shape and applying `satisfies UiCatalog<T>` makes drift a type error, matching the renderer catalogs and the main-process tables that already do this. No copy changes. Generated-by: Claude Code
orangeCatDeveloper
marked this pull request as ready for review
September 11, 2026 04:41
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
Four trilingual copy tables in the main process were plain object literals, so nothing enforced that all three locales carry the same keys: a missing locale, or a key added to
zh-CNbut notzh-TW, was a runtime surprise rather than a compile error.windows-app-tray.tswas the loosest — noas const, no shape at all.Each table now declares its shape and closes with
satisfies UiCatalog<T>, the form already used bynotifications-policy.tsandclient-settings-confirmation-copy.tsin the same directory. Drift becomes a type error.No copy changes: the diff adds type declarations and rewrites three import lines, and touches no string.
Refs #2672
Verification
The five failures are
browser-message-box, red on the unmodified base commit (7 tests, 5 fail) and unrelated to this diff.No test accompanies the change because the guarantee is a compile-time one: deleting a locale from any of the four tables now fails
npm run typecheck, which is what a test would have had to assert.Review focus
packages/runtime-host/src/client/host-handoff-copy.tshas the same problem in a worse form —const zh = locale !== 'en'with nested per-locale ternaries — and is deliberately not in this PR. Its copy is selected byview.recoveryBlockerandview.reasonas well as locale, so converting it restructures the data model rather than adding a type, and it belongs in its own change with its own review of the three-locale output.AI use
Select exactly one:
Tool(s) and scope: Claude Code — located the untyped tables, wrote the shape declarations, and wrote this description. The commit carries a
Generated-by: Claude Codetrailer.Checklist
Does this PR entail a change in behavior?