Skip to content

fix(console): the public form prints a form entry's own label, not the app bundle's object-field translation - #34390

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-s6aoc3
Nov 16, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-s6aoc3

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #34375

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:公开表单页(console FormPage)里,表单项自己声明了 label 的行,直接显示表单接口返回的标签(已按访客语言本地化);只有标签来自对象字段的行,才继续用应用翻译包的 fields.对象.字段 覆盖。必填提示和 visibleWhen 故障提示按同一规则点名字段。
  • 为什么改:浏览器里只要加载了应用翻译包(比如访客在同一 console 已登录),对象字段的坐席侧译名就会盖掉表单项的访客侧标签。HotCRM 公开支持表单因此显示「提交人姓名」而不是「您的姓名」,冷启动的匿名访问却显示正确,同一版本两种结果。
  • 风险与回滚:只改 console 一个组件的标签取值;行在构建时记下标签来源(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

  • The row records where its label came from. RenderableField gains labelSource: 'entry' | 'object', set in buildSections from the same ?? that picks the label: 'entry' when the form entry declared its own label, 'object' when the row fell back to the object field's label (or its name). Nothing compares strings.
  • One naming rule for the row. A component-local rowLabel(object, f) prints an 'entry' label as served (the form endpoint already localized it from _sections.SECTION.fields.FIELD.label) and keeps fieldLabel(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, the visibleWhen-fault banner, the required banner/toast and the per-row required message. So a refusal names a field by the label the visitor sees.
  • fieldLabel in @object-ui/i18n is 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.FIELD first, 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, see FormPage.signedOutSectionI18n-12333.test.tsx) read the entry label.

Tests

New top-level describe in the existing public-form i18n harness FormPage.sectionLabelI18n.test.tsx (the file that already seeds an app bundle on the unwrapped /f/:slug route). The fixture's bundle translates both object fields (supplied_name → 提交人姓名, supplied_email → 提交人邮箱); the form entry for supplied_name declares label: 您的姓名, the entry for supplied_email declares none. Every leg asserts both strings.

  • (a) ENTRY_LABEL_RENDERS_AS_SERVED: the row reads 您的姓名, 提交人姓名 is nowhere on the page, and the input is named by 您的姓名.
  • (b) 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 您的姓名.
  • (c) CONTROL 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 same rowLabel call; it has no new pin of its own (the card asked for (a)–(c)).

Forced test edits (type only, no assertion changed): RenderableField.labelSource is required, so the hand-built row fixtures gain labelSource: 'object': FormPage.test.ts (the readPrefill fields and the remind_at row), FormPage.omitBlanksRebind.test.ts (row()), FormPage.optionDefault-13049.test.tsx (the priority row). Without it @object-ui/console type-check reds (28 TS errors measured before the edit).

Acceptance notes

  • The internal in-app form route (?form=ID) renders through the same buildSections and the same rowLabel, 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.
  • An entry whose label happens 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 (base 6cc3f974).

Ablations (each leg via scripts/ablation-replace.mjs, restored blob == HEAD, git diff HEAD empty)
  • A1 rowLabel ignores provenance (/* ablated */ fieldLabel(object, f.name, f.label)): (a) and (b) red, (c) green. expected '提交人姓名' to be '您的姓名'; expected '必填项:提交人姓名、提交人邮箱' to contain '您的姓名'. 2 failed, 7 passed.
  • A2 buildSections always labelSource: 'object': the same two legs red with the same messages. 2 failed, 7 passed.
  • A3 no overlay at all (/* ablated */ f.label): (c) red (expected 'Submitter email' to be '提交人邮箱'), (b) red on its 提交人邮箱 half, and the existing FIELD_LABEL_IS_TRANSLATED red. 3 failed, 6 passed.

The console test imports FormPage from 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.
  • Every console test file that names FormPage or buildSections (62 files): Test Files 62 passed (62), Tests 557 passed (557).
  • pnpm --filter @object-ui/console run type-check: exit 0.
  • pnpm exec eslint on the five touched files: 0 errors; warning counts equal to base for FormPage.tsx (26) and FormPage.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

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (Not touched.)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

Generated by Claude Code

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>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 16, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#2 · os-steve · session_01ADHkmSzhXR4yUAgwq1bQRi

维护者速读

  • 卡:public form (console FormPage): a loaded app translation bundle's object field label overrides the form entry's own label, so a visitor reads the agent-side label whenever the browser holds the bundle #34375(p2)。公开表单的字段如果写了自己的 label(例如「您的姓名」),只要浏览器里加载了应用翻译包,就会被对象字段的翻译(坐席侧的「提交人姓名」)覆盖。
  • 改了什么:
    • buildSections 在决定标签的同一处,记下标签来自表单条目还是对象字段(labelSource)。
    • 新增 rowLabel:条目自写的标签按服务端给的原样显示,因为表单接口已经本地化过;只有来自对象字段的标签才走翻译包覆盖。
    • 字段渲染、visibleWhen 故障提示、必填汇总提示、逐行必填错误这四处都用它,所以报错里的字段名和访客看到的一致。
    • @object-ui/i18n 的 fieldLabel 契约不变。
  • 钉子:(a) 加载了翻译包时,渲染的是条目标签;(b) 必填错误里用的是条目标签;(c) 对照:条目没写标签时,仍用翻译包里的对象字段翻译。三处消融都变红后已还原。console 中 FormPage 相关 62 个文件、557 个测试通过;type-check 通过。
  • CI:head 20d4db3(已合入最新 main),success 32 · skipped 13 · 无失败。非 governed。Clause-② no,Metadata-protocol none。

席位意见

标签来源在建行时就定下来,渲染时不再根据字符串去猜。四处调用共用一条规则,消息里不会出现访客看不到的字段名。同意落地。

席位核对 — ACCEPT · domain:ui#2 · head 20d4db3 · 2026-11-16T21:32Z

@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 43961197419 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Dogfood Regression Gate (3/3) — 失败步骤: Boot example apps and exercise real user flows

    @objectstack/dogfood:test:  FAIL   isolated  test/install-local-no-active-organization.dogfood.test.ts > dogfood: install-local under an organization wall, with a session that has no active organizati
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: expected { mode: 'inline', inserted: +0, …(5) } to match object { mode: 'inline', inserted: 28 }
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 32 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#2 · os-steve · session_01ADHkmSzhXR4yUAgwq1bQRi

Merge-queue triage: re-queue once · head 20d4db3 · 2026-11-16T21:52Z

The queue build failed on test/install-local-no-active-organization.dogfood.test.ts (inserted: 0 where 28 was expected). That assertion reads install-local seeding. This PR touches only ui files, none on that path.

Re-queued once on the same head. If it fails again without #34429 in the group, the seat triages it as this PR's.

@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 43963558735 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Plan Test Core shards — 失败步骤: Fetch this commit's history and the base branch(日志不可读,点进 job 看)

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

  • ⚠️ 本次没有可用的聚合签名(日志里没有能解析出测试文件名的 FAIL 行)—— 这不是「没有同签名的其他 PR」,是这一轮没测到。跨 PR 聚合本次不可用,请手工比对其他 PR 的同类评论。
  • ⚠️ 24h 评论账本没读完(超过 5 页仍未读到窗口尽头),所以上面的「不同 PR 数」是下界,不是全量。

历史信号:

  • ⚠️ 本 PR 过去 24h 已在队列失败 1 次(不含本次)。 内容未变而反复失败 ⇒ 高度怀疑 flaky 测试或与同组 PR 的语义冲突,重排不解决。
  • 过去 24h 队列共有 34 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

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

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants