Skip to content

fix(i18n): fail when a call site's arguments are not the holes its en value has, and delete the three that were inert (#3845) - #4136

Merged
yinlianghui merged 1 commit into
mainfrom
claude/issue-3845-i18n-param-hole-parity
Aug 10, 2026
Merged

fix(i18n): fail when a call site's arguments are not the holes its en value has, and delete the three that were inert (#3845)#4136
yinlianghui merged 1 commit into
mainfrom
claude/issue-3845-i18n-param-hole-parity

Conversation

@yinlianghui

Copy link
Copy Markdown
Collaborator

Fixes#3845

Option C + A per the delegated ruling on the card. Stacked on #4119 (#3810), which merged as 297534b78 before this started, so this branches off main rather than off that branch.

The rule (C)

scripts/check-i18n-call-site-keys.mjs gains a fourth failure class, interpolation-parity: for a call site whose key resolves to a readable en leaf, the set of interpolation option names it passes must equal the set of {{hole}} names in that value. Both directions fail, because they fail differently:

  • inert — an argument with no hole. i18next drops it in silence; there is no runtime signal anywhere.
  • unfilled — a hole with no argument. i18next leaves the braces in the output and the user reads a literal {{name}}.

Nothing else could see either. all-locales-key-parity does compare placeholder shape, but pack against pack — ten packs agreeing on Update while the call site passes version is full parity. check-i18n-en-drift fires only on a changed en string. And #3810's default-value-drift is satisfied the moment the call site's inline default matches the pack, which is exactly the road home.welcome travelled: its value was rewritten from Welcome to {{product}} to Build your business system with AI, #4119 aligned the call site's default to the new sentence, and the now-inert product stayed sitting beside it. Byte-alignment and argument-parity are different questions about the same line.

The measurement, which decided the shape

Run over the whole repo with the rule in and nothing yet fixed:

Interpolation parity: 2291 call sites compared against their en value's holes, 72 with no
single comparable en value, 0 with an unreadable option set.
5 call sites pass arguments that do not match the holes in the en value (4 distinct keys)
apps/console/src/pages/auth/ForgotPasswordPage.tsx:46:31 auth.forgotPassword.successDescription
unfilled (hole, no argument): email
packages/app-shell/src/console/auth/ForgotPasswordPage.tsx:30:31 auth.forgotPassword.successDescription
unfilled (hole, no argument): email
packages/app-shell/src/console/home/HomePage.tsx:330:26 home.welcome
inert (passed, no hole): product
packages/app-shell/src/console/marketplace/MarketplacePackagePage.tsx:555:17 marketplace.action.updateTo
inert (passed, no hole): version
packages/app-shell/src/hooks/useObjectActions.ts:160:15 objectActions.resetPackageSetSuccess
inert (passed, no hole): label

Five, where the card predicted two — and the three extra split cleanly into one more of the card's class and two of something the card did not anticipate.

One more inert argument the census had not reached

objectActions.resetPackageSetSuccess passes label, copied from the deleteSuccess branch immediately below it, whose sentence does name the record. Checked against all ten packs by hand, not inferred from en: not one of the ten has a {{label}} hole in that string, while all ten have one in deleteSuccess. Provably inert, so it takes the same treatment.

Two that are NOT findings, and the abstention that says so

The two auth.forgotPassword.successDescription sites are a false positive, and running the two-line fix on them would have been a real bug. packages/auth/src/ForgotPasswordForm.tsx:286 fills that hole itself:

constsuccessMsg=l.successDescription.includes('{{email}}')
? l.successDescription.replace('{{email}}',email)
: `${l.successDescription}${email}`;

The label is a prop; the call site renders before the user has typed an address and cannot interpolate it. The string travels through t() with {{email}} intact — which works because i18next leaves an unmatched hole verbatim — and the component substitutes afterwards. All ten packs carry the hole, so this is the shape in every language.

So the key is registered in a new EXTERNALLY_INTERPOLATED_HOLES list, modelled on the existing EXCLUDED_TRANSLATORS: an entry with a reason, not a silent skip. It removes the listed holes from the hole set, which silences the unfilled direction only — and that asymmetry is the point. Passing email at the call site would let i18next consume the hole, includes('{{email}}') would then miss, and the fallback branch would append the address a second time. That is precisely the "fix" a reader would reach for on seeing a hole with no argument, so the gate keeps reporting it. The self-test re-verifies each entry's premise against both the pack and the named source file, so an entry cannot outlive the substitution it describes.

The spelling collision underneath this — the same "hole i18next must not fill" concept written {{email}} here and {seconds} three lines away in the same labels object, with only the second one documented — is filed as #4135 rather than fixed here: it is a ten-pack copy edit or a public-prop change in @object-ui/auth, neither of which belongs in a gate PR.

