Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(i18n): hold every candidate key to the shape its consumer renders (#2016)

Maxd14686de11fe
diff --git a/docs/plans/issue-1969-i18n-leaf-shape.md b/docs/plans/issue-1969-i18n-leaf-shape.md
new file mode 100644
index 000000000..345d1f4af
--- /dev/null
+++ b/docs/plans/issue-1969-i18n-leaf-shape.md
@@ -0,0 +1,115 @@
+# i18n leaf and prefix consumption contract
+
+## Intent and boundary
+
+Fix #1969: every candidate that represents displayed copy must have the shape its consumer can render. A name with a valid subtree is not automatically a valid leaf. Preserve explicit key prefixes, array consumers, plural families and supported fallback behavior. This is guard correctness, with no visual/UI changes.
+
+## Evidence
+
+Audited `master@e8a7cb4a94e93b5413a977d70816b01560e3d156`: baseline keyCoverage has 15 passing tests. Independently changing `harness.createDialog.kindTask` (defaultValue-only) and `telegramConfig.proxyUrl` (carrier-only) to nonempty objects in BOTH bundles leaves all 15 tests passing (M21 and M22). The existing branch was clean and contained no implementation; it has now fast-forwarded to the audited master.
+
+## Acceptance invariants
+
+- Candidate keys are leaf copy by default. A small explicit set of intentional prefixes may satisfy the subtree contract; discover the actual set from BOTH literal and finite-template candidates, not historical counts.
+- A readable call carrying `defaultValue` may omit the key entirely, but a present resolved value must satisfy the same consumption-shape requirement as the call without that fallback. Absence, presence, renderability and shape must not be conflated.
+- Explicit prefix permission must not weaken a direct plain-call requirement on that same name. Carrier-only names must reject object or array values unless an existing explicit consumer contract justifies the shape.
+- Existing nonempty list consumers, all applicable plural categories, whitespace/blank rejection, locale parity and non-key residue protections remain meaningful.
+- M21/M22 must fail through the real application guard pipeline after mutation; nonmutated bundles, intentional prefixes and absent-key fallback cases pass. Use the existing synthetic invariant fixtures and negative controls; do not just test a helper disconnected from the consuming assertions.
+- Guard TypeScript is checked directly or via a minimal applicable test project; focused i18n tests, required UI build and lint pass. No new test framework.
+
+## Scope and deliberate residuals
+
+Allowed: `ui/src/i18n/keyCoverage.test.ts` and this plan. A small colocated helper/test or narrowly scoped typecheck config may be justified to the orchestrator before editing. No `TranslationKey` rollout (#1967), orphan-leaf pin (#1968), copying text into bundles, component rewrites, package/lockfile updates or new framework. The sibling IPv6 lane owns Python/auth setup files; do not touch them.
+
+## Design decision
+
+Prefer the proposed leaf-by-default plus small explicit prefix contract, after measuring current candidate shapes. Reuse existing `consumable`/resolution ownership and simplify misleading comments when semantics change. Keep the exception set about intentional prefixes, not an enumeration of carrier prop names. Stop and report the whole class if this requires materially expanding the scanner model.
+
+## Implementation
+
+The root cause was one predicate answering two questions. `isRenderable` asked "is there copy UNDER this name", which is the prefix question, and PARITY, RESIDUE and the opaque-options branch of EXISTENCE all fell back to it. A leaf someone replaced with an object answers that question yes.
+
+The container a value must arrive in is now a property of the NAME, with three answers and one shape table (`ARRIVES` / `arrivesIn`) shared by all three properties, so a shape closed in one is closed in all:
+
+- `copy` — the default. A plain `t()`, a carrier prop, an `i18nKey`.
+- `list` — READ off the app: a call site passing `returnObjects`. No prop names or positions enumerated, so a second list consumer is covered the day it is written.
+- `subtree` — the enumerated exception, `KEY_PREFIXES`, reached by nothing else.
+
+`isRenderable` is renamed `hasCopyUnder` and is now reachable only through the `subtree` container. The opaque-options (`any`) demand asks for `copy` or `list` — the weakest honest demand, since whatever options that call hides, i18next returns a string it renders or a list it maps, never a node. `consumable` is re-expressed through the same table and keeps its behaviour.
+
+The prefix permission is structurally one-way: `containersFor` is consulted only by PARITY and RESIDUE, never by EXISTENCE, which reads the call. A fixture asserts a plain `t()` on a pinned prefix still fails, and an app-level test asserts both directions on the real bundles — every pinned name is still a node with copy under it, and no pinned name is named by any call site at all.
+
+### Correction: presence is not container fit
+
+The first reviewed head asserted that one-way rule and did not hold it. Two escapes, found independently by the PM and by Codex on the same head, were one root cause: EXISTENCE partitioned its work with `residueOf`, so "this value does not fit the container I chose" was read as "the bundles never had this name".
+
+- A plain `t()` on a key the app also reads with `returnObjects` was skipped, because the array looked unresolved under `AS_COPY` while the name side allowed it. A name-level classification was cancelling a per-call demand — the thing the one-way rule promises cannot happen.
+- Every `demand === 'none'` reference was filtered out of EXISTENCE outright. That is sound only where the key is missing; where it is present i18next never reaches the fallback, so `t('harness.runStatus', { defaultValue })` rendered a node's diagnostic in silence.
+
+The correction is one concept, not two patches: **EXISTENCE partitions on PRESENCE, which is container-free.** `containersFor` is now unreachable from EXISTENCE, so the one-way claim holds structurally rather than by inspection, and a key present in any form reaches the per-call check for every call that names it. Codex proposed passing `appContainers` into that `residueOf` call instead; that repairs the symptom while leaving the name-level allowance inside EXISTENCE, so it was not taken.
+
+Presence is asked of the resolver, per selected form:
+
+- `instance.exists()` answers it, and nothing else can. A bundle may store the key AS its value — `card.echo: 'card.echo'` is present and invalid, `card.absent` is absent and legitimately covered by a fallback — and `t()` hands back the same string for both. The earlier ruling against `exists()` was against it as a VALIDITY predicate, which it still is not; `rendersAsCopy` and `consumable` keep that job.
+- Per form, not per call: with only `card_one` present, `{ count: 1 }` exists and `{ count: 2 }` does not. A defaulted call reaching the second renders its own fallback and is owed nothing; reaching the first it is owed the same shape as a call carrying no default. So `defaultValue` buys exactly one thing, absence, and buys it one category at a time.
+
+## Measured prefix census
+
+Measured on `e8a7cb4a9` through the guard's own candidate pool (dotted literals plus finite-template expansions), not from historical counts:
+
+| Measure | Value |
+| --- | --- |
+| Candidate names | 3454 (3198 literal, 256 template-only) |
+| Resolving to an object node | 2 — `harness.runStatus`, `harness.statusFilter` (both literal, neither template-only) |
+| Resolving to an array | 2 — `memory.settings.disclosure`, `memory.settings.cloudDisclosure`, both already `returnObjects`-modelled |
+| Call-site demands | 3124 plain-exact, 19 opaque (`any`), 7 `defaultValue` (`none`) |
+
+The issue's census named a third prefix, `workbench.modules.agents`. It is no longer one: `CapabilityTabs` names `workbench.modules.agents.title`, a leaf, and the bare prefix survives only in a `WorkbenchModulePlaceholder` doc comment, which the collector does not read. No template-only candidate is a prefix, closing that "unmeasured" item from the issue. None of the 7 `defaultValue` keys and none of the 19 opaque keys resolves to an object today, so tightening those paths changes no passing result on this head.
+
+## Mutation evidence
+
+Each probe mutates the real bundles, runs the real suite, and restores the bundles between runs. Unmutated: 19/19 pass.
+
+| Probe | Mutation | Result |
+| --- | --- | --- |
+| M21 | `harness.createDialog.kindTask` → nonempty object in both bundles | FAILS — residue pin, key named in the diff (was: 15/15 pass) |
+| M22 | `telegramConfig.proxyUrl` → nonempty object in both bundles | FAILS — residue pin, key named in the diff (was: 15/15 pass) |
+| C1 | `telegramConfig.proxyUrl` → object in `zh` only | FAILS — parity, not residue |
+| C2 | `harness.createDialog.kindTask` deleted from both bundles | FAILS — residue pin only; EXISTENCE stays silent, so the `defaultValue` call still demands no copy |
+| C3 | `harness.runStatus` subtree deleted from `zh` | FAILS — prefix pin and parity; the exemption does not excuse a lost subtree |
+
+C2 is the invariant that absence and a broken present value stay different facts: an omitted defaulted key is still classified by hand in the residue pin, exactly as before this change, while a present object value is now rejected.
+
+After the presence correction all five behave as above, with M21 additionally failing EXISTENCE — its call carries a `defaultValue` and its key is present, so the call is now asked for the shape it renders. The escapes of the review round were reproduced the same way, by adding a real consuming component to `src/` and running the real guard:
+
+| Probe | Reproduction | Before | After |
+| --- | --- | --- | --- |
+| E1 | a component rendering `t('memory.settings.disclosure')`, the key's array and its `returnObjects` consumer untouched | passes | FAILS EXISTENCE in both locales, naming the key |
+| E2 | a component rendering `t('harness.runStatus', { defaultValue: 'Status' })` | passes | FAILS EXISTENCE in both locales AND the prefix pin |
+| E3 | a counted `returnObjects` consumer of a key whose `_one` is a valid array and whose `_other` is empty | passes | FAILS EXISTENCE, naming `probe.rows (count, returnObjects)` |
+
+E3 is Codex's witness for the same class: the name side resolves through `resolvesIn`'s `some` probe, and only the per-call check asks every reachable category. None of the three probe files or bundle edits is committed; the positive controls are the unmutated suite, which still passes with the real `returnObjects` consumer and the real defaulted call sites in place. The focused controls added for this round fail against the pre-correction `missingCopy`, which is how they are known to be load-bearing rather than merely green.
+
+## Review ledger
+
+One findings-bearing head so far, one root-cause class, so the circuit breaker does not trip.
+
+| Head | Source | Findings | Class |
+| --- | --- | --- | --- |
+| `650db4d4e` | Codex review 5232356759, threads `…jPy2D` / `…jPy2H` | 2 | container classification suppressing a per-call requirement |
+| `650db4d4e` | PM negative controls, executed against the real guard | 2 | the same class, independently found |
+
+The PM's two controls and the bot's two threads describe the same defect from different ends, so they are one class on one head rather than two findings-bearing heads. The #1963 history that preceded this issue is recorded separately and is not counted against this rewrite.
+
+## Validation
+
+- `vitest run src/i18n/keyCoverage.test.ts` — 20 passed (15 pre-existing, 5 added), 3.8s; the pinned `ts.Program` cost is unchanged.
+- `vitest run` (whole UI suite) — 301 files, 4114 tests passed.
+- `tsc --noEmit` on the guard directly under the app's strict options, including `noUnusedLocals` — clean. No new tsconfig was added: a second typecheck project for one file is a concept this change does not need.
+- `npm run lint` — baseline check passed, no drift. `npm run build` — succeeded.
+
+## Residual limitations
+
+Unchanged by this PR and stated rather than rounded away: genuinely dynamic template sites remain invisible; bundle leaves reached by no name in `src/` remain unpinned (#1968); a consumer's own TypeScript assertion on a `t()` result is not read (#1967). The prefix pin is a hand-maintained list of 2, which is the cost of a prefix being exactly a name no call site names — an unclassified new prefix fails loudly at the residue pin rather than passing quietly.
+
+No count is claimed for the first two. The figures quoted while #1963 was open were measured on a different head, and the orphan one is not comparable to a name census taken over bundle paths: terminal arrays, plural suffix paths and source-use coverage are three different denominators, and mixing them produces a number that describes nothing. Remeasuring either population belongs to the issue that owns it.
diff --git a/ui/src/i18n/keyCoverage.test.ts b/ui/src/i18n/keyCoverage.test.ts
index 9a8f995d1..2ca425dda 100644
--- a/ui/src/i18n/keyCoverage.test.ts
+++ b/ui/src/i18n/keyCoverage.test.ts
@@ -168,26 +168,48 @@
// value that renders as nothing is empty of copy whichever character made it so.
// Nothing else is copy; nobody renders a subtree.
//
-// What differs is the CONTAINER it has to arrive in, and that is decided by who
-// is asking — which is the distinction three review rounds were spent finding:
+// What differs is the CONTAINER it has to arrive in, and that is a property of
+// the NAME — not of the property doing the asking, which is the reading that had
+// to be corrected and is what #1969 was opened for. There are three:
//
-// A CALL SITE consumes an exact shape. A plain call renders the value, so the
-// value must be copy. A `returnObjects` call renders each entry, so the value
-// must be a nonempty list of copy. An object passes neither: i18next hands a
-// plain call its diagnostic instead of a string, and `MemorySettingsPanel`
-// hands React an object child. `consumable` is total over the shapes i18next
-// can return, under both call shapes, and the fixture states that table.
+// COPY, the DEFAULT. Something renders this name's value directly: a plain
+// `t()`, a `labelKey` a component hands to `t()` later, an `i18nKey` on a
+// `<Trans>`. An object passes none of them — i18next hands a plain call its
+// diagnostic instead of a string — and neither does a list.
//
-// A BARE LITERAL has no call site to read, and it may be a key PREFIX rather
-// than a key: `harness.runStatus` resolves to an object node that
-// `HarnessPage` completes at runtime. So PARITY and RESIDUE ask the subtree
-// question — `isRenderable`, is there copy under this name, nothing empty
-// under it — because dropping that whole subtree from one locale is a real
-// gap, and calling the prefix a non-key would hide it.
+// LIST, where a call site reads `returnObjects` and maps what comes back;
+// `MemorySettingsPanel` does, over the two keys in `src/` that answer this
+// way. A nonempty list of copy, because a locale that keeps the array and
+// empties an entry renders a blank row rather than a raw key.
//
-// One leaf, two containers, each owned by the property that can know it. Reusing
-// the subtree reading at a call site is what let an object value pass as copy;
-// using the call reading on a prefix would drop two real keys into RESIDUE.
+// SUBTREE, where the name is not a key at all but a PREFIX its component
+// completes at runtime: `HarnessPage` writes `harness.runStatus` and asks for
+// `harness.runStatus.queued`. Nobody renders the node itself, so the question
+// is whether copy lives UNDER it — and dropping that whole subtree from one
+// locale is a real gap, so the name is still watched rather than excused.
+//
+// The first two are READ off the app: `returnObjects` at a call site says LIST,
+// and every other way a name is written says COPY. The third cannot be read,
+// because a prefix is precisely a name no call site names — that is why it reads
+// like a leaf — so it is ENUMERATED in `KEY_PREFIXES` below, inverted exactly
+// like the residue pin: two names today, measured on this head rather than
+// carried over as a count, and a third has to be classified before it passes.
+//
+// Leaf BY DEFAULT is the whole of the correction. Asking the subtree question by
+// default is what let two escapes through a green suite: a name whose only call
+// carries a `defaultValue` (`harness.createDialog.kindTask`) and a name no call
+// site names at all (`telegramConfig.proxyUrl` via `labelKey`) both fell back to
+// it, so turning either into an object in BOTH locales passed while the surface
+// rendered i18next's diagnostic. A name with copy UNDER it is not thereby a name
+// that IS copy; the two escapes were that one sentence read backwards.
+//
+// So the subtree reading is the exception and owns exactly the enumerated names.
+// A `defaultValue` still narrows what EXISTENCE asks — that call cannot show a
+// raw key — and it narrows nothing about the value that IS there: absence and a
+// broken present value are different facts, and conflating them was the first
+// escape. The permission runs one way for the same reason: a pinned prefix
+// cannot excuse a copy-demanding call on that same name, because EXISTENCE
+// reads the call and never consults the pin.
//
// That whole claim is about copy being THERE. Whether the copy is RIGHT —
// accurate, idiomatic, actually translated rather than English pasted into
@@ -657,19 +679,61 @@ const probes = (lng: string, reference: Reference): Record<string, unknown>[] =>
const rendersAsCopy = (value: unknown, key: string): boolean =>
typeof value === 'string' && value.trim() !== '' && value !== key;
-const isRenderable = (value: unknown, key: string): boolean => {
+/**
+ * Whether copy lives UNDER a name — the SUBTREE question, and the only one that
+ * says yes to a node nothing renders.
+ *
+ * This is what a key PREFIX needs and what nothing else may have. It was the
+ * file's default reading once, and defaulting to it is the bug in #1969: it
+ * answers "is there copy beneath this name", which is true of every prefix and
+ * also true of a leaf someone replaced with an object, and the second case is a
+ * surface rendering i18next's diagnostic. So it is reached only through the
+ * `subtree` container below, which only an enumerated name is given.
+ */
+const hasCopyUnder = (value: unknown, key: string): boolean => {
if (typeof value === 'string') return rendersAsCopy(value, key);
- if (Array.isArray(value)) return value.length > 0 && value.every((entry) => isRenderable(entry, key));
+ if (Array.isArray(value)) return value.length > 0 && value.every((entry) => hasCopyUnder(entry, key));
if (typeof value === 'object' && value !== null) {
const entries = Object.values(value);
- return entries.length > 0 && entries.every((entry) => isRenderable(entry, key));
+ return entries.length > 0 && entries.every((entry) => hasCopyUnder(entry, key));
}
return false;
};
/**
- * Whether a locale resolves a literal — meaning it renders copy for it, bare or
- * against any plural category the locale selects.
+ * The container a name's value has to arrive in, and the whole table of them.
+ *
+ * One table, so the three properties cannot disagree about what a shape means:
+ * EXISTENCE asks it about the container a CALL consumes, PARITY and RESIDUE ask
+ * it about the container a NAME is written for, and a shape closed in one is
+ * closed in all three. That is the invariant the two escapes broke — they were
+ * asked a weaker question than the call sites beside them.
+ *
+ * A LIST has to be nonempty and copy in every slot for the reason a `returnObjects`
+ * consumer maps it: a blank row is missing copy, not a row that happens to be short.
+ */
+type Container = 'copy' | 'list' | 'subtree';
+
+const ARRIVES: Record<Container, (value: unknown, key: string) => boolean> = {
+ copy: rendersAsCopy,
+ list: (value, key) =>
+ Array.isArray(value) && value.length > 0 && value.every((entry) => rendersAsCopy(entry, key)),
+ subtree: hasCopyUnder,
+};
+
+/** Whether a value arrives in ANY container the asker can render it out of. */
+const arrivesIn = (value: unknown, key: string, containers: readonly Container[]): boolean =>
+ containers.some((container) => ARRIVES[container](value, key));
+
+/**
+ * Whether a locale resolves a literal INTO a container the asker renders it out
+ * of — meaning it renders copy for it, bare or against any plural category the
+ * locale selects.
+ *
+ * The container is handed in rather than assumed, because "resolves" was the
+ * word doing the conflating: it used to mean the subtree reading everywhere it
+ * was called, which is the right question for a prefix and too weak for every
+ * other name.
*
* Renders, not merely exists. `instance.exists()` was the earlier answer and it
* is presence only, which cost two review rounds of the same root cause: an
@@ -680,17 +744,84 @@ const isRenderable = (value: unknown, key: string): boolean => {
* and "resolves" means one thing file-wide: EXISTENCE, PARITY and RESIDUE all
* inherit it, and no value-shaped hole can be open in one and closed in another.
*
+ * What that ruling settled is VALIDITY, and presence is a different fact that
+ * still has to be asked somewhere — see `presentFor` below, the one place it is.
+ *
* The plural half matters: a family with no plain key (`usageSummary_one` and
* `_other`, no `usageSummary`) renders nothing bare, so asking only that way
* would drop every family out of PARITY and miss the locale that kept the family
* while the other lost it.
*/
-const resolvesIn = (instance: I18n, lng: string, key: string): boolean =>
- isRenderable(instance.t(key, { returnObjects: true }), key) ||
+const resolvesIn = (
+ instance: I18n,
+ lng: string,
+ key: string,
+ containers: readonly Container[],
+): boolean =>
+ arrivesIn(instance.t(key, { returnObjects: true }), key, containers) ||
representativeCounts(lng).some((count) =>
- isRenderable(instance.t(key, { count, returnObjects: true }), key),
+ arrivesIn(instance.t(key, { count, returnObjects: true }), key, containers),
);
+/**
+ * Whether the bundle HAS an entry for this name under these options — presence,
+ * which is the other fact, and the only question `exists()` is asked here.
+ *
+ * Presence and validity are not the same question and one predicate cannot be
+ * both. `resolvesIn` above says whether copy comes back; this says whether
+ * anything is there at all. Answering the second with the first is the #1969
+ * conflation one level up, and it is what let two calls through: a name whose
+ * value does not fit the container someone picked looked ABSENT, so every call
+ * to it was excused as "the bundles never had this".
+ *
+ * So no approximation is invented for it. `value !== key` looks like presence
+ * and is not: a bundle may store the key AS its value, and the real resolver
+ * separates the two — `card.echo: 'card.echo'` is present (invalid copy someone
+ * must fix), `card.absent` is absent (a fallback may legitimately cover it),
+ * and both hand `t()` back the same string. Only `exists()` tells them apart.
+ *
+ * The options are handed in rather than dropped, because presence is per
+ * SELECTED FORM: with only `card_one` present, `{ count: 1 }` exists and
+ * `{ count: 2 }` does not. A defaulted call reaching the second renders its own
+ * fallback and is owed nothing, which is legitimate and must not be failed
+ * merely because a sibling category is there.
+ */
+const presentFor = (instance: I18n, key: string, options: Record<string, unknown>): boolean =>
+ instance.exists(key, { ...options, returnObjects: true });
+
+/**
+ * The names that are key PREFIXES rather than keys, pinned by hand.
+ *
+ * A prefix is a name whose component completes it at runtime, so it resolves to
+ * an object node and nothing renders it directly. That cannot be READ off the
+ * app — the completion is `` t(`${prefix}.${status}`) ``, a template over a value
+ * no type narrows — which is why this is a list and every other container is a
+ * measurement.
+ *
+ * Inverted like the residue pin below, and for the identical reason: an
+ * unclassified prefix must not sit here quietly. A name that turns into an
+ * object without being classified resolves in no container, so it falls to
+ * RESIDUE and the pin above fails; adding a line here is a deliberate claim that
+ * the name is a namespace and not copy someone broke.
+ *
+ * The permission is one-way. It relaxes what PARITY and RESIDUE ask of a NAME;
+ * it never reaches EXISTENCE, which reads the call site and asks the exact
+ * container that call consumes. So pinning a name here cannot excuse a plain
+ * `t()` on it — the test below states that, and no name in `src/` is both.
+ *
+ * Measured on this head: 3454 candidate names, 2 of them object nodes. The
+ * earlier census counted three, and `workbench.modules.agents` is no longer one
+ * — `CapabilityTabs` names `workbench.modules.agents.title`, a leaf, and the
+ * bare prefix survives only in a doc comment, which the collector does not read.
+ */
+const KEY_PREFIXES = [
+ // `HarnessPage` picks one of these into `statusLabelPrefix` and completes it
+ // with a chip's option, which is typed `readonly string[]` — so the template
+ // expands to nothing and only `${prefix}.${status}` is ever rendered.
+ 'harness.runStatus',
+ 'harness.statusFilter',
+];
+
/**
* Every dotted literal in `src/` that resolves in NEITHER locale, pinned exactly.
*
@@ -829,14 +960,46 @@ const appCandidateKeys = (referenced: Reference[]): string[] =>
[...new Set([...appDottedLiterals(), ...referenced.map((reference) => reference.key)])]
.sort((a, b) => a.localeCompare(b));
+/**
+ * The container a NAME has to arrive in — the contract PARITY and RESIDUE hold
+ * it to, as opposed to the one EXISTENCE reads off a single call.
+ *
+ * Leaf by default, which is the correction. A name is copy unless the app can be
+ * SEEN to consume it another way (`returnObjects` at some call site) or it is a
+ * pinned prefix. So a key named only through a carrier prop, and a key named
+ * only by a call carrying its own `defaultValue`, are both held to the shape
+ * their consumer renders — which is what neither was before.
+ *
+ * `listed` is read off the same collector every other fact here comes from, so
+ * this enumerates no positions and no prop names: a second `returnObjects`
+ * consumer is covered the day it is written.
+ *
+ * One name, one answer — and that is sound only because this side is not the
+ * only side. A name with both a `returnObjects` consumer and a plain one gets
+ * `list` here, so the array it holds is a key the bundles have rather than a
+ * gap; the plain call that cannot render that array is still failed, by
+ * EXISTENCE, which reads each call rather than this table. Neither reading can
+ * stand in for the other, and the permission runs one way only: PARITY and
+ * RESIDUE consult this, EXISTENCE never does.
+ */
+export type Containers = (key: string) => readonly Container[];
+
+const AS_COPY: Containers = () => ['copy'];
+
+const containersFor = (referenced: Reference[]): Containers => {
+ const listed = new Set(referenced.filter((reference) => reference.listed).map((reference) => reference.key));
+ return (key) => (KEY_PREFIXES.includes(key) ? ['subtree'] : listed.has(key) ? ['list'] : ['copy']);
+};
+
/** The literals no locale resolves, sorted for comparison against the pin. */
export const residueOf = (
literals: string[],
bundles: { lng: string; bundle: unknown }[],
+ containers: Containers = AS_COPY,
): string[] => {
const locales = bundles.map(({ lng, bundle }) => ({ lng, instance: localeInstance(lng, bundle) }));
return literals
- .filter((key) => !locales.some(({ lng, instance }) => resolvesIn(instance, lng, key)))
+ .filter((key) => !locales.some(({ lng, instance }) => resolvesIn(instance, lng, key, containers(key))))
.sort((a, b) => a.localeCompare(b));
};
@@ -853,10 +1016,13 @@ type ParityGap = { key: string; present: string[]; absent: string[] };
export const parityGaps = (
literals: string[],
bundles: { lng: string; bundle: unknown }[],
+ containers: Containers = AS_COPY,
): ParityGap[] => {
const locales = bundles.map(({ lng, bundle }) => ({ lng, instance: localeInstance(lng, bundle) }));
return literals.flatMap((key) => {
- const present = locales.filter(({ lng, instance }) => resolvesIn(instance, lng, key)).map(({ lng }) => lng);
+ const present = locales
+ .filter(({ lng, instance }) => resolvesIn(instance, lng, key, containers(key)))
+ .map(({ lng }) => lng);
if (present.length === 0 || present.length === locales.length) return [];
return [{ key, present, absent: locales.map(({ lng }) => lng).filter((lng) => !present.includes(lng)) }];
});
@@ -876,29 +1042,35 @@ export const parityGaps = (
* That shape is read off the call, exactly as `count` is, so a second site
* asking for a list is covered without naming its keys here.
*
- * The subtree reading (`isRenderable`) is deliberately NOT used here. It answers
- * a different question — does this NAME have copy under it — which is the right
- * question for a bare literal that may be a key prefix, and the wrong one for a
- * call site, because no consumer renders a subtree.
+ * The subtree reading (`hasCopyUnder`) is deliberately NOT reachable here. It
+ * answers a different question — does this NAME have copy under it — which is
+ * the right question for a pinned prefix and the wrong one anywhere a value is
+ * rendered, because no consumer renders a subtree.
*/
const consumable = (value: unknown, reference: Reference): boolean =>
- reference.listed
- ? Array.isArray(value)
- && value.length > 0
- && value.every((entry) => rendersAsCopy(entry, reference.key))
- : rendersAsCopy(value, reference.key);
+ arrivesIn(value, reference.key, [reference.listed ? 'list' : 'copy']);
/**
* What a locale owes a call site, which is exactly what the call demands.
*
* An `exact` call names its own shape, so every option set it can reach has to
* come back consumable. An `any` call names none of it: the options could hide
- * a `count`, a `returnObjects`, or a `defaultValue`, and picking one shape
- * would be inventing a fact. So it is asked the same question a bare literal is
- * asked — does this name have copy under it — the weakest demand that still
- * fails when copy is deleted, and one this file already has a predicate for
- * rather than a third notion. A `none` call renders its own fallback and is
- * filtered out before this, since there is no copy it can fail to find.
+ * a `count`, a `returnObjects`, or a `defaultValue`, and picking one shape would
+ * be inventing a fact. So it is asked for EITHER container a call can consume —
+ * the weakest honest demand, and still not the subtree one, because whichever
+ * options that call passes, i18next hands it a string it renders or a list it
+ * maps and never a node anything renders. Reading the subtree question here was
+ * the same conflation #1969 names, one call shape over.
+ *
+ * A `none` call is asked the same question wherever its key is THERE. Carrying
+ * a `defaultValue` buys exactly one thing — the key may be missing — and buys it
+ * per selected form, since that is how i18next spends it. Where the form is
+ * absent the fallback renders and nothing is owed; where it is present the
+ * fallback is never reached, i18next hands back the stored value, and that value
+ * faces the same container and the same plural probes as a call carrying none.
+ * Excusing the whole call was the second escape of this round: a defaulted call
+ * on a pinned prefix rendered a node's diagnostic while the guard stayed silent,
+ * and the prefix pin could not catch it because a prefix pin is name-side.
*
* The residual is stated rather than hidden: an opaque options object that
* hides a `defaultValue` would be asked for copy the call does not need. That
@@ -907,13 +1079,16 @@ const consumable = (value: unknown, reference: Reference): boolean =>
*/
const missingCopy = (instance: I18n, lng: string, reference: Reference): boolean =>
(reference.demand === 'any'
- ? !resolvesIn(instance, lng, reference.key)
- : probes(lng, reference).some(
- (options) => !consumable(instance.t(reference.key, { ...options, returnObjects: true }), reference),
+ ? !resolvesIn(instance, lng, reference.key, ['copy', 'list'])
+ : probes(lng, reference).some((options) =>
+ (presentFor(instance, reference.key, options)
+ ? !consumable(instance.t(reference.key, { ...options, returnObjects: true }), reference)
+ : reference.demand !== 'none'),
));
describe('app i18n key coverage', () => {
const referenced = referencedCallSites();
+ const appContainers = containersFor(referenced);
it('collects the literal keys and how they are called, and only those, from a source file', () => {
// The forward guard on the collector itself: a coverage test whose collector
@@ -1101,41 +1276,234 @@ describe('app i18n key coverage', () => {
expect(referenced).toContainEqual({ key: 'settings.models.backends.claude', counted: false, listed: false, demand: 'none' });
});
- // A key NO locale resolves is not an existence gap: nothing here can tell it
- // apart from a name the bundles never had, which is RESIDUE's question and
- // where it gets classified by hand. So the properties partition rather than
- // overlap, and a key deleted from BOTH locales still fails — as an
- // unclassified newcomer in the pin, naming itself just as loudly.
- const unresolvedEverywhere = new Set(residueOf(referenced.map((reference) => reference.key), BUNDLES));
+ // A name the bundles never had is not an existence gap: nothing here can tell
+ // it apart from a key someone deleted, which is RESIDUE's question and where
+ // it gets classified by hand. So the properties partition rather than overlap,
+ // and a key deleted from BOTH locales still fails — as an unclassified
+ // newcomer in the pin, naming itself just as loudly.
+ //
+ // The partition is on PRESENCE, which is the whole of this round's correction.
+ // Asking `residueOf` instead asked "does the value fit the container I chose",
+ // and every answer of no was read as "the bundles never had this": an array
+ // key looked absent under `AS_COPY`, so a plain `t()` that renders `[object
+ // Object]` on it was skipped here, and the name side let the array through.
+ // That is a name-level classification cancelling a per-call demand — the exact
+ // thing the one-way rule promises cannot happen. It cannot now: presence is
+ // container-free, so `containersFor` is unreachable from this property, and a
+ // key present in ANY form reaches the per-call check for EVERY call to it.
+ const absentEverywhere = (() => {
+ const probesByLocale = BUNDLES.map(({ lng, bundle }) => ({
+ instance: localeInstance(lng, bundle),
+ options: [{}, ...representativeCounts(lng).map((count) => ({ count }))],
+ }));
+ return new Set(
+ referenced
+ .map((reference) => reference.key)
+ .filter((key) =>
+ probesByLocale.every(({ instance, options }) =>
+ options.every((probe) => !presentFor(instance, key, probe)),
+ ),
+ ),
+ );
+ })();
it.each(BUNDLES)('translates every referenced call site in $lng', ({ lng, bundle }) => {
const instance = localeInstance(lng, bundle);
expect(
referenced
- .filter((reference) => reference.demand !== 'none')
- .filter((reference) => !unresolvedEverywhere.has(reference.key))
+ .filter((reference) => !absentEverywhere.has(reference.key))
.filter((reference) => missingCopy(instance, lng, reference))
.map(label),
).toEqual([]);
});
it('reports a NAME as having copy under it when any leaf under it renders', () => {
- // The subtree question, which is what PARITY and RESIDUE ask. A dotted literal
- // is not always a leaf: `harness.runStatus` is a PREFIX that `HarnessPage`
- // completes at runtime, and it resolves to an object node. Dropping that whole
- // subtree from one locale is a real gap, so the object branch is load-bearing
- // here — and wrong at a call site, which is the next test.
- expect(isRenderable('Disclosure', 'k')).toBe(true);
- expect(isRenderable('', 'k')).toBe(false);
- expect(isRenderable(' ', 'k')).toBe(false);
- expect(isRenderable('k', 'k')).toBe(false); // i18next echoes the key when it has none
- expect(isRenderable(['one', 'two'], 'k')).toBe(true);
- expect(isRenderable([], 'k')).toBe(false); // the disclosure list, emptied
- expect(isRenderable(['one', ''], 'k')).toBe(false); // a blank row is missing copy too
- expect(isRenderable({ a: 'one' }, 'k')).toBe(true); // a prefix: copy lives under it
- expect(isRenderable({}, 'k')).toBe(false);
- expect(isRenderable(undefined, 'k')).toBe(false);
- expect(isRenderable(42, 'k')).toBe(false);
+ // The subtree question, which now belongs to a PINNED PREFIX and to nothing
+ // else. `harness.runStatus` is one: `HarnessPage` completes it at runtime, so
+ // it resolves to an object node, and dropping that whole subtree from one
+ // locale is a real gap — which is why the object branch is load-bearing here.
+ // Defaulting to it is the #1969 escape, and the two tests after this one hold
+ // the default and the call site to the container each actually renders.
+ expect(hasCopyUnder('Disclosure', 'k')).toBe(true);
+ expect(hasCopyUnder('', 'k')).toBe(false);
+ expect(hasCopyUnder(' ', 'k')).toBe(false);
+ expect(hasCopyUnder('k', 'k')).toBe(false); // i18next echoes the key when it has none
+ expect(hasCopyUnder(['one', 'two'], 'k')).toBe(true);
+ expect(hasCopyUnder([], 'k')).toBe(false); // the disclosure list, emptied
+ expect(hasCopyUnder(['one', ''], 'k')).toBe(false); // a blank row is missing copy too
+ expect(hasCopyUnder({ a: 'one' }, 'k')).toBe(true); // a prefix: copy lives under it
+ expect(hasCopyUnder({}, 'k')).toBe(false);
+ expect(hasCopyUnder(undefined, 'k')).toBe(false);
+ expect(hasCopyUnder(42, 'k')).toBe(false);
+ });
+
+ it('decides a NAME by the container its consumers render, leaf unless told otherwise', () => {
+ // The other half of the same table, asked of a NAME rather than of a call —
+ // and the half #1969 was opened for. Stated as the total table again: every
+ // shape i18next returns, judged in each container a name can be written for.
+ //
+ // The `copy` column is the default and the correction. An object under it is
+ // the escape: both reported keys turned into one and the suite stayed green,
+ // because the default used to be the `subtree` column instead.
+ const table: Array<{ value: unknown; copy: boolean; list: boolean; subtree: boolean; why: string }> = [
+ { value: 'Copy', copy: true, list: false, subtree: true, why: 'a leaf is copy and is copy under itself' },
+ { value: '', copy: false, list: false, subtree: false, why: 'blank' },
+ { value: ' ', copy: false, list: false, subtree: false, why: 'renders as nothing' },
+ { value: 'k', copy: false, list: false, subtree: false, why: 'i18next echoing the key' },
+ { value: ['one', 'two'], copy: false, list: true, subtree: true, why: 'a list is mapped, never rendered bare' },
+ { value: [], copy: false, list: false, subtree: false, why: 'the disclosure list, emptied' },
+ { value: ['one', ''], copy: false, list: false, subtree: false, why: 'a blank row is missing copy' },
+ { value: [{ text: 'one' }], copy: false, list: false, subtree: true, why: 'rows of objects render nothing' },
+ { value: { label: 'Copy' }, copy: false, list: false, subtree: true, why: 'a prefix, and NOT copy by default' },
+ { value: {}, copy: false, list: false, subtree: false, why: 'empty' },
+ { value: undefined, copy: false, list: false, subtree: false, why: 'no value at all' },
+ { value: null, copy: false, list: false, subtree: false, why: 'no value at all' },
+ { value: 42, copy: false, list: false, subtree: false, why: 'not copy' },
+ { value: true, copy: false, list: false, subtree: false, why: 'not copy' },
+ ];
+
+ for (const row of table) {
+ expect(arrivesIn(row.value, 'k', ['copy']), `copy: ${row.why}`).toBe(row.copy);
+ expect(arrivesIn(row.value, 'k', ['list']), `list: ${row.why}`).toBe(row.list);
+ expect(arrivesIn(row.value, 'k', ['subtree']), `subtree: ${row.why}`).toBe(row.subtree);
+ // An opaque call site names one of the first two and cannot say which, so
+ // it is asked for either — and never for the third.
+ expect(arrivesIn(row.value, 'k', ['copy', 'list']), `either: ${row.why}`).toBe(row.copy || row.list);
+ }
+ });
+
+ it('holds a defaulted-only key and a carrier-only key to the shape their consumer renders', () => {
+ // #1969, both escapes, through the real properties rather than a helper: a
+ // key named ONLY by a call carrying its own `defaultValue`, and a key named
+ // by no call site at all, each turned into a nonempty object in BOTH locales.
+ //
+ // Neither reaches EXISTENCE — one demands no copy, the other has no call to
+ // read — so the name-side contract is the only thing that can see them, and
+ // under the old default it saw an object with copy under it and said yes.
+ const defaulted = collectReferences(`
+ const title = t('harness.createDialog.kindTask', { defaultValue: 'Background work' });
+ `);
+ expect(defaulted.map((reference) => reference.demand)).toEqual(['none']);
+ const carrierOnly = collectDottedLiterals(`
+ const Field = () => <ProxyUrlField labelKey="telegramConfig.proxyUrl" />;
+ `);
+ expect(collectReferences('const Field = () => <ProxyUrlField labelKey="telegramConfig.proxyUrl" />;')).toEqual([]);
+
+ const names = [...defaulted.map((reference) => reference.key), ...carrierOnly];
+ const asObjects = (kindTask: unknown, proxyUrl: unknown) => ({
+ harness: { createDialog: { kindTask } },
+ telegramConfig: { proxyUrl },
+ });
+
+ // As shipped: leaves, so both resolve and neither property has anything to say.
+ const copy = [
+ { lng: 'en', bundle: asObjects('Scheduled task', 'Proxy URL (optional)') },
+ { lng: 'zh', bundle: asObjects('后台任务', '代理地址(可选)') },
+ ];
+ expect(parityGaps(names, copy)).toEqual([]);
+ expect(residueOf(names, copy)).toEqual([]);
+
+ // M21 and M22: an object in every locale. Nothing renders a node, so no
+ // locale resolves either name and both fall to the pin — the same landing as
+ // blanking them, because it is the same loss of copy.
+ const node = { title: 'Scheduled task' };
+ const mutated = [
+ { lng: 'en', bundle: asObjects(node, { label: 'Proxy URL (optional)' }) },
+ { lng: 'zh', bundle: asObjects({ title: '后台任务' }, { label: '代理地址(可选)' }) },
+ ];
+ expect(parityGaps(names, mutated)).toEqual([]);
+ expect(residueOf(names, mutated)).toEqual(['harness.createDialog.kindTask', 'telegramConfig.proxyUrl']);
+ expect(NON_KEY_LITERALS).not.toContain('harness.createDialog.kindTask');
+ expect(NON_KEY_LITERALS).not.toContain('telegramConfig.proxyUrl');
+
+ // A list is refused on the same ground and for the same reason: `t()` at a
+ // carrier hands React an array, not the label the surface asked for.
+ const listed = [
+ { lng: 'en', bundle: asObjects('Scheduled task', ['Proxy URL (optional)']) },
+ { lng: 'zh', bundle: asObjects('后台任务', ['代理地址(可选)']) },
+ ];
+ expect(residueOf(names, listed)).toEqual(['telegramConfig.proxyUrl']);
+
+ // Broken in ONE locale only, which is the commoner accident: a parity gap
+ // rather than residue, so the name is reported instead of silently pinned.
+ const half = [
+ { lng: 'en', bundle: asObjects('Scheduled task', 'Proxy URL (optional)') },
+ { lng: 'zh', bundle: asObjects(node, { label: '代理地址(可选)' }) },
+ ];
+ expect(parityGaps(names, half)).toEqual([
+ { key: 'harness.createDialog.kindTask', present: ['en'], absent: ['zh'] },
+ { key: 'telegramConfig.proxyUrl', present: ['en'], absent: ['zh'] },
+ ]);
+
+ // And absence is still its own fact, distinct from a broken present value: a
+ // `defaultValue` call renders its fallback when the key is gone from every
+ // locale, so that name lands in the pin rather than in EXISTENCE. Which
+ // container it would have been held to never enters the question.
+ const gone = [
+ { lng: 'en', bundle: { telegramConfig: { proxyUrl: 'Proxy URL (optional)' } } },
+ { lng: 'zh', bundle: { telegramConfig: { proxyUrl: '代理地址(可选)' } } },
+ ];
+ expect(residueOf(names, gone)).toEqual(['harness.createDialog.kindTask']);
+ });
+
+ it('lets a pinned prefix resolve to a node, and lets it excuse nothing else', () => {
+ // The exception, and its boundary. `containersFor` is the app's own resolver,
+ // so what this pins is the rule the properties above actually run under.
+ const prefixed = [
+ { lng: 'en', bundle: { harness: { runStatus: { queued: 'Queued' }, other: { queued: 'Queued' } } } },
+ { lng: 'zh', bundle: { harness: { runStatus: { queued: '排队中' }, other: { queued: '排队中' } } } },
+ ];
+ const names = ['harness.runStatus', 'harness.other'];
+
+ // Leaf by default: the identical node resolves at neither name.
+ expect(residueOf(names, prefixed)).toEqual(['harness.other', 'harness.runStatus']);
+ // Pinned: the prefix resolves, and the name beside it — same shape, same
+ // subtree, not enumerated — still does not.
+ expect(residueOf(names, prefixed, containersFor([]))).toEqual(['harness.other']);
+
+ // A `returnObjects` consumer is READ rather than pinned, and it buys a list
+ // and only a list: the object that a prefix may be is still residue here.
+ const listConsumer = collectReferences("const rows = t('memory.settings.disclosure', { returnObjects: true });");
+ const withList = containersFor(listConsumer);
+ expect(withList('memory.settings.disclosure')).toEqual(['list']);
+ const rows = (value: unknown) => ({ memory: { settings: { disclosure: value } } });
+ const asList = [{ lng: 'en', bundle: rows(['One']) }, { lng: 'zh', bundle: rows(['一']) }];
+ const asNode = [{ lng: 'en', bundle: rows({ a: 'One' }) }, { lng: 'zh', bundle: rows({ a: '一' }) }];
+ expect(residueOf(['memory.settings.disclosure'], asList, withList)).toEqual([]);
+ expect(residueOf(['memory.settings.disclosure'], asNode, withList)).toEqual(['memory.settings.disclosure']);
+
+ // Losing the whole subtree in one locale is still a gap: the pin relaxes the
+ // container, never the requirement that both locales carry copy.
+ expect(
+ parityGaps(['harness.runStatus'], [prefixed[0], { lng: 'zh', bundle: { harness: {} } }], containersFor([])),
+ ).toEqual([{ key: 'harness.runStatus', present: ['en'], absent: ['zh'] }]);
+
+ // And the permission does not reach EXISTENCE, which reads the call: a plain
+ // `t()` on a pinned prefix is still missing the copy it renders.
+ const plain: Reference = { key: 'harness.runStatus', counted: false, listed: false, demand: 'exact' };
+ expect(missingCopy(localeInstance('en', prefixed[0].bundle), 'en', plain)).toBe(true);
+ });
+
+ it('pins the prefixes against the bundles, and keeps them out of copy-demanding calls', () => {
+ // Both directions, on the real bundles. A pinned name that is no longer a
+ // node has a stale exemption; a pinned name something renders directly would
+ // be an exemption cancelling a real demand, which is the one-way rule.
+ for (const { lng, bundle } of BUNDLES) {
+ const instance = localeInstance(lng, bundle);
+ for (const prefix of KEY_PREFIXES) {
+ const value = instance.t(prefix, { returnObjects: true });
+ expect(Array.isArray(value) || typeof value !== 'object', `${prefix} in ${lng} is no longer a node`).toBe(false);
+ expect(resolvesIn(instance, lng, prefix, ['subtree']), `${prefix} in ${lng} has no copy under it`).toBe(true);
+ }
+ }
+ // Every demand, defaulted included: a `defaultValue` covers a name the
+ // bundles lack, and a pinned prefix is by definition a name they have, so it
+ // buys that call nothing and the exemption must not read as if it did.
+ expect(
+ referenced
+ .filter((reference) => KEY_PREFIXES.includes(reference.key))
+ .map(label),
+ ).toEqual([]);
});
it('decides a CALL by the exact shape it consumes, over every shape i18next returns', () => {
@@ -1213,6 +1581,60 @@ describe('app i18n key coverage', () => {
// started expanding. There is no `context` anywhere in `src/`.
});
+ it('separates a name being THERE from its value being copy, one selected form at a time', () => {
+ // What a `defaultValue` actually buys, and the fact only the resolver holds.
+ // A defaulted call is owed nothing where its key is MISSING and everything
+ // where its key is present, so presence decides which — per selected form,
+ // because that is how i18next spends the fallback.
+ const call = (bundle: unknown, reference: Reference) =>
+ missingCopy(localeInstance('en', bundle), 'en', reference);
+ const counted = (over: Partial<Reference> = {}): Reference =>
+ ({ key: 'card.count', counted: true, listed: false, demand: 'none', ...over });
+
+ // Partial availability with a fallback, which is the POSITIVE control: `one`
+ // is there and valid, `other` is not there at all, and the call renders its
+ // own default. Failing this because a sibling category exists would reject
+ // the one thing a `defaultValue` is for.
+ expect(call({ card: { count_one: 'One' } }, counted())).toBe(false);
+ // The same bundle, no fallback: a form the call can reach and the bundle
+ // lacks is still a gap, which is what keeps this from excusing everything.
+ expect(call({ card: { count_one: 'One' } }, counted({ demand: 'exact' }))).toBe(true);
+ // Present and malformed, the NEGATIVE control: the fallback is never reached
+ // because the key is there, so the stored value renders — and a blank
+ // category is missing copy whether or not the call carries a default.
+ expect(call({ card: { count_one: 'One', count_other: '' } }, counted())).toBe(true);
+ expect(call({ card: { count_one: 'One', count_other: '' } }, counted({ demand: 'exact' }))).toBe(true);
+
+ // Why presence is asked of the resolver and not of the value: a bundle may
+ // store the key AS its value. That is present and invalid — copy someone has
+ // to write — while the absent name is a fallback legitimately covering a
+ // missing key, and `t()` hands back the same string for both.
+ const echo: Reference = { key: 'card.echo', counted: false, listed: false, demand: 'none' };
+ expect(call({ card: { echo: 'card.echo' } }, echo)).toBe(true);
+ expect(call({ card: {} }, echo)).toBe(false);
+
+ // The escapes this round closed, at the boundary that closes them. Each name
+ // is fine on the NAME side — one is a list the app really reads, one is a
+ // pinned prefix — and neither classification reaches a call it cannot serve.
+ const onList = (over: Partial<Reference> = {}): Reference =>
+ ({ key: 'memory.rows', counted: false, listed: false, demand: 'exact', ...over });
+ const rows = { memory: { rows: ['one', 'two'] } };
+ expect(call(rows, onList())).toBe(true); // a plain call renders `[object Object]`
+ expect(call(rows, onList({ demand: 'none' }))).toBe(true); // and a default does not cover a present key
+ expect(call(rows, onList({ listed: true }))).toBe(false); // the consumer that reads it is untouched
+
+ expect(call(
+ { harness: { runStatus: { queued: 'Queued' } } },
+ { key: 'harness.runStatus', counted: false, listed: false, demand: 'none' },
+ )).toBe(true);
+
+ // A counted list, every reachable form asked: a valid `one` cannot carry an
+ // empty `other` past this, though the name resolves on either side of it.
+ const list: Reference = { key: 'probe.rows', counted: true, listed: true, demand: 'exact' };
+ expect(call({ probe: { rows_one: ['Row'], rows_other: [] } }, list)).toBe(true);
+ expect(call({ probe: { rows_one: ['Row'], rows_other: ['Rows'] } }, list)).toBe(false);
+ });
+
it('collects dotted literals wherever they sit, with no position enumerated', () => {
// PARITY's input, and the reason it needs no positions: every one of these is
// collected by the same rule, and none of the carriers is named anywhere in
@@ -1395,12 +1817,12 @@ describe('app i18n key coverage', () => {
it('pins the names that are not keys, so no key can leave both locales unseen', () => {
// Exact set equality, not a count: a count lets one literal leave as another
// enters. Sorted on both sides so the list above can stay grouped by class.
- expect(residueOf(appCandidateKeys(referenced), BUNDLES)).toEqual(
+ expect(residueOf(appCandidateKeys(referenced), BUNDLES, appContainers)).toEqual(
[...NON_KEY_LITERALS].sort((a, b) => a.localeCompare(b)),
);
});
it('keeps every name the app can ask for resolving in both locales or neither', () => {
- expect(parityGaps(appCandidateKeys(referenced), BUNDLES)).toEqual([]);
+ expect(parityGaps(appCandidateKeys(referenced), BUNDLES, appContainers)).toEqual([]);
});
});