Skip to content

refactor(desktop): type the main-process copy tables as catalogs - #5178

Open
orangeCatDeveloper wants to merge 1 commit into
apache:mainfrom
orangeCatDeveloper:fix/locale-catalog-shape
Open

refactor(desktop): type the main-process copy tables as catalogs#5178
orangeCatDeveloper wants to merge 1 commit into
apache:mainfrom
orangeCatDeveloper:fix/locale-catalog-shape

Conversation

@orangeCatDeveloper

Copy link
Copy Markdown
Contributor

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-CN but not zh-TW, was a runtime surprise rather than a compile error. windows-app-tray.ts was the loosest — no as const, no shape at all.

Each table now declares its shape and closes with satisfies UiCatalog<T>, the form already used by notifications-policy.ts and client-settings-confirmation-copy.ts in 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

apps/desktop full dist suite        2463 pass / 5 fail
apps/desktop typecheck (4)          0 errors
check-locale-hygiene                passed
npm run format:check                clean

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.ts has 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 by view.recoveryBlocker and view.reason as 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:

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

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 Code trailer.

Checklist

  • Tests cover the change and fail without it — the guarantee is compile-time; see Verification
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

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
@github-actions github-actions Bot added the effort/S Under 100 readable lines label Sep 11, 2026
@orangeCatDeveloper
orangeCatDeveloper marked this pull request as ready for review September 11, 2026 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/S Under 100 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant