feat(i18n): blocking key-completeness gate — every locale carries every en.json key - #13827
Merged
Merged
Conversation
…ry en.json key `scripts/i18n/check-key-completeness.mjs` (`npm run i18n:check-keys`) compares the leaf key set of each locale catalog with en.json and fails on any absent or extra leaf, whatever the age of the key; `__MISSING__` placeholders count as present. It is the absolute complement of the two existing gates: the coverage gate enforces an 80 % floor per locale (43 absent keys out of ~13,000 still read 99.7 %) and the new-key gate judges only the keys a PR adds to en.json — a locale batch is generated from the en.json of the day its branch is cut and adds no key itself, which is how batch 1 (#13044) landed 43 keys short in nine locales and batch 2 (#13660) 10 keys short in eight. Wired into the i18n-ui-coverage job; documented in QUALITY_GATES.md and the i18n guide (post-merge re-sync, retranslation with pinned names).
Merged
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…ry en.json key (diegosouzapw#13827) New blocking gate `i18n:check-keys` (`scripts/i18n/check-key-completeness.mjs`): every locale catalog must carry exactly the key set of `en.json`, whatever the age of the key. The percentage and new-key gates let batch 1 (diegosouzapw#13044) ship 43 keys short and batch 2 (diegosouzapw#13660) 10 keys short. Wired into the i18n-ui-coverage job; documented in QUALITY_GATES.md and the i18n guide (post-merge re-sync, retranslation with pinned names).⚠️ base-red inherited: diegosouzapw#12732
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
Follow-up of the locale expansion (#13044 / #13660 / #13727 / #13782). Both batch-1 and batch-2 catalogs landed with keys absent — 43 and 10 respectively — and nothing noticed until the home-widget test failed weeks later. The two existing gates cannot see this defect:
check-ui-keys-coverageenforces an 80 % floor per locale: 43 absent keys out of ~13,000 still read 99.7 %.check-new-key-coveragejudges only the keys a PR adds toen.json; a locale batch is generated from theen.jsonof the day its branch is cut and adds no key itself, while the base keeps adding keys during the days it translates.This PR adds the absolute complement.
Changes
scripts/i18n/check-key-completeness.mjs(npm run i18n:check-keys,--warnfor report-only): everysrc/i18n/messages/<locale>.jsonmust carry exactly the leaf key set ofen.json— absent and extra leaves are both reported, per locale, sorted;__MISSING__:placeholders count as present (their content is the ratio gate's business). Exported pure corefindIncompleteLocales({ en, locales })+leafPaths.tests/unit/i18n-key-completeness.test.ts— 5 cases (flattening, identical set, placeholder counts as present, absent leaves, extra leaves + wrong shape)..github/workflows/ci.yml— new step in thei18n-ui-coveragejob, right after the new-key gate.docs/architecture/QUALITY_GATES.md— inventory row + section;docs/guides/I18N.md— new section "Keeping catalogs complete and retranslating English copies" (the four gates side by side, the post-merge re-sync command, the--retranslate-identicalflow and the rule to allowlist test-pinned product/flag names first).Validation
node --import tsx/esm --test tests/unit/i18n-key-completeness.test.tsnpm run i18n:check-keyson the release tipen.json, none extranpm run check:docs-allNo production code touched (
src/,open-sse/,bin/untouched).