Skip to content

fix(i18n): check every locale module, not the three named ones - #2631

Open
Longado wants to merge 1 commit into
tutti-os:mainfrom
Longado:fix/i18n-manifest-discovery
Open

fix(i18n): check every locale module, not the three named ones#2631
Longado wants to merge 1 commit into
tutti-os:mainfrom
Longado:fix/i18n-manifest-discovery

Conversation

@Longado

@Longado Longado commented Aug 28, 2026

Copy link
Copy Markdown

Summary

check-i18n discovered locale-module manifests through a hardcoded three-name allowlist (tuttiI18nModule, agentGuiI18nModule, browserNodeI18nModule), while docs/conventions/static-analysis.md documents those same three as non-exhaustive examples of a package-specific name ("such as"). Four shipped manifests chose names outside the list and were silently excluded from every i18n check (locale-key parity, placeholder parity, hardcoded-copy scan):

  • richTextI18nModule (packages/ui/rich-text)
  • issueManagerI18nModule (packages/workspace/issue-manager)
  • terminalNodeI18nModule (packages/workspace/terminal)
  • workspaceUserProjectI18nModule (packages/workspace/user-project)

Discovery now matches any export const <name>I18nModule; non-manifest matches are still discarded by parseExportedObjectLiteral returning null.

The remaining changes are what that coverage requires, not separate concerns:

  • All four previously-skipped manifests name their namespace through a sibling constant (namespace: richTextI18nNamespace) rather than a literal, which threw ReferenceError once they were discovered. The manifest VM context now carries the module's top-level double-quoted string constants.
  • Interpolated strings were read as static text, so label: `@${label}` was reported as hardcoded copy and t(`status.${status}`) as a missing key. Copy that is only placeholders plus punctuation is no longer reported, and a key composed at runtime is skipped; prose that survives placeholder removal (Hello ${name}, welcome) still reports.
  • controllerActionTestHarness.ts (imported only by *.test.ts files) gets the same exemption .test.ts carries, via a TestHarness.ts(x) suffix entry.

Coverage grows from 4,317 keys / 2,082 source files to 4,604 / 2,275. No user-visible behavior changes; this is a check-script fix.

Verification

  • node --test tools/scripts/check-i18n.test.mjs — 15/15 pass (13 existing + 2 new)
  • node tools/scripts/check-i18n.mjs — passes on the real tree at the new coverage
  • oxfmt --check clean on both files
  • Behavioral proof: deleting status.running from the terminal module's zh-CN locale passes silently on main and is caught by this branch as locale-key-missing terminalNode.status.running. The new regression test asserts exactly that and fails against the unmodified script.

Checklist

  • This PR does not change agent lifecycle semantics (tooling-script only).
  • I kept the change focused on one concern.
  • Documentation: docs/conventions/static-analysis.md already describes the intended (example-based) behavior; the script now matches it, so no doc change is needed.
  • No README/CONTRIBUTING language-variant changes involved.
  • I ran the lowest meaningful local checks for the changed surface (unit suite + real-tree run + formatter).
  • Commit is signed off with DCO (git commit -s).

`check-i18n` discovered manifests through a three-name allowlist
(`tuttiI18nModule`, `agentGuiI18nModule`, `browserNodeI18nModule`), while
docs/conventions/static-analysis.md documents those same three as examples
("such as") of a package-specific name. Four shipped manifests chose names
outside the list and were therefore never checked at all: richTextI18nModule,
issueManagerI18nModule, terminalNodeI18nModule and
workspaceUserProjectI18nModule.

Discovery now matches any `export const <name>I18nModule`; non-manifest
matches are still dropped by parseExportedObjectLiteral returning null.

The remaining changes are what that coverage requires, not separate concerns:

- All four previously-skipped manifests name their namespace through a
  sibling constant (`namespace: richTextI18nNamespace`) rather than a
  literal, which threw ReferenceError once they were discovered. The
  manifest VM context now carries the module's top-level double-quoted
  string constants.
- Interpolated strings were read as static text, so `label: `@${label}``
  was reported as hardcoded copy and `t(`status.${status}`)` as a missing
  key. Copy that is only placeholders plus punctuation is no longer
  reported, and a key composed at runtime is skipped; prose that survives
  placeholder removal ("Hello ${name}, welcome") still reports.
- controllerActionTestHarness.ts is imported only by *.test.ts, so the
  TestHarness suffix now carries the same exemption .test.ts does.

Coverage goes from 4317 keys / 2082 source files to 4604 / 2275.

Verification: removing `status.running` from the terminal module's zh-CN
locale passes on main and is caught here as
`locale-key-missing terminalNode.status.running`; the new test asserts that
and fails without this change.

Signed-off-by: Eddie Lin <ltalpha51759@gmail.com>
@tutti-pr-review-bot
tutti-pr-review-bot Bot requested a review from a team August 28, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant