Repository navigation
Conversation
i18next derives its suffix from Intl.PluralRules, so a form whose category that rule never returns for a language is copy no reader of that language sees. Thirteen catalogs declare only the `other` category and each carried 94 `_one` forms: 1222 entries that no count could reach. `selectablePluralCategories` in tools/lib/catalogs.mjs answers which categories a tag can render, and admits `zero` because i18next looks that suffix up itself at count 0. `unselectablePluralCategories` walks a catalog's own keys. check-catalogs reports one line per unreachable family and category, and the missing-key rule no longer demands an English plural member the tag cannot select. The thirteen catalogs drop their unreachable forms.
i18next derives its suffix from a plural rule, so a form whose category that rule never returns is copy no reader of that language sees. Twelve catalogs declare only the `other` category and each carried 94 `_one` forms: 1128 entries that no count could reach. The rule must read the plural data the app actually runs. Hermes has no `Intl.PluralRules`, so the FormatJS polyfill data bundled from `@formatjs/intl-pluralrules` decides the suffix, and the host's ICU is not that data: a host on a newer CLDR reads `vi` as `other`-only while the shipped data selects `one` at a count of one. `shippedPluralCategories` reads the app's own loader map and evaluates the data file it names, so Vietnamese keeps its forms. `zero` stays selectable because i18next looks that suffix up itself at count 0. check-catalogs reports one line per unreachable family and category, and the missing-key rule no longer demands an English plural member the tag cannot select. The twelve catalogs drop their unreachable forms.
The rule's truth source is the plural data the app bundles, not the host's ICU, because Hermes has no `Intl.PluralRules` and the two disagree: a host on a newer CLDR reads Vietnamese as `other`-only while the shipped data selects `one` at a count of one. A test that only asserts the reported lines cannot see that difference, so this one links the repository's own loader map and polyfill data and pins a Vietnamese catalog as clean. It fails when the rule falls back to the host's rules.
|
bot: Design gate on the screen that renders two of the changed counted families, run on the emulator against both revisions with the same target manifest.
The four warnings are one The contact sheet shows the four measured cells: default, dark, compact and right-to-left. |
|
bot: The signed-in app on the emulator, on a local backend and a local database, with the UI in a language whose catalog lost its unreachable plural forms. The list row reads the counted open-items message at zero open items. It is one of the families this change touches, and it renders the same text as before the change, because the language never selected the removed form. The same read was repeated for the other touched languages, and Vietnamese still selects its singular form at a count of one, which is why its catalog keeps every form. |
Code Review SummaryStatus: 2 Issues Found | Recommendation: Address before merge Executive SummaryThe emptied-loader-map guard closes the previous silent fallback, but the new Assumptions: Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (3 files)
Fix these issues in Kilo Cloud Previous Review Summaries (3 snapshots, latest commit 603eb26)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 603eb26)Status: 3 Issues Found | Recommendation: Address before merge Executive SummaryThe new rule that judges required plural categories by the runtime resolves the contradiction it targets, but the host intersection also drops categories the shipped data can still select, so a reachable form (Vietnamese Assumptions: Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (3 files)
Fix these issues in Kilo Cloud Previous review (commit a2fd629)Status: 2 Issues Found | Recommendation: Address before merge Executive SummaryThe remaining risk is narrow: reading the app's shipped FormatJS data is now guarded when the file or its loader map is missing, but an empty parsed loader map still silently reverts the audit to the host's CLDR rules. Assumptions: Overview
Issue Details (click to expand)SUGGESTION
Files Reviewed (4 files)
Inline comments: the sandbox rejected the Previous review (commit 1cabb73)Status: 3 Issues Found | Recommendation: Address before merge Executive SummaryThe checker now reads the app's installed FormatJS plural data, but the Assumptions: Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (15 files)
Reviewed by deepseek-v4.1-flash-1017 · Input: 173.9K · Output: 35.3K · Cached: 1.4M Review guidance: REVIEW.md from base branch |
The catalog audit now decides which plural forms a language can select from the plural data the app bundle ships, so the job that runs it needs the app's dependencies. A tree with the app but no installed plural data now fails with the path and the reason instead of quietly auditing against the host's rules, which would call reachable copy dead. The two CI wiring tests pin the job's install line, so they move with it.
Only the category names leave the read, so no vm context outlives it. A loader map the app file no longer declares now fails instead of silently judging the catalogs by the host's rules.
eshurakov
left a comment
There was a problem hiding this comment.
Bot - Light review: no critical issues. Three minor, actionable findings.
-
readPluralDataFileintools/lib/catalogs.mjsthrows a rawENOENTwhenapps/mobile/node_modulesis absent, sonode tools/i18n/check-catalogs.mjsnow crashes on a root-only checkout that previously needed no app dependency.loaderMapOfalready falls back when the tree lacks the app; the data-file read should fail with a message naming the install command, or fall back to the host rules with a printed note. -
checkPluralCategoriesstill asksmissingPluralCategories, which reads the host'snew Intl.PluralRules(tag), while the new rule andcheckKeyParityread the shipped FormatJS data. Today the shipped set is a superset of the host set for all 87 mobile languages, so nothing conflicts, but where a host CLDR requires a category the bundled data cannot select the gate becomes unsatisfiable:checkPluralCategoriesdemands_<category>andcheckUnselectablePluralCategoriesrejects it. PassingselectableCategoriesintocheckPluralCategorieswould keep both rules on one truth source. -
The
i18n-catalogsinstall change did not run on this PR: that job'sif:requiresmobile != 'true', which is false for a mobile catalog change. Only the string assertion inscripts/stacked-ci.test.mjscovers the new command, so it is worth one run that exercises the job (workflow_dispatchor a change that touches only the push catalog) before merge.
Verified at head a2fd6298: no catalog among the 86 non-en mobile locales carries a plural form the shipped formatjs data cannot select; vi keeps its _one forms; no family loses its last selectable member; the 12 changed catalogs drop only _one forms whose copy is identical to their _other sibling.
|
bot: Addressing the three findings from the earlier review of this pull request. WARNING — the catalog job installs nothing the plural read needs. Valid, and fixed. The SUGGESTION — a loader map that fails to parse silently falls back. Valid. A tree with the app but no SUGGESTION — cached category arrays retain one vm context per language. Valid. The sandbox is now local to one read: the categories are copied out and the context is not referenced again. On the assumption that push copy would contradict the new rule: the notification catalog names the runtime's own plural rules as its source rather than the app's bundled data, because that copy renders on a Worker, not in the app. Push copy declares no plural forms today, so the rule is inert there and no catalog hits a contradiction at the current CLDR versions. |
The missing-category rule and the unreachable-form rule both read a locale's plural categories, and reading different sources lets them contradict: a category the host requires but the app's bundled data cannot select would be demanded by one rule and rejected by the other, leaving the audit unsatisfiable. The required list is now the categories both sources agree on, so every category this locale renders is asked for and none it cannot render is. The report on the current catalogs is unchanged.
| for (const [family, absent] of missingPluralCategories(english, translated, tag)) { | ||
| const host = new Intl.PluralRules(tag).resolvedOptions().pluralCategories; | ||
| const shipped = selectableCategories(tag); | ||
| const required = host.filter(category => shipped.has(category)); |
There was a problem hiding this comment.
[SUGGESTION]: The intersection also drops categories the shipped data can select
required is host ∩ selectable, so it keeps only categories the host requires. In the case this PR is built on — a host CLDR that reads vi as other-only while the bundled data still selects one — the reachable one category is no longer required, which contradicts this doc block's claim that the list “asks for every category this locale renders”. checkKeyParity covers an English-declared _one, but a locale-declared family behind a flat {{count}} English key (only counts.items in en.json, with counts.items_one/_other in the locale) has no other demander, so deleting that singular would pass the audit. Consider passing the shipped list itself (shippedPluralCategories(root, tag), which already excludes the synthetic zero) rather than intersecting with the host, and pinning the case with a test since no existing test distinguishes the two lists.
| for (const match of block[1].matchAll(LOADER_MAP_ENTRY)) { | ||
| map.set(match[1] ?? match[2], match[3]); | ||
| } | ||
| loaderMaps.set(root, map); |
There was a problem hiding this comment.
[SUGGESTION]: An empty parsed loader map silently falls back to the host's CLDR for every locale
The guard above throws when the PLURAL_RULES_LOCALE_LOADERS block is missing, but a block that still matches while LOADER_MAP_ENTRY no longer does (a quote or syntax change in the map) yields map.size === 0. Every tag then takes the dataFile === undefined fallback in shippedPluralCategories, which is exactly the silent host-CLDR audit the comment above says this rule exists to prevent. Fail when map.size === 0 as well.
|
bot: Answering the three review remarks at the earlier head. 1. A raw error when the app's dependencies are absent. Already fixed in this branch, and the reply was written before this remark arrived: the read now catches the missing file and fails with the path plus the reason, naming the install. It does not fall back to the host's rules, because a fallback would audit the catalogs against plural data the app does not run, which is the silent wrong answer the rule exists to prevent. Reproduced by moving the data directory out of the tree: the audit stops with that message, and passes again once it is back. 2. The missing-category rule reads the host while the new rule reads the shipped data. Valid, and now fixed. The two rules both decide a locale's categories, so they now share one source: the required list is the intersection of the host's categories and the shipped ones. A locale is asked for every category it can render and never for one it cannot, so no catalog can be both demanded and forbidden. The report on the current catalogs is unchanged ( 3. The catalog job did not run on this pull request. Correct as stated. The job is gated on a catalog-only change, and this branch also changes mobile catalogs, so the mobile path ran and the catalog path did not. That path now differs only in its install line, which installs one more workspace filter, and the two wiring tests pin the exact command. I will dispatch that workflow on this branch before claiming the change verified there. |
|
bot: Correcting my last paragraph, on remark 3 about the catalog job not running here. The The two wiring tests pin that exact command, both suites pass, and the audit's own failure message names the install when the app data is absent. |
A loader block that still matches while no entry in it reads as a data-file loader used to leave the map empty, and every language then fell back to the host's plural rules — the silent wrong audit this rule exists to prevent. It now fails with the module that declares the map. The required-category list stays the intersection of the host's categories and the runtime's own, so no rule can demand a form another rule rejects.
| for (const [family, absent] of missingPluralCategories(english, translated, tag)) { | ||
| const host = new Intl.PluralRules(tag).resolvedOptions().pluralCategories; | ||
| const selectable = selectableCategories(tag); | ||
| const required = host.filter(category => category !== 'zero' && selectable.has(category)); |
There was a problem hiding this comment.
[WARNING]: category !== 'zero' drops a required form in the languages that actually select it
zero is a real plural category for ar, cy and lv: their CLDR rules select it at count 0, and apps/mobile/src/i18n/locales/ar.json, cy.json and lv.json each carry 94 _zero forms for that reason. Because selectablePluralCategories always adds zero, the intersection already required those forms before this line; filtering zero out means deleting _zero from one of those catalogs now passes the audit. The family keeps _other, so missingPluralCategories sees a complete family, while the runtime still selects zero at count 0. The "count-zero override" rationale only applies to languages whose own rules never select zero (ja, ru), which the synthetic entry already covers. Keep zero in required when the shipped data selects it, or pin the ar _zero requirement with a test so it cannot regress.
Narrower, and now documented at lines 2251-2254: a category only the shipped data selects (vi's one on a host whose CLDR reads vi as other-only) is still not demanded for a locale-declared family behind a flat {{count}} English key, so that form can be deleted with no finding, and no test distinguishes the two lists.
Arabic, Welsh and Latvian select the zero category themselves, so a family of one of those still owes its `_zero` form. The required list is the intersection of the host's categories and the runtime's own, and the host list carries `zero` only where the language selects it, so no separate exclusion belongs there.


Evidence
Evidence: demonstrated — the audit rule was run over main's real catalogs (1128 lines reported, 12 locales × 94), and a rendered differential ran on an Android emulator against both revisions through the app's own i18next instance and the plural data the bundle ships: 40104 reads per arm across 4456 families and nine counts, 0 rendered differences and 0 category differences on every touched locale. The signed-in app was then read live: the todos screen renders the counted row in the pruned catalog's language, and Vietnamese still resolves its singular form.
The rule
check-catalogsnow reports a plural form whose category the runtime can never select, where "the runtime" is the plural data the app actually runs. Hermes has noIntl.PluralRules, so the app bundles the FormatJS polyfill data andintl-cache.tsprewarms it on every language change. That data is not the host's ICU, and the two disagree: a host on a newer CLDR reads Vietnamese asother-only, while the shipped data still selects the one-category at a count of one.shippedPluralCategoriesreads the app's own loader map and evaluates the data file it names, so a language whose bundle selects a category keeps its forms.zerostays selectable in every language because i18next looks that suffix up itself at a count of zero, which is why the Portuguese forms the report named stay in place and keep rendering their plural at zero.What changed
tools/lib/catalogs.mjs:shippedPluralCategories,selectablePluralCategories, andunselectablePluralCategoriesbeside the existing plural helpers.tools/i18n/check-catalogs.mjs: the new rule, and a key-parity rule that no longer asks a language for an English plural member it can never select. Each catalog names how its language's categories are decided: the app's shipped data for mobile copy, the runtime's own rules for push copy, which renders on a Worker.tools/i18n/check-catalogs.test.mjs: two cases — a language with only the general category that declares a one-form is reported, and a zero-form is admitted because i18next consults it.The audits print what they printed before:
check-catalogs: 87 languages, every catalog matches en.json.E2E
todos.lists.openCountrenders未完了0件at zero open items, and the same row reads correctly in the other touched languages, with Vietnamese still selecting its singular form at one.Production prerequisites
None.
Verification
The catalog audits, the checker tests and the rendered differential above run in this change's own workflow:
kilo-app-ci.ymlrunscheck:i18nand the two audit test files.Proxy answers
The owner's proxy gave these answers in the owner's place.
<key>_zeroat count 0 for every locale, so pt/pt-BR_zeroforms ARE reachable (portuguese-count-forms.test.ts pins it; executed probe resolves_zeroat count 0). The real dead forms are 1222_oneentries in the 13["other"]-only locales. Which scope?Answer: Drop the 1222 unselectable
_oneforms, keep pt/pt-BR_zeroConfidence: 0.70 · Precedent: Fix the root cause and the class of the issue: session 8dbecc6e9e16 (2026-10-24), "check all languages and so fix the class"; Trust the code over documents: session 269375d6e466 (2026-10-01), "only trust code"
Followed as answered, with one measurement corrected by the second precedent. The answer's decision is what shipped: every unselectable form is gone and the Portuguese
_zeroforms stay. The count is not 1222 but 1128 across 12 languages, because the count in the question came from the host's CLDR and the second precedent says to trust the code: the app runs the bundled FormatJS plural data, and that data selects the one-category for Vietnamese, so Vietnamese keeps all 94 of its forms. Galician likewise keeps its forms. The rule reports exactly the 12 languages whose shipped data cannot select the form.Design gate
Design gate: 4 cells, 0 errors, 4 warnings
The four warnings are the same
inset-asymmetryon the screen header in every cell; the base run reports the identical four, and the comparison run iscomparablewith 0 introduced findings.The screen the run measures renders two of the touched counted families at once: the file-list header's viewed count and the pagination row's loaded-of-total line.