The stock (A)

All three inert arguments deleted, none of the ten locale packs touched — check:i18n-drift reports 0 en value(s) changed. A, not B, per the ruling: adding {{version}} to the button is a copy decision about the three-state Update / Installed / Installing... label and its width, and a stock cleanup must not smuggle one in. The gate accepts either resolution.

No rendered output moves, on any path — verified rather than assumed, since #4119 found a provider-less nuance in the neighbouring class:

#3546's slice-five assertion — written explicitly to force this decision rather than let it be settled silently — is updated to pin the chosen state, not deleted: the argument is gone from the call site, no pack pretends there was a hole, and the sister marketplace.install.updateTo that does render the version is asserted untouched, so the asymmetry stays visible to whoever takes the copy decision later.

The false-positive trap the card documented

The card recorded that its first regex census scored 2 hits where there was 1, because the options object of t('fields.image.enlarge', { name: ... }) in packages/fields/src/widgets/ImageField.tsx:105nests another t() call, and the regex read the inner index: as an outer argument. On an AST this is not a special case and must not become one — the inner call's arguments are its own, not properties of the outer object literal. Pinned both ways in the self-test: the real shape is silent, and an inner call that genuinely disagrees is still reported on its own call site.

Abstentions, each one a decision

  • The same key preconditions as [finding] 8 处 auth 调用点的内联 defaultValue 与 en 包值不一致 —— key 存在故兜底是死代码,三道 i18n 门禁按设计都看不见这一类 #3810's class: a dynamic or several-literal key, a returnObjects subtree, an en leaf that is not a readable static string. Plural families fall out heret(k, { count }) resolves through _one / _other and there is no single value whose holes could be the answer, so they are never judged, consistent with how fix(i18n): fail on an inline defaultValue that contradicts its en value, and align the 43 that do (#3810) #4119 handled them.
  • Reserved names are subtracted from both sides, not just the call site's. count is the reason: it is an i18next control option and the value of a {{count}} hole, so subtracting it from one side only would report every counted string as unfilled.
  • An options object whose name set cannot be read — a spread, a computed name, or a replace: redirect, which is where i18next takes interpolation data from when present. 0 in the repo today; the abstention is counted and printed so the first one cannot erode the rule silently.
  • holesOf reads through a formatter ({{n, number}}), an unescape marker ({{- html}}) and a keypath ({{user.name}} is filled by user). None of the three is in en today — all 84 distinct holes are bare names — but each would otherwise become a phantom hole nobody passes.

