Skip to content

fix(ci): widen the locale hygiene gate to its blind spots - #5180

Draft
orangeCatDeveloper wants to merge 1 commit into
apache:mainfrom
orangeCatDeveloper:fix/locale-hygiene-coverage
Draft

fix(ci): widen the locale hygiene gate to its blind spots#5180
orangeCatDeveloper wants to merge 1 commit into
apache:mainfrom
orangeCatDeveloper:fix/locale-hygiene-coverage

Conversation

@orangeCatDeveloper

Copy link
Copy Markdown
Contributor

Summary

The locale hygiene gate had three blind spots, and each one already has a live instance behind it.

SCOPE covered apps/desktop/src, packages/core/src and packages/ui/src — not packages/runtime-host/src. That is the one package where const zh = locale !== 'en' survives (client/host-handoff-copy.ts:33), the exact shape locale-literal-compare exists to reject, in the only tree the rules never opened.

Two patterns had no rule at all:

  • A Han fallback handed to generalizedErrorMessage. That helper always renders en (redaction.ts:293), so a Chinese fallback makes the surface switch language by error content: classifiable errors read English, unclassifiable ones read Chinese, on the same screen.
  • A literal title in a native open/save dialog. No catalog covers those panels, so a literal there ships one language to every locale. That is how eight of them accumulated.

The gate is a ratchet against the merge base, so this does not ask anyone to fix history: existing hits are grandfathered per (file, rule) and only growth fails.

Refs #2672

Verification

check-locale-hygiene                 passed, no new hits
check-locale-hygiene.test.mjs        7 pass / 0 fail (2 new)
npm run format:check                 clean

Baseline hits the ratchet now grandfathers, counted over SCOPE at this commit:

han-fallback-to-en-helper   1   apps/desktop/src/main/bot-incoming-main.ts:395
native-dialog-literal       4   pet-pack-import.ts, runtime-host-boot.ts (×2),
                                runtime-host-skills-ipc-main.ts

The four dialog literals are removed by #5179; this PR does not depend on it, and lands the rule whichever merges first. The bot-incoming-main.ts hit is real and stays: that whole bot-reply surface is hardcoded Chinese, so fixing it means giving it a catalog and a locale, which is its own change.

Each new rule is tested against a positive case and the shapes it must not flag — an English fallback to the same helper (how logs and CLI output legitimately use it), a catalog lookup in the title position, and a title property outside a dialog call.

Review focus

native-dialog-literal recognizes a dialog call by a properties: [ within 400 characters of the literal, rather than by resolving the callee. Dialog options are the only place that key appears in this shape, and the alternative — an AST pass — would cost the check its install-free property, which is why it runs before npm ci in CI. It will miss a showSaveDialog that passes no properties; filters-only save panels are not covered.

AI use

Select exactly one:

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

Tool(s) and scope: Claude Code — measured the blind spots against the tree, wrote the rules and their tests, and wrote this description. The commit carries a Generated-by: Claude Code trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

@github-actions github-actions Bot added the effort/S Under 100 readable lines label Sep 11, 2026
Locale shortcuts in Runtime Host copy and bot error handling could silently select the wrong language, while multiline native dialogs escaped the source gate. Use typed catalogs and explicit locale-aware rendering, then scan complete source files so these patterns cannot return.

Generated-by: Claude Code
Generated-by: Codex
@orangeCatDeveloper
orangeCatDeveloper force-pushed the fix/locale-hygiene-coverage branch from ce47b7e to a965d52 Compare September 13, 2026 03:00
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