Repository navigation
fix(app-shell): the designer's unknown-value flags read in the designer's locale (objectui#9652) - #10445
Conversation
…er's locale (objectui#9652) The flag a designer picker puts on a stored value its roster does not offer was a hard-coded English template literal at five sites, so a zh-CN author read "(not found)", "(not in object)" and "(deprecated)" on an otherwise Chinese inspector. Each flag now resolves through the designer catalogue: "(not in object)" through the existing engine.form.notInObject, and two new flag keys, engine.form.notFound and engine.form.deprecated, beside it. The value and its flag are joined by one engine.form.flaggedValue template, so the order and the gap belong to the locale (zh sets no space before a full-width bracket). InspectorSelectField's default flag reads useMetadataLocale(), the hook the designer's other shared editors already read. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BP8CMtACxTdLjqR6rhd33C
…te (objectui#9652) Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BP8CMtACxTdLjqR6rhd33C
…pp-shell patch (objectui#9652) Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BP8CMtACxTdLjqR6rhd33C
|
changeset-claim-re-read
|
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
Contract reviewServed-tier: Rendered by an isolated review subagent spawned by the ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS Generated by Claude Code |
Fixes #9652
Clause-②: no
What was wrong
A designer picker that holds a stored value its roster does not offer still shows that value, flagged with the reason. The flag was an English template literal at each site, so a zh-CN author read
(not found),(not in object)or(deprecated)on an otherwise Chinese inspector. The designer catalogue (packages/app-shell/src/views/metadata-admin/i18n.ts) already carriedengine.form.notInObjectin en and zh, andwidgets.tsxalready used it.Sites (re-derived by grep on
origin/mainat the base3335767b4)ViewColumnInspectorfield picker(not in object)engine.form.notInObject(existing row, unchanged)ViewVariantInspectorview type(not found)engine.form.notFound(new)FlowNodeConfigFieldselect branch(deprecated)engine.form.deprecated(new)FlowObjectListFieldselect cells(deprecated)engine.form.deprecatedInspectorSelectFielddefault (_shared.tsx)(not found)engine.form.notFoundActionDefaultInspectoronly mentionsVALUE (not found)in a comment. ItsActionTargetFieldpasses nounknownValueLabel, so it shows the_shared.tsxdefault, which is now translated.Two sites of the same class that the seat's list did not name. Both are outside this claim's file surface, so they are not touched here. They are listed in the report for the seat:
FlowReferenceField.tsx, org-membership-level select:label: \${current} (invalid)``HookDefaultInspector.tsx, object picker:label: \${n} (not published)``Decisions, each measured
(not in object)now uses the existingengine.form.notInObject. Its value is unchanged, so the bare-suffix readers inwidgets.tsx(which draw it in a muted span of its own) keep working. The catalogue had no row meaning "not found" or "deprecated" (grep of both tables fornot found,deprecated,未找到and弃用). One key was added for each, as bare suffixes shaped likenotInObject:engine.form.notFound=(not found)/(未找到)andengine.form.deprecated=(deprecated)/(已弃用).未找到is the zh pack's own word for "not found" (未找到选项,未找到记录). The catalogue carries en and zh only, and every new key has a value in both.tFormatinterpolates single-brace{token}holes.engine.form.notInObjectis a bare suffix, and its value cannot take a{value}hole without changingwidgets.tsx. So the value and its flag are joined by one template,engine.form.flaggedValue: en{value} {flag}, zh{value}{flag}. The zh template drops the space because every zh flag opens with a full-width bracket. That is the catalogue's own zh convention (component_id(此页面暂无组件)), and a${v} (flag)literal at the call site could not express it. This adds three keys, one more than "one key each": the template is the word-order key that the open point asked for. The helper isflagUnknownValue(value, flag, locale)in_shared.tsx, a one-linetFormatcall.localeprop (ViewColumnInspector,ViewVariantInspector,FlowNodeConfigField) translate with that prop. Two places have nolocaleprop:InspectorSelectField's default andFlowObjectListField. They readuseMetadataLocale(), the hook that the designer's shared editors already read when no prop reaches them (widgets.tsx,SchemaForm.tsx, andConditionBuilder.tsxin this same directory). Every production host (ResourceEditPage,StudioDesignSurface,ObjectActionsPanel) derives thelocaleprop it hands to inspectors from that same hook._shared.tsxdefault. It is translated. The other route would have been alocaleprop onInspectorSelectField, but that needs alocaleargument at each of the call sites that pass nounknownValueLabel, which are in other inspector files outside this claim. The hook covers them with no call-site edit.Pins
The new file is
inspectors/unknownValueFlag.i18n-9652.test.tsx, with 14 cases. For each site it has one render-level zh case and one en case, and it reads the rendered trigger or option text:amount (not in object),legacy_board (not found),sms (deprecated),role (deprecated),retired_group (not found)).localewith no provider. The hook-channel sites mountI18nProviderin the language under test.No existing test was rewritten or deleted. None of them asserted an English flag under a zh locale: every existing literal assertion (
ReportDefaultInspector.test.tsx,FlowNodeInspector.declaredDefault.test.tsx,FlowNodeConfigField.test.tsx,FlowObjectListField.select.test.tsx, the_shared.*andViewColumnInspector.*suites) renders en.Reverse proof (run at
ff58a68b1, which has the same code as the head; the next commit adds only the changeset)Mutations were made through
ablation-replace.mjs. Each anchor hit exactly once, the blob changed, the file was restored to its HEAD blob afterwards, andgit diff HEADwas empty:ViewColumnInspectorback to`${v} (not in object)`:Tests 1 failed | 1 passed | 12 skipped. The zh case failed withExpected: "amount(不在对象中)" Received: "amount (not in object)", and the en case stayed green._shared.tsxdefault back to`${v} (not found)`:Tests 1 failed | 2 passed | 11 skipped. The zh default case failed withexpected 'retired_group (not found)' to be 'retired_group(未找到)', and the en and caller-override cases stayed green.Verification (head
f96ee760a)vitest runonmetadata-admin/inspectors/(all of it) pluscheck-i18n-{designer-table-parity,dead-keys,call-site-keys,en-drift}.test.ts,perm-home-namespace-3546,objectView-config-keys-retired-4730,block-config-i18n,block-config,studio-locale.i18nand the consolepreview-samples-designer-options:Test Files 100 passed (100),Tests 1570 passed | 1 skipped.vitest runon tests that render these inspectors from outside the directory:studio-design/(all of it), bothViewConfigPanelsuites,ResourceEditPage.defaultGate,ConditionalFormattingEditor.celGate,FieldsListEditor.retiredAliases,view-column-io.retiredAliases,page-schema,ViewRefWidgetand four designer i18n tests:Test Files 73 passed (73),Tests 401 passed.turbo run build --filter=@object-ui/app-shell^... --concurrency=2built 28 of 28 tasks. Thenpnpm --filter @object-ui/app-shell type-check(tsc --noEmit && tsc -p tsconfig.test.json) exited 0.--listFilesOnlyconfirms the test tsconfig includes the new test file.check:i18n-designer-parity("Every en row has a zh row, and every shared row carries the same placeholders."),check:i18n-drift(designer table: 3 keys added, 0 en values changed),check:i18n-keys,check-changeset-presence,check-changeset-no-major,check:new-line-citations(0 new),check:control-bytes,check:changeset-claims,check:pending-changeset-literals,check:vi-mock-specifiers,check:vi-mock-inherit,check:vi-mock-override-shapeandcheck:test-path-roots.check:changeset-claimsreported three pending changesets that namei18n.ts:6310-designer-formula-key-retired,7125-dashboard-empty-state-keys-retiredand8632-malformed-picklist-option-loud. I read each paragraph, and all stay true: the keys they name are untouched and still present.eslint --no-inline-config --format jsonon the 7 touched.ts/.tsxfiles gave 7 files, 0 errors and 12 warnings. The population comes from eslint's own config:calculateConfigForFiledoes not ignore these files, andlanguageOptions.parserOptions.projectis null. Invariance: type-aware linting is off, and no rule ineslint-rules/reads other files, so this diff cannot move a verdict on an untouched file.Acceptance notes
react-refresh/only-export-componentson the exportedflagUnknownValue._shared.tsxalready exports non-component helpers such asrosterFromanduniqueIdunder the same warning, andlint.ymlsets no--max-warningson purpose.?locale=zh-CNforces thelocaleprop without switching the i18n language. There, the two hook-read flags follow the i18n language, asSchemaFormandwidgets.tsxalready do on that page. Production hosts get both from the same hook.defaultRosterFailureLabelstays raw English. Every currentrostercaller passest('engine.form.optionsLoadFailedTitle', …), so nothing renders it. Its comment is reworded because the old one called the module locale-free.Generated by Claude Code