Verification

  • pnpm exec vitest run scripts/__tests__/check-i18n-call-site-keys.test.ts51 passed (17 new).
  • Reverse verification, both halves:
    • Rule removed (git checkout origin/main -- of the script, patch re-applied after — never git stash): 13 of the 17 new tests go red, predicted before running. The 4 that stay green are the ones that should: two over-firing guards (a missing key must report ['missing-key'] only; a registered hole must not be demanded), the main-is-clean stock assertion, and the source-text pins on the three deleted arguments — none of which a removed rule can falsify.
    • Stock restored: the repo-wide run above is that state, and it reports exactly the measured sites and no others.
    • Both directions shown discriminating on synthetic repos: a param-with-no-hole case reds, and a hole-with-no-param case reds — the direction the card measured at 0 and called "luck, not guarantee".
  • node scripts/check-i18n-call-site-keys.mjs — exit 0.
  • pnpm exec vitest run packages/app-shell/ — 318 files, 2969 passed, 1 skipped.
  • pnpm exec vitest run packages/i18n/ scripts/__tests__/check-i18n-call-site-keys.test.ts — 36 files, 681 passed (includes the rewritten 258 个 t() 调用点引用的 key 在任何语言包里都不存在(#3530 守卫首跑实测),其中 8 处直接把 raw key 渲染给用户 #3546 slice-five assertion).
  • pnpm type-check:scripts — exit 0. turbo run type-check lint --filter=@object-ui/app-shell --filter=@object-ui/i18n32 tasks successful, 0 lint errors.
  • pnpm check:i18n-drift0 en value(s) changed. node scripts/check-control-bytes.mjs — OK, 3829 files. check-changeset-presence / -fixed / -no-major — all green.

Out of scope, filed separately


Generated by Claude Code

… value has (#3845)
Adds a fourth failure class, `interpolation-parity`, to
`scripts/check-i18n-call-site-keys.mjs`: for a call site whose key resolves to a
readable `en` leaf, the set of interpolation option names it passes must EQUAL
the set of `{{hole}}` names in that value. Both directions fail — an argument
with no hole is dropped by i18next in silence, a hole with no argument leaves
its own braces in what the user reads.
The repo-wide run found 3 inert arguments and 0 unfilled holes, so the rule
lands hard, with no baseline. All three arguments are deleted rather than
answered with a new hole in `en.ts`, which would be a copy change obliging nine
more packs: `marketplace.action.updateTo`'s `version`, `home.welcome`'s
`product`, and `objectActions.resetPackageSetSuccess`'s `label`. No rendered
output moves on any path — with a provider mounted i18next dropped them
already, and react-i18next's `notReadyT` returns `defaultValue` verbatim with no
interpolation step at all.
`auth.forgotPassword.successDescription` is registered in
EXTERNALLY_INTERPOLATED_HOLES: `ForgotPasswordForm` substitutes `{{email}}`
itself once the form knows the address. That silences the unfilled direction
only — passing `email` to `t()` there would make the form append it twice, and
the gate still reports it. The spelling collision behind that entry is filed
as #4135.
objectui#3546's slice-five assertion, written to force this decision rather
than let it be settled silently, now pins the chosen state.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Qqyix2QcnpUC9XeYVDzx3
@vercel

vercelBot commented Aug 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
objectuiIgnoredIgnoredAug 10, 2026 12:06pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

MetricValueBudget
Main entry (gzip)28.3 KB350 KB
Entry fileindex-BbwU2mfi.js
StatusPASS

📦 Bundle Size Report

PackageSizeGzipped
app-shell (index.js)8.66KB3.13KB
app-shell (runtime-config.js)7.42KB2.32KB
app-shell (types.js)0.01KB0.04KB
app-shell (urlParams.js)7.57KB2.97KB
auth (AuthContext.js)0.31KB0.24KB
auth (AuthGuard.js)1.17KB0.53KB
auth (AuthProvider.js)22.10KB4.37KB
auth (AuthShell.js)3.49KB1.40KB
auth (ForgotPasswordForm.js)12.21KB3.45KB
auth (LoginForm.js)18.13KB5.39KB
auth (PreviewBanner.js)0.90KB0.50KB
auth (RegisterForm.js)6.64KB2.21KB
auth (SocialSignInButtons.js)9.60KB3.89KB
auth (UserMenu.js)3.40KB1.22KB
auth (auth-gate-events.js)1.29KB0.66KB
auth (authStyles.js)5.04KB1.72KB
auth (createAuthClient.js)35.76KB9.11KB
auth (createAuthenticatedFetch.js)4.37KB1.69KB
auth (index.js)2.35KB1.07KB
auth (org-roles.js)6.66KB2.78KB
auth (phone-identifier.js)1.11KB0.66KB
auth (types.js)0.59KB0.35KB
auth (useAuth.js)4.91KB0.87KB
auth (useIsWorkspaceAdmin.js)1.61KB0.85KB
collaboration (CommentThread.js)26.07KB7.56KB
collaboration (LiveCursors.js)3.17KB1.27KB
collaboration (PresenceAvatars.js)6.49KB2.64KB
collaboration (PresenceProvider.js)2.79KB1.13KB
collaboration (index.js)1.65KB0.73KB
collaboration (useCollaborationTranslation.js)6.05KB2.52KB
collaboration (useCommentSearch.js)1.98KB0.88KB
collaboration (useConflictResolution.js)7.75KB1.86KB
collaboration (useMentionNotifications.js)1.81KB0.68KB
collaboration (usePresence.js)6.33KB1.84KB
collaboration (useRealtimeSubscription.js)7.91KB2.01KB
components (index.js)485.06KB107.21KB
core (index.js)3.04KB1.15KB
create-plugin (index.js)10.08KB3.26KB
data-objectstack (index.js)140.66KB36.25KB
fields (index.js)229.40KB56.93KB
i18n (LocalizationContext.js)1.76KB0.96KB
i18n (currency.js)1.22KB0.64KB
i18n (i18n.js)4.32KB1.77KB
i18n (index.js)2.65KB1.06KB
i18n (pickLocalized.js)1.70KB0.83KB
i18n (provider.js)9.48KB3.27KB
i18n (useObjectLabel.js)27.59KB6.63KB
i18n (useSafeTranslation.js)4.52KB1.96KB
layout (index.js)38.87KB10.80KB
mobile (MobileProvider.js)0.92KB0.49KB
mobile (ResponsiveContainer.js)0.94KB0.38KB
mobile (breakpoints.js)1.51KB0.70KB
mobile (createOfflineDataSource.js)5.61KB1.74KB
mobile (index.js)1.50KB0.62KB
mobile (offlineQueue.js)3.91KB1.35KB
mobile (pwa.js)0.97KB0.49KB
mobile (serviceWorker.js)1.48KB0.62KB
mobile (serviceWorkerSource.js)3.41KB1.48KB
mobile (useBreakpoint.js)1.54KB0.65KB
mobile (useGesture.js)6.96KB1.98KB
mobile (useOfflineSync.js)1.99KB0.72KB
mobile (usePullToRefresh.js)2.53KB0.85KB
mobile (useResponsive.js)0.71KB0.42KB
mobile (useResponsiveConfig.js)1.36KB0.63KB
mobile (useSpecGesture.js)4.32KB1.64KB
mobile (useTouchTarget.js)1.01KB0.54KB
permissions (MePermissionsProvider.js)8.75KB3.06KB
permissions (PermissionContext.js)0.31KB0.25KB
permissions (PermissionGuard.js)0.89KB0.45KB
permissions (PermissionProvider.js)3.67KB1.12KB
permissions (evaluator.js)4.41KB1.44KB
permissions (index.js)0.91KB0.41KB
permissions (store.js)0.91KB0.42KB
permissions (useFieldPermissions.js)1.28KB0.52KB
permissions (usePermissions.js)1.55KB0.71KB
plugin-ai (index.js)15.71KB3.79KB
plugin-calendar (index.js)45.23KB12.45KB
plugin-charts (index.js)61.52KB17.49KB
plugin-chatbot (index.js)180.33KB42.79KB
plugin-dashboard (index.js)118.50KB30.66KB
plugin-designer (index.js)210.51KB42.51KB
plugin-detail (index.js)237.80KB59.48KB
plugin-editor (index.js)2.46KB1.10KB
plugin-form (index.js)114.58KB27.68KB
plugin-gantt (index.js)162.81KB39.67KB
plugin-grid (index.js)188.04KB49.91KB
plugin-kanban (index.js)48.60KB13.41KB
plugin-list (index.js)110.04KB26.67KB
plugin-map (index.js)17.00KB5.32KB
plugin-markdown (index.js)13.72KB4.69KB
plugin-report (index.js)40.58KB10.58KB
plugin-timeline (index.js)26.21KB7.52KB
plugin-tree (index.js)8.50KB2.88KB
plugin-view (index.js)84.03KB20.55KB
providers (DataSourceProvider.js)0.75KB0.39KB
providers (MetadataProvider.js)1.37KB0.59KB
providers (ThemeProvider.js)1.90KB0.85KB
providers (UploadProvider.js)11.71KB3.53KB
providers (index.js)0.44KB0.22KB
providers (types.js)0.01KB0.04KB
react-runtime (index.js)5.67KB2.37KB
react (LazyPluginLoader.js)3.77KB1.33KB
react (SchemaRenderer.js)23.71KB7.95KB
react (data-invalidation.js)5.05KB2.08KB
react (index.js)1.23KB0.66KB
react (spec-input.js)0.20KB0.18KB
sdui-parser (codegen.js)4.09KB1.74KB
sdui-parser (index.js)4.47KB2.03KB
sdui-parser (parse.js)10.04KB2.82KB
sdui-parser (types.js)0.29KB0.24KB
sdui-parser (validate.js)4.69KB1.48KB
types (ai.js)0.20KB0.17KB
types (api-types.js)0.20KB0.18KB
types (app.js)2.87KB0.99KB
types (base.js)0.20KB0.18KB
types (blocks.js)0.20KB0.18KB
types (complex.js)0.20KB0.18KB
types (crud.js)0.20KB0.18KB
types (data-display.js)0.20KB0.18KB
types (data-protocol.js)0.20KB0.19KB
types (data.js)0.20KB0.18KB
types (designer.js)1.87KB0.85KB
types (disclosure.js)0.20KB0.18KB
types (error-code.js)1.54KB0.88KB
types (feedback.js)0.20KB0.18KB
types (field-types.js)0.20KB0.18KB
types (form.js)0.20KB0.18KB
types (http-retry.js)4.32KB2.02KB
types (index.js)2.71KB1.34KB
types (layout.js)0.20KB0.18KB
types (managed-by.js)0.19KB0.18KB
types (mobile.js)2.59KB1.31KB
types (navigation.js)0.20KB0.18KB
types (objectql.js)0.20KB0.18KB
types (overlay.js)0.20KB0.18KB
types (permissions.js)0.20KB0.18KB
types (plugin-scope.js)0.20KB0.18KB
types (record-components.js)0.20KB0.19KB
types (record-semantics.js)1.28KB0.67KB
types (registry.js)0.20KB0.18KB
types (reports.js)0.20KB0.18KB
types (spec-report.js)5.05KB1.93KB
types (system-fields.js)3.33KB1.54KB
types (theme.js)0.20KB0.18KB
types (ui-action.js)3.40KB1.71KB
types (views.js)0.20KB0.18KB
types (widget.js)0.20KB0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

2 participants

@yinlianghui@claude