Repository navigation
fix(console): the public form prints a form entry's own label, not the app bundle's object-field translation - #34390
Conversation
A form entry that declares its own label is the form's visitor-facing copy, already localized by the form endpoint. The row now carries where its label came from, and only an object-field label takes the app bundle's fields.OBJECT.FIELD overlay; the required and visibleWhen-fault messages use the same rule. Claude-Session: https://claude.ai/code/session_01ADHkmTMdcLKvrzHvpYZ3gn Co-authored-by: Claude <noreply@anthropic.com>
…ld translation Claude-Session: https://claude.ai/code/session_01ADHkmTMdcLKvrzHvpYZ3gn Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmTMdcLKvrzHvpYZ3gn Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmTMdcLKvrzHvpYZ3gn Co-authored-by: Claude <noreply@anthropic.com>
|
domain:ui#2 · os-steve · session_01ADHkmSzhXR4yUAgwq1bQRi 维护者速读
席位意见标签来源在建行时就定下来,渲染时不再根据字符串去猜。四处调用共用一条规则,消息里不会出现访客看不到的字段名。同意落地。 席位核对 — ACCEPT · domain:ui#2 · head 20d4db3 · 2026-11-16T21:32Z |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 43961197419 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
|
domain:ui#2 · os-steve · session_01ADHkmSzhXR4yUAgwq1bQRi Merge-queue triage: re-queue once · head 20d4db3 · 2026-11-16T21:52Z The queue build failed on
Re-queued once on the same head. If it fails again without #34429 in the group, the seat triages it as this PR's. |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 43963558735 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
Requested by Steve · project thread
Fixes #34375
Clause-②: no
Metadata-protocol: none
维护者速读
FormPage)里,表单项自己声明了label的行,直接显示表单接口返回的标签(已按访客语言本地化);只有标签来自对象字段的行,才继续用应用翻译包的fields.对象.字段覆盖。必填提示和visibleWhen故障提示按同一规则点名字段。labelSource),不比较字符串。没有表单项标签的行行为不变。无服务端、契约或@object-ui/i18n改动。回滚即 revert 本 PR。ui/apps/console/src/components/FormPage.tsx的rowLabel(组件内)与buildSections里新增的labelSource一行;其次FormPage.sectionLabelI18n.test.tsx末尾新增的一组测试。pnpm --dir ui exec vitest run apps/console/src/components/FormPage.sectionLabelI18n.test.tsx,预期 9 个测试全过(其中 3 个为本卡新增)。What changes
RenderableFieldgainslabelSource: 'entry' | 'object', set inbuildSectionsfrom the same??that picks the label:'entry'when the form entry declared its ownlabel,'object'when the row fell back to the object field's label (or its name). Nothing compares strings.rowLabel(object, f)prints an'entry'label as served (the form endpoint already localized it from_sections.SECTION.fields.FIELD.label) and keepsfieldLabel(object, f.name, f.label), the bundle overlay with the served label as fallback, for an'object'row. It replaces all four call sites: the row label on screen, thevisibleWhen-fault banner, the required banner/toast and the per-row required message. So a refusal names a field by the label the visitor sees.fieldLabelin@object-ui/i18nis unchanged. Every other surface keeps bundle-first resolution for object fields.Why
The form endpoint serves the entry label correctly. The page then looked up
fields.OBJECT.FIELDfirst, which translates the object field's agent-side label, and printed it whenever the browser held the app bundle. A signed-in visitor (or any visit with the bundle loaded) read the agent-side label; a cold anonymous visit (no bundle, seeFormPage.signedOutSectionI18n-12333.test.tsx) read the entry label.Tests
New top-level
describein the existing public-form i18n harnessFormPage.sectionLabelI18n.test.tsx(the file that already seeds an app bundle on the unwrapped/f/:slugroute). The fixture's bundle translates both object fields (supplied_name→ 提交人姓名,supplied_email→ 提交人邮箱); the form entry forsupplied_namedeclareslabel: 您的姓名, the entry forsupplied_emaildeclares none. Every leg asserts both strings.ENTRY_LABEL_RENDERS_AS_SERVED: the row reads 您的姓名, 提交人姓名 is nowhere on the page, and the input is named by 您的姓名.REQUIRED_REFUSAL_NAMES_THE_VISIBLE_LABELS: an empty submit's toast/banner message contains 您的姓名 and 提交人邮箱, not 提交人姓名; the per-row message the name input points at (aria-describedby) names 您的姓名.OBJECT_LABEL_TAKES_THE_BUNDLE: the row with no entry label reads 提交人邮箱, not the object's authored "Submitter email".The
visibleWhen-fault message goes through the samerowLabelcall; it has no new pin of its own (the card asked for (a)–(c)).Forced test edits (type only, no assertion changed):
RenderableField.labelSourceis required, so the hand-built row fixtures gainlabelSource: 'object':FormPage.test.ts(thereadPrefillfields and theremind_atrow),FormPage.omitBlanksRebind.test.ts(row()),FormPage.optionDefault-13049.test.tsx(thepriorityrow). Without it@object-ui/consoletype-checkreds (28 TS errors measured before the edit).Acceptance notes
?form=ID) renders through the samebuildSectionsand the samerowLabel, so it follows the same rule. Whether that route's form view arrives with its entry labels already localized was not measured here; an entry label that is a plain string is printed as authored there, as it was whenever the bundle missed.labelhappens to equal the object field's label is still an entry label and is printed as served (no string comparison, by the card's instruction).Verification
Readings taken on head
f29f7093(base6cc3f974).Ablations (each leg via scripts/ablation-replace.mjs, restored blob == HEAD, git diff HEAD empty)
rowLabelignores provenance (/* ablated */ fieldLabel(object, f.name, f.label)): (a) and (b) red, (c) green.expected '提交人姓名' to be '您的姓名';expected '必填项:提交人姓名、提交人邮箱' to contain '您的姓名'. 2 failed, 7 passed.buildSectionsalwayslabelSource: 'object': the same two legs red with the same messages. 2 failed, 7 passed./* ablated */ f.label): (c) red (expected 'Submitter email' to be '提交人邮箱'), (b) red on its 提交人邮箱 half, and the existingFIELD_LABEL_IS_TRANSLATEDred. 3 failed, 6 passed.The console test imports
FormPagefrom source, so no dist rebuild sits between mutation and run.Local runs
pnpm --dir ui exec vitest run apps/console/src/components/FormPage.sectionLabelI18n.test.tsx: 9/9.FormPageorbuildSections(62 files):Test Files 62 passed (62),Tests 557 passed (557).pnpm --filter @object-ui/console run type-check: exit 0.pnpm exec eslinton the five touched files: 0 errors; warning counts equal to base forFormPage.tsx(26) andFormPage.test.ts(2).pnpm --dir ui check:new-line-citations: 0 new citations.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack: 37 commands, each run on the final head, all exit 0 (list in the os-dev-report on the card).Human Minimum
packages/specholds no runtime logic.pnpm lintpasses.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (Not touched.)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code