test(i18n): fail npm test on a key present in one language only (#453) #468

Open
maximus wants to merge 2 commits from issue-453-i18n-keys-guard into main

2 commits

Author SHA1 Message Date
le king fu
25a1fdea84 docs: name the i18n key guard in REVIEW.md (#453)
All checks were successful
PR Check — Frontend / frontend (pull_request) Successful in 2m9s
The "Faux t" review pitfall said that until #453 no guard caught a key
present in one language only. It now names src/i18n/locales.keys.test.ts
and what the guard does not see: a value left in the other language, and a
key the code calls that neither file declares. The first rule of the "i18n
et documentation" zone names the guard too, as the migration and release
zones name theirs. The "Niveaux" section is untouched
(scripts/review-levels.py --check still passes).

Resolves #453

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 17:16:13 -04:00
le king fu
8a250b98b5 test: guard the key parity of fr.json and en.json (#453)
No test compared the key trees of the two locale files: a key added to one
language only passed the build and the suite, then showed raw to an English
user (missing from en.json) or in English to a French user (missing from
fr.json, English being the fallback).

src/i18n/locales.keys.test.ts imports both files statically, flattens every
node to a dotted path, array indices included (docs.dashboard.features.6),
and fails with the keys missing from each language in a test of its own,
plus a third test for a path held with another kind in each file (an array
against an object, a leaf against an object or an array). Values are never
compared. A canary checks both files were read whole, array items included,
and four tests on small fixtures pin the rules of the comparison.

Run on the base (6e8e157): 1712 leaves on each side, no gap, so no
translation to add.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 17:12:32 -04:00