airi/apps
蓝莓🫐 7e4cdb80a3
Some checks are pending
CI / Type Check (web) (push) Blocked by required conditions
CI / Unit Test (api-server-2) (push) Blocked by required conditions
CI / Detect changes (push) Waiting to run
CI / Lint (push) Blocked by required conditions
CI / Build Test (stage-web) (push) Blocked by required conditions
CI / Build Test (stage-tamagotchi) (push) Blocked by required conditions
CI / Build Test (ui-playgrounds) (push) Blocked by required conditions
CI / Build Test (stage-tamagotchi-godot) (push) Blocked by required conditions
CI / Unit Test (others) (push) Blocked by required conditions
CI / Unit Test (api-server-1) (push) Blocked by required conditions
CI / Unit Test (stage-tamagotchi) (push) Blocked by required conditions
CI / Unit Test (stage-ui-1) (push) Blocked by required conditions
CI / Unit Test (stage-ui-2) (push) Blocked by required conditions
CI / Unit Test (push) Blocked by required conditions
CI / Type Check (others) (push) Blocked by required conditions
CI / Type Check (desktop) (push) Blocked by required conditions
CI / Type Check (push) Blocked by required conditions
CI / Check Provenance (push) Blocked by required conditions
Crowdin upload changed translations / upload-translations-to-crowdin (push) Waiting to run
Cloudflare Pages (Auth UI) / Deploy - ui-server-auth (push) Waiting to run
Cloudflare Workers / Build - docs (push) Waiting to run
Cloudflare Workers / Deploy - stage-web (push) Blocked by required conditions
Plugin Entrypoints / Native ESM (macos-latest) (push) Waiting to run
Plugin Entrypoints / Native ESM (ubuntu-latest) (push) Waiting to run
Plugin Entrypoints / Native ESM (windows-latest) (push) Waiting to run
Release Tamagotchi / Plan Updates (push) Waiting to run
Release Tamagotchi / Build (push) Blocked by required conditions
Release Tamagotchi / Build-1 (push) Blocked by required conditions
Release Tamagotchi / Build-2 (push) Blocked by required conditions
Release Tamagotchi / Build-3 (push) Blocked by required conditions
Release Tamagotchi / Build-4 (push) Blocked by required conditions
Release Tamagotchi / Publish Bundle (push) Blocked by required conditions
Release Tamagotchi / Promote Canary to Stable (push) Blocked by required conditions
Release Tamagotchi / Publish GitCode Release Mirror (push) Blocked by required conditions
Release Tamagotchi / Publish Distribution (push) Blocked by required conditions
Release Tamagotchi / Publish Distribution-1 (push) Blocked by required conditions
Release Tamagotchi / Publish Distribution-2 (push) Blocked by required conditions
Release Tamagotchi / Publish Distribution-3 (push) Blocked by required conditions
E2E Test - Tamagotchi (Linux) / X11 window render (Xvfb) (push) Waiting to run
E2E Test - Tamagotchi (Linux) / Wayland window render (weston headless) (push) Waiting to run
Update Nix pnpmDeps Hash / update (push) Waiting to run
feat(i18n,stage-tamagotchi): find missing keys behind translation helpers (#3636)
## Summary

The MCP settings page of the desktop app showed raw keys, such as
`settings.pages.modules.mcp-server.tools.title`. CI was green, because
x18n cannot follow the helper that builds these keys. This PR closes
that gap in the check and adds the strings that it finds.

- **An x18n plugin.** It finds a key that a helper of the same file
completes (`tn('title')`), a key built from a string constant (``
t(`${KEY}.title`) ``), and a key in a field, an attribute, or a route
field whose name ends with `Key`.
- **The Electron main process.** x18n reads `params.i18n.t('…')`.
- **11 missing keys.** Seven MCP strings move to the file that the page
reads. Three Spotlight calls read their real keys. One Kokoro model gets
its description.
- **A warning on the pull request.** The locale check marks a new
English key that no code uses.
- **An error at runtime.** A key that English lacks is an error in the
console of each app and in the log of the main process. Each window and
the main process report a key once.

## Context

- Request: Find out why the i18n checks did not report the missing keys
of the MCP page, and fix the check, not only the keys.
- Scenario: The MCP page in the settings of the desktop app shows keys
in place of its text.
- Scope: One PR holds the check, the missing keys, the warning on the
pull request, and the error at runtime. Keys that only the runtime knows
stay outside the static check.

## Change map

| Module | Before | After | Description |
| --- | --- | --- | --- |
| `.github/scripts/x18n-translation-keys.ts` (new) | None | An x18n
scanner for `.vue`, `.ts`, and `.tsx` files. It parses scripts and
templates with `vue/compiler-sfc`. | The Vue scanner of x18n 0.1.5 reads
each template expression alone, so a name from the script does not reach
it. The root package gets `vue` from the catalog. |
| `x18n.config.ts` | Used the `vue-i18n` preset. | Adds the plugin and
the callee `params.i18n.t`. | The preset reads `i18n.t` only. |
| `.github/scripts/report-unused-keys.ts` (new) and the i18n locale
check | Checked the content of the locales. | Also prints a warning for
each English key that the PR adds and no code uses. | autofix.ci adds
each new unused key to the baseline, so the Lint job does not show it. |
| Runtime report (`createFallbackOptions`) | The renderers logged a
warning on each render. The main process logged nothing. | The
renderers, Histoire, and the main process report an error, once for each
key. | vue-i18n calls the handler on each render, so one key can fill
the console. |
| `packages/i18n/AGENTS.md` | Told agents to fix the errors of x18n. |
Also tells them to examine each unused key that they add, and to end the
name of a key field with `Key`. | An unused key is a warning, and the
plugin finds a key in a field only by this name. |
| Locale files (English and Simplified Chinese) | The MCP tool strings
were in `tamagotchi/settings.yaml`. | They are in `settings.yaml`, with
their translations. | The page reads
`settings.pages.modules.mcp-server`. |
| Spotlight (desktop) | Read `tamagotchi.spotlight.errors`. | Reads
`tamagotchi.settings.spotlight.errors`. | The strings exist there in
each locale. |

## Architecture and behavior

```mermaid
flowchart LR
  code["Code"] --> builtin["x18n scanners: literal keys"]
  code --> plugin["Plugin: helpers, constants, *Key fields"]
  builtin --> usages["Usages"]
  plugin --> usages
  usages --> missing{"English has the key?"}
  missing -- no --> error["missing-key error, Lint fails"]
  english["English locale"] --> missing
  english --> unused{"A usage reaches the key?"}
  usages --> unused
  unused -- "no, and the PR adds the key" --> warning["Warning on the PR"]
```

Why the old check passed with the missing MCP keys:

1. `tn('tools.title')` completes its key in a helper, so x18n reported
no missing key.
2. The strings were in the wrong file, so x18n reported them as unused.
An unused key is a warning.
3. autofix.ci added these warnings to `.x18n/check-baseline.json` in the
same PR.

## Boundaries and risks

| Invariant or boundary | Failure mode | Protection | Evidence or gap |
| --- | --- | --- | --- |
| A missing key in a supported form fails CI | The plugin stops reading
a form, and the check stays green. | `x18n-translation-keys.test.ts`
covers each form in scripts and templates. | 7 test cases, run by CI. |
| The check reports no key that exists | A false error blocks a PR. |
The plugin reads a `*Key` string only when it starts with a namespace of
the English locale. | On this branch, before the keys were added, x18n
reported 9 errors. Each one was a missing key. |
| The PR warning never fails a check | A heuristic blocks a PR. | The
step prints annotations only. | 4 past commits give 27 warnings. For 3
of them, the code builds the key at runtime. |
| A change of the plugin takes effect locally | x18n keeps old scan
results, because its cache key holds the scanner ids only. | The scanner
id holds a hash of the plugin file. | Read from `scanSignature` in x18n
0.1.5. |
| The moved strings keep their translations | Crowdin loses them. | Only
English and Simplified Chinese have them, and both move. The upload
workflow sends sources and translations. | Read from the workflow. The
run on `main` is not verified yet. |

Forms that the check still cannot read: a key with a runtime value, a
helper from another file, a helper that does not end its key with its
parameter, two helpers of one file with the same name and different
prefixes, and a key in a field with a name that does not end with `Key`.
`packages/i18n/README.md` lists the forms.

## Verification

- `pnpm exec x18n check --no-cache`, with the plugin and without the new
keys: 9 `missing-key` errors (7 helper calls, 1 main process call, 1
`descriptionKey`). With the keys: no errors. 241 of the 666 entries of
the baseline no longer occur. autofix.ci drops them.
- The same configuration on the code of 3aa466f98, which added the MCP
strings: 9 errors, with all 7 MCP keys.
- The commands of the new CI step, run locally: exit code 0, and no
warning on this branch. On 3aa466f98 it reports 23 keys, with the 7 MCP
keys.
- A fixture project: the prefix factory of x18n 0.1.5 reports a missing
key in a script and not in a template. This result is the reason for the
plugin.
- `node .github/scripts/check-locales.ts` against the base: no errors.
It gives one warning, because the translation of "Enabled" equals
another translation.
- `pnpm exec x18n check --no-cache` took 8.8 s before and 13.0 s after,
one local run each.
- A probe of vue-i18n with `createFallbackOptions`: a key that English
lacks gives one report for several `t` calls. A key that only the
current locale lacks gives none.
- `pnpm exec eslint` on the changed files: no errors. ESLint ignores
`.github`.
- CI runs the unit tests and the typecheck. The 7 new test cases had no
local run.
- The MCP page and the log of the main process had no check in the app.

## Agent

- Harness: Claude Code
- Model: claude-opus-5-5

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-11-29 16:36:18 +07:00
..
component-calling refactor(component-calling): validate component props (#3511) 2026-11-16 16:34:25 +09:00
stage-pocket feat(i18n,stage-tamagotchi): find missing keys behind translation helpers (#3636) 2026-11-29 16:36:18 +07:00
stage-tamagotchi feat(i18n,stage-tamagotchi): find missing keys behind translation helpers (#3636) 2026-11-29 16:36:18 +07:00
stage-tamagotchi-kirie feat(i18n,stage-tamagotchi): find missing keys behind translation helpers (#3636) 2026-11-29 16:36:18 +07:00
stage-web feat(i18n,stage-tamagotchi): find missing keys behind translation helpers (#3636) 2026-11-29 16:36:18 +07:00
ui-server-auth feat(i18n,stage-tamagotchi): find missing keys behind translation helpers (#3636) 2026-11-29 16:36:18 +07